You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "lgingerich (via GitHub)" <gi...@apache.org> on 2025/02/06 15:18:14 UTC

[PR] Apply take_function_args [datafusion]

lgingerich opened a new pull request, #14525:
URL: https://github.com/apache/datafusion/pull/14525

   ## Which issue does this PR close?
   - Closes #14516.
   
   ## What changes are included in this PR?
   Refactor function argument count validation for the following crates: `functions`.
   
   ## Are these changes tested?
   All changes are covered by existing tests.
   
   ## Are there any user-facing changes?
   No.
   


-- 
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: [PR] Use ` take_function_args` in more places [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #14525:
URL: https://github.com/apache/datafusion/pull/14525#discussion_r1949200715


##########
datafusion/expr/src/test/function_stub.rs:
##########
@@ -125,9 +125,7 @@ impl AggregateUDFImpl for Sum {
     }
 
     fn coerce_types(&self, arg_types: &[DataType]) -> Result<Vec<DataType>> {
-        if arg_types.len() != 1 {
-            return exec_err!("SUM expects exactly one argument");
-        }
+        let [array] = take_function_args(self.name(), arg_types)?;

Review Comment:
   this is so much nicer



-- 
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: [PR] Use ` take_function_args` in more places [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #14525:
URL: https://github.com/apache/datafusion/pull/14525#issuecomment-2648504081

   > I'll check out these new errors later today.
   > 
   > Is there a simple way to run all these tests locally without manually running each of the difference cargo test combinations? (I'm on MacOS)
   
   not sure -- there may be some scripts here https://github.com/apache/datafusion/tree/main/ci/scripts
   
   It would be great to help make it easier to test locally 


-- 
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: [PR] Use ` take_function_args` in more places [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #14525:
URL: https://github.com/apache/datafusion/pull/14525#issuecomment-2648247269

   FYI @findepi 


-- 
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: [PR] Use ` take_function_args` in more places [datafusion]

Posted by "lgingerich (via GitHub)" <gi...@apache.org>.
lgingerich commented on PR #14525:
URL: https://github.com/apache/datafusion/pull/14525#issuecomment-2648325869

   @alamb Should be fixed now. I just didn't have the language of the test properly matching this new function.


-- 
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: [PR] Apply take_function_args [datafusion]

Posted by "lgingerich (via GitHub)" <gi...@apache.org>.
lgingerich commented on PR #14525:
URL: https://github.com/apache/datafusion/pull/14525#issuecomment-2640124923

   @findepi Is there a good way to use `take_function_args()` outside of the `functions` crate?


-- 
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: [PR] Use ` take_function_args` in more places [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #14525:
URL: https://github.com/apache/datafusion/pull/14525#issuecomment-2654980522

   Thanks again @lgingerich 


-- 
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: [PR] Use ` take_function_args` in more places [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #14525:
URL: https://github.com/apache/datafusion/pull/14525


-- 
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: [PR] Use ` take_function_args` in more places [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #14525:
URL: https://github.com/apache/datafusion/pull/14525#issuecomment-2648250092

   Thank you so much @lgingerich 
   
   I started the CI checks
   
   FYI When I ran some of the tests locally I saw some failures which seem to be related:
   
   
   ```
    cargo test --test sqllogictests
   ...
        Running bin/sqllogictests.rs (target/debug/deps/sqllogictests-be41d049b57e846a)
   Completed 107 test files in 7 seconds                                                                                       External error: query is expected to fail with error:
   	(regex) DataFusion error: Execution error: map requires exactly 2 arguments, got 1 instead
   but got error:
   	DataFusion error: Execution error: map function requires 2 arguments, got 1
   [SQL] SELECT MAP(['POST', 'HEAD'])
   at test_files/map.slt:191
   
   Error: Execution("1 failures")
   error: test failed, to rerun pass `-p datafusion-sqllogictest --test sqllogictests`
   
   ```


-- 
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: [PR] Use ` take_function_args` in more places [datafusion]

Posted by "lgingerich (via GitHub)" <gi...@apache.org>.
lgingerich commented on PR #14525:
URL: https://github.com/apache/datafusion/pull/14525#issuecomment-2648489071

   I'll check out these new errors later today.
   
   Is there a simple way to run all these tests locally without manually running each of the difference cargo test combinations? (I'm on MacOS)


-- 
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: [PR] Apply take_function_args [datafusion]

Posted by "lgingerich (via GitHub)" <gi...@apache.org>.
lgingerich commented on PR #14525:
URL: https://github.com/apache/datafusion/pull/14525#issuecomment-2641605649

   > I think you would have to move it somwehere like `datafusion_common`
   
   Sounds good, I should get to that this weekend and then I'll apply `take_function_args()` in other crates.


-- 
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: [PR] Apply take_function_args [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #14525:
URL: https://github.com/apache/datafusion/pull/14525#issuecomment-2640906182

   
   
   > @findepi Is there a good way to use `take_function_args()` outside of the `functions` crate?
   
   I think you would have to move it somwehere like `datafusion_common`


-- 
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: [PR] Use ` take_function_args` in more places [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #14525:
URL: https://github.com/apache/datafusion/pull/14525#issuecomment-2650627501

   I took the liberty of merging this PR up from main to resolve some conflicts:
   
   ![Screenshot 2025-02-11 at 7 10 48 AM](https://github.com/user-attachments/assets/e2d4b812-58f8-458a-933a-ead11dc7eaca)
   


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