adriangb commented on code in PR #23727: URL: https://github.com/apache/datafusion/pull/23727#discussion_r3639479529
########## datafusion/sqllogictest/test_files/simplify_expr.slt: ########## @@ -146,3 +146,23 @@ logical_plan physical_plan 01)ProjectionExec: expr=[column1@0 = 1 as opt1, column1@0 = 2 AND column1@0 != 2 as noopt1, column1@0 = 4 as opt2, column1@0 != 5 AND column1@0 = 5 as noopt2] 02)--DataSourceExec: partitions=1, partition_sizes=[1] + +# Identity Date cast in a comparison predicate. +# `cast(d AS date)` where `d` is already Date32 is an identity cast and should +# fold away, so the predicate compares against the bare column `d`. This enables +# downstream pruning / filter pushdown that expects a bare-column comparison. +statement ok +create table dates(d date) as values (DATE '2024-01-01'), (DATE '2024-01-02'); + +query TT +explain select d from dates where cast(d as date) = DATE '2024-01-01'; Review Comment: added in 1fe86c8 -- 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]
