findepi commented on code in PR #17088: URL: https://github.com/apache/datafusion/pull/17088#discussion_r2262953381
########## datafusion/sqllogictest/test_files/predicates.slt: ########## @@ -777,6 +777,52 @@ physical_plan 16)--------------------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1 17)----------------------DataSourceExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/core/tests/tpch-csv/part.csv]]}, projection=[p_partkey, p_brand], file_type=csv, has_header=true +# Simplification of a binary operator with a NULL value + +statement ok +create table t(x int) as values (1), (2), (3); + +query TT +EXPLAIN FORMAT INDENT SELECT x > NULL FROM t; +---- +logical_plan +01)Projection: Boolean(NULL) AS t.x > NULL +02)--TableScan: t projection=[] +physical_plan +01)ProjectionExec: expr=[NULL as t.x > NULL] +02)--DataSourceExec: partitions=1, partition_sizes=[1] + +query TT +EXPLAIN FORMAT INDENT SELECT * FROM t WHERE x > NULL; +---- +logical_plan EmptyRelation +physical_plan EmptyExec + +query TT +EXPLAIN FORMAT INDENT SELECT * FROM t WHERE x < 5 AND (10 * NULL < x); +---- +logical_plan +01)Filter: t.x < Int32(5) AND Boolean(NULL) +02)--TableScan: t projection=[x] +physical_plan +01)CoalesceBatchesExec: target_batch_size=8192 +02)--FilterExec: x@0 < 5 AND NULL +03)----DataSourceExec: partitions=1, partition_sizes=[1] + +query TT +EXPLAIN FORMAT INDENT SELECT * FROM t WHERE x < 5 OR (10 * NULL < x); +---- +logical_plan +01)Filter: t.x < Int32(5) OR Boolean(NULL) +02)--TableScan: t projection=[x] +physical_plan +01)CoalesceBatchesExec: target_batch_size=8192 +02)--FilterExec: x@0 < 5 OR NULL Review Comment: To be followed-up: in a projection context this cannot be simplified, but in a filter context (on top-level of a filter), it can. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org