Add test for IS NOT NULL filter on join column in left join (#11636)

This commit is contained in:
Rohan Garg 2021-09-06 12:20:41 +05:30 committed by GitHub
parent 82049bbf0a
commit 60efbb51d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 44 additions and 0 deletions

View File

@ -18252,6 +18252,50 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
); );
} }
@Test
@Parameters(source = QueryContextForJoinProvider.class)
public void testLeftJoinWithNotNullFilter(Map<String, Object> queryContext) throws Exception
{
testQuery(
"SELECT s.dim1, t.dim1\n"
+ "FROM foo as s\n"
+ "LEFT JOIN foo as t "
+ "ON s.dim1 = t.dim1 "
+ "and s.dim1 IS NOT NULL\n",
queryContext,
ImmutableList.of(
newScanQueryBuilder()
.dataSource(
join(
new TableDataSource(CalciteTests.DATASOURCE1),
new QueryDataSource(newScanQueryBuilder()
.dataSource(CalciteTests.DATASOURCE1)
.intervals(querySegmentSpec(Filtration.eternity()))
.columns(ImmutableList.of("dim1"))
.resultFormat(ScanQuery.ResultFormat.RESULT_FORMAT_COMPACTED_LIST)
.context(QUERY_CONTEXT_DEFAULT)
.build()),
"j0.",
equalsCondition(DruidExpression.fromColumn("dim1"), DruidExpression.fromColumn("j0.dim1")),
JoinType.LEFT
)
)
.intervals(querySegmentSpec(Filtration.eternity()))
.columns("dim1", "j0.dim1")
.context(queryContext)
.build()
),
ImmutableList.of(
new Object[]{"", ""},
new Object[]{"10.1", "10.1"},
new Object[]{"2", "2"},
new Object[]{"1", "1"},
new Object[]{"def", "def"},
new Object[]{"abc", "abc"}
)
);
}
@Test @Test
@Parameters(source = QueryContextForJoinProvider.class) @Parameters(source = QueryContextForJoinProvider.class)
public void testInnerJoinSubqueryWithSelectorFilter(Map<String, Object> queryContext) throws Exception public void testInnerJoinSubqueryWithSelectorFilter(Map<String, Object> queryContext) throws Exception