You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "haohuaijin (via GitHub)" <gi...@apache.org> on 2026/09/12 13:58:07 UTC

[I] Integer interval inference can incorrectly remove ORDER BY [datafusion]

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: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Integer interval inference can incorrectly remove ORDER BY [datafusion]

Posted by "haohuaijin (via GitHub)" <gi...@apache.org>.
haohuaijin commented on issue #25232:
URL: https://github.com/apache/datafusion/issues/25232#issuecomment-5646328789

   take


-- 
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-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Integer interval inference can incorrectly remove ORDER BY [datafusion]

Posted by "kosiew (via GitHub)" <gi...@apache.org>.
kosiew closed issue #25232: Integer interval inference can incorrectly remove ORDER BY
URL: https://github.com/apache/datafusion/issues/25232


-- 
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-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org