Per the commit history I think you can find something in https://issues.apache.org/jira/browse/CALCITE-373.
Meanwhile, "dim='a' OR dim=null" can be simplified to dim='a'? -Rui On Fri, Jun 5, 2020 at 2:13 PM Maytas Monsereenusorn <[email protected]> wrote: > Hi Calcite, > > I am wondering why we convert a value list with NULL into an inline table. > The code is in SqlToRelConverter, where we call > !containsNullLiteral(valueList). For example, if I have a SQL select * from > druid.foo where dim in ('a', null) then why do we not convert this to > dim='a' OR dim=null. > Furthermore, this then can be simply to just dim='a' since dim=null is > always null. > > The plan I got after converting SqlNode to RelNode: > LogicalProject(__time=[$0], cnt=[$1], dim1=[$2], dim2=[$3], dim3=[$4], > m1=[$5], m2=[$6], unique_dim1=[$7]) > LogicalJoin(condition=[=($3, $8)], joinType=[inner]) > LogicalTableScan(table=[[druid, foo]]) > LogicalAggregate(group=[{0}]) > LogicalValues(tuples=[[{ 'a' }, { null }]]) > however, i expect: > LogicalProject(__time=[$0], cnt=[$1], dim1=[$2], dim2=[$3], dim3=[$4], > m1=[$5], m2=[$6], unique_dim1=[$7]) > LogicalFilter(condition=[OR(=($3, 'a'), =($3, null))]) > LogicalTableScan(table=[[druid, foo]]) > > or something like: > LogicalProject(__time=[$0], cnt=[$1], dim1=[$2], dim2=[$3], dim3=[$4], > m1=[$5], m2=[$6], unique_dim1=[$7]) > LogicalFilter(condition=[=($3, 'a')]) > LogicalTableScan(table=[[druid, foo]]) > > Thanks! > -Maytas >
