You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "Jefffrey (via GitHub)" <gi...@apache.org> on 2025/10/04 01:50:40 UTC

[I] Add docstring for `Window::try_new_with_schema` [datafusion]

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

   ### Is your feature request related to a problem or challenge?
   
   https://github.com/apache/datafusion/blob/daeb6597a0c7344735460bb2dce13879fd89d7bd/datafusion/expr/src/logical_plan/plan.rs#L2546-L2564
   
   Introduced by #10850 but we don't have any docs on it to explain when to use this and what it expects from it's inputs. Also would be nice to fix the error message to be more descriptive.
   
   ### Describe the solution you'd like
   
   Docstring highlighting when to use it (apparently more performant than `try_new` but need to uphold some invariants regarding the schema as shown by the error check), also update the error message. In #17770 we see an error message appear like:
   
   ```
   Error during planning: Window has mismatch between number of expressions (1) and number of fields in schema (0)
   ```
   
   For query:
   
   ```sql
   WITH suppliers AS (
     SELECT *
     FROM (VALUES (1, 10.0), (1, 20.0)) AS t(nation, acctbal)
   )
   SELECT
     ROW_NUMBER() OVER (PARTITION BY nation ORDER BY acctbal DESC) AS rn
   FROM suppliers AS s
   WHERE acctbal > (
     SELECT AVG(acctbal) FROM suppliers
   );
   ```
   
   But this doesn't make sense (how is "number of fields in schema" zero?).
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### 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: 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] Add docstring for `Window::try_new_with_schema` [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #17912: Add docstring for `Window::try_new_with_schema`
URL: https://github.com/apache/datafusion/issues/17912


-- 
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] Add docstring for `Window::try_new_with_schema` [datafusion]

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

   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