mirror of https://github.com/apache/druid.git
Add test for IS NOT NULL filter on join column in left join (#11636)
This commit is contained in:
parent
82049bbf0a
commit
60efbb51d0
|
@ -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
|
||||
@Parameters(source = QueryContextForJoinProvider.class)
|
||||
public void testInnerJoinSubqueryWithSelectorFilter(Map<String, Object> queryContext) throws Exception
|
||||
|
|
Loading…
Reference in New Issue