Jefffrey commented on code in PR #18519:
URL: https://github.com/apache/datafusion/pull/18519#discussion_r2501833118
##########
datafusion/sqllogictest/test_files/math.slt:
##########
@@ -705,3 +705,30 @@ select FACTORIAL(350943270);
statement ok
drop table signed_integers
+
+# Null propagation for log
+query TT
+EXPLAIN SELECT log(NULL, c2) from aggregate_simple;
+----
+logical_plan
+01)Projection: Float64(NULL) AS log(NULL,aggregate_simple.c2)
+02)--TableScan: aggregate_simple projection=[]
+physical_plan
+01)ProjectionExec: expr=[NULL as log(NULL,aggregate_simple.c2)]
+02)--DataSourceExec: file_groups={1 group:
[[WORKSPACE_ROOT/datafusion/core/tests/data/aggregate_simple.csv]]},
file_type=csv, has_header=true
Review Comment:
On main this fails like so:
```diff
1. query result mismatch:
[SQL] EXPLAIN SELECT log(NULL, c2) from aggregate_simple;
[Diff] (-expected|+actual)
logical_plan
- 01)Projection: Float64(NULL) AS log(NULL,aggregate_simple.c2)
- 02)--TableScan: aggregate_simple projection=[]
+ 01)Projection: log(Float64(NULL), aggregate_simple.c2) AS
log(NULL,aggregate_simple.c2)
+ 02)--TableScan: aggregate_simple projection=[c2]
physical_plan
- 01)ProjectionExec: expr=[NULL as log(NULL,aggregate_simple.c2)]
- 02)--DataSourceExec: file_groups={1 group:
[[WORKSPACE_ROOT/datafusion/core/tests/data/aggregate_simple.csv]]},
file_type=csv, has_header=true
+ 01)ProjectionExec: expr=[log(NULL, c2@0) as
log(NULL,aggregate_simple.c2)]
+ 02)--RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
+ 03)----DataSourceExec: file_groups={1 group:
[[WORKSPACE_ROOT/datafusion/core/tests/data/aggregate_simple.csv]]},
projection=[c2], file_type=csv, has_header=true
at
/Users/jeffrey/Code/datafusion/datafusion/sqllogictest/test_files/math.slt:710
```
- On main it still computes the log; in this PR the log function gets
optimized away entirely
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]