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

   ### Describe the bug
   
   Planning time, or to be precise: optimization time, is high for queries that 
have a window function partitioned by multiple columns.
   
   
   
   ### To Reproduce
   
   ```sql
   WITH source AS (
       SELECT
           1 AS n,
           '' AS a1, '' AS a2, '' AS a3, '' AS a4, '' AS a5, '' AS a6, '' AS 
a7, '' AS a8,
           '' AS a9, '' AS a10, '' AS a11, '' AS a12
   )
   SELECT
       sum(n) OVER (PARTITION BY
           a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12
       )
   FROM source;
   ```
   
   In 48.0.1 this takes ~543 seconds. 
   
   On current `main` this takes ~292 seconds
   It looks `O(4ⁿ)`[^1] where `n` is number of columns partitioned by
   
   [^1]: based on timings when adding or removing a column
   
   ### Expected behavior
   
   In DataFusion 45.0.0 this query runs in <100ms.
   
   ### Additional context
   
   _No response_


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