alamb commented on issue #14944:
URL: https://github.com/apache/datafusion/issues/14944#issuecomment-2701581478

   - So I was writing some tests for 
https://github.com/apache/datafusion/pull/15012
   
   I found that a predicate like this: 
   
   ```sql
   month_id = '202502'
   ```
   
   Is actually coerced so that it does string comparison rather than integer 
comparison  (note the predicate in the plan below is `CAST(foo.i AS Utf8) = 
Utf8("2024")` rather than `foo.i = CAST("2024" as Utf8)
   
   ```
   DataFusion CLI v46.0.0
   > create table foo(i int) as values (1), (2), (3);
   0 row(s) fetched.
   Elapsed 0.033 seconds.
   
   > explain select i from foo where i = '2024';
   +---------------+-------------------------------------------------------+
   | plan_type     | plan                                                  |
   +---------------+-------------------------------------------------------+
   | logical_plan  | Filter: CAST(foo.i AS Utf8) = Utf8("2024")            |
   |               |   TableScan: foo projection=[i]                       |
   | physical_plan | CoalesceBatchesExec: target_batch_size=8192           |
   |               |   FilterExec: CAST(i@0 AS Utf8) = 2024                |
   |               |     DataSourceExec: partitions=1, partition_sizes=[1] |
   |               |                                                       |
   +---------------+-------------------------------------------------------+
   ```


-- 
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

Reply via email to