haohuaijin opened a new issue, #25232:
URL: https://github.com/apache/datafusion/issues/25232

   ### Describe the bug
   
   Filter interval inference uses mathematical inverse operations that are 
invalid for wrapping multiplication and truncating integer division. It can 
incorrectly mark a column as constant and remove a required sort.
   
   
   ### To Reproduce
   
   Reproduced on main at `bb21f51013`, without the statistics-ordering feature.
   
   ```sql
   SET datafusion.execution.target_partitions = 1;
   
   CREATE TABLE wrap_test(a INT) AS VALUES (-2147483647), (1);
   SELECT a FROM wrap_test
   WHERE a * 2::INT = 2::INT ORDER BY a DESC;
   -- Expected: 1, -2147483647
   -- Actual: -2147483647, 1
   
   CREATE TABLE division_test(a INT) AS VALUES (2), (3);
   SELECT a FROM division_test
   WHERE a / 2::INT = 1::INT ORDER BY a DESC;
   -- Expected: 3, 2
   -- Actual: 2, 3
   ```
   
   ### Expected behavior
   
   Inferred intervals must include every value that can satisfy the predicate 
under runtime integer semantics. These columns are not constant, so their sorts 
must be retained.
   
   
   ### Additional context
   
   find this when working on #25220 


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

Reply via email to