2010YOUY01 commented on PR #25390:
URL: https://github.com/apache/datafusion/pull/25390#issuecomment-5711526755

   Thank you. This is a legitimate optimization, but I'm not sure the pattern 
is common enough to justify maintaining an additional, less intuitive optimizer 
rule.
   
   The same goal can already be achieved with a small application-side 
workaround, using the existing optimization that pushes `LIMIT` into aggregates:
   
   ```sql
   -- To check whether NDV > 1, run:
   SELECT DISTINCT v1 % 100
   FROM generate_series(10000000000) AS t1(v1)
   LIMIT 10;
   
   -- Then check whether the result contains more than one row.
   ```
   
   So I'm leaning toward avoiding this rule. DataFusion is increasingly 
constrained by implementation complexity, and the optimizer is already one of 
the trickiest parts to maintain.
   
   I'd reconsider if we can confirm that this is a sufficiently common query 
pattern to justify the additional complexity.
   


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