Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port tan, tanh to datafusion-functions #9535

Merged
merged 4 commits into from
Mar 12, 2024
Merged

Conversation

ongchi
Copy link
Contributor

@ongchi ongchi commented Mar 10, 2024

Which issue does this PR close?

Part of #9285

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added logical-expr Logical plan and expressions physical-expr Physical Expressions labels Mar 10, 2024
@ongchi ongchi marked this pull request as draft March 10, 2024 13:22
@ongchi ongchi marked this pull request as ready for review March 10, 2024 14:21
}

fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
if arg_types.len() != 1 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a duplication with #9401, we can remove it, or use a simple internal_err.


fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
if arg_types.len() != 1 {
return Err(plan_datafusion_err!(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same as above.

Copy link
Member

@jonahgao jonahgao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for the generate_signature_error_msg, everything else looks good to me!

Comment on lines +38 to +42
signature: Signature::uniform(
1,
vec![DataType::Float64, DataType::Float32],
Volatility::Immutable,
),
Copy link
Contributor Author

@ongchi ongchi Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for the generate_signature_error_msg, everything else looks good to me!

I'm thinking about if the signature has a fixed number of args to 1, is it safe to ignore length checking of arg_types in ScalarUDFImpl::return_type? So the error message generation could be eliminated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's safe, that's exactly what was done in PR 9401. We can verify it through a test in sqllogictest.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me -- thank you @ongchi and @jonahgao for the review. 🚀

@alamb
Copy link
Contributor

alamb commented Mar 12, 2024

I merged up from main to resolve conflicts on this PR

@alamb alamb merged commit bd9a272 into apache:main Mar 12, 2024
23 checks passed
@alamb
Copy link
Contributor

alamb commented Mar 12, 2024

Thanks agian @ongchi and @jonahgao

@ongchi ongchi deleted the port-tan-func branch March 14, 2024 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions physical-expr Physical Expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants