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

move Atan2, Atan, Acosh, Asinh, Atanh to datafusion-function #9872

Merged
merged 5 commits into from
Mar 31, 2024

Conversation

Weijun-H
Copy link
Member

Which issue does this PR close?

Relates #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 30, 2024
@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Mar 30, 2024
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.

Thanks @Weijun-H -- I think this PR may have a logical conflict with #9869 and the plan change looks like a regression to me.

Thankfully I think both issues can probably be fixed with a merge up from main and adding the appropriate monotonicity constraint

@@ -37,16 +37,8 @@ use strum_macros::EnumIter;
#[derive(Debug, Clone, PartialEq, Eq, Hash, EnumIter, Copy)]
pub enum BuiltinScalarFunction {
// math functions
/// atan
Atan,
/// atan2
Atan2,
Copy link
Contributor

Choose a reason for hiding this comment

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

any particular reason that you did not migrate Atan2?

--ProjectionExec: expr=[atan(c11@0) as atan_c11]
----RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
------CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/testing/data/csv/aggregate_test_100.csv]]}, projection=[c11], output_ordering=[c11@0 ASC NULLS LAST], has_header=true
--SortExec: expr=[atan_c11@0 ASC NULLS LAST]
Copy link
Contributor

Choose a reason for hiding this comment

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

This test seems to show a regression (there is now a sort in it).
I wonder if the issue is that you need to specify montononicity (which is now possible after #9869 from @tinfoil-knight )?

@alamb alamb marked this pull request as draft March 30, 2024 20:13
@alamb
Copy link
Contributor

alamb commented Mar 30, 2024

Marking as draft as I think this PR is no longer waiting on feedback. Please mark it as ready for review when it is ready for another look

@Weijun-H Weijun-H force-pushed the move-Atan-Acosh-Asinh-Atanh branch from 887c48f to a77e882 Compare March 31, 2024 02:07
@github-actions github-actions bot removed the sqllogictest SQL Logic Tests (.slt) label Mar 31, 2024
@Weijun-H Weijun-H marked this pull request as ready for review March 31, 2024 03:08
@Weijun-H Weijun-H requested a review from alamb March 31, 2024 03:08
@Weijun-H Weijun-H changed the title move Atan, Acosh, Asinh, Atanh to datafusion-function move Atan2, Atan, Acosh, Asinh, Atanh to datafusion-function Mar 31, 2024
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 great to me -- thank you @Weijun-H 🙏

@@ -68,6 +68,9 @@ get_optimal_return_type!(utf8_to_str_type, DataType::LargeUtf8, DataType::Utf8);
// `utf8_to_int_type`: returns either a Int32 or Int64 based on the input type size.
get_optimal_return_type!(utf8_to_int_type, DataType::Int64, DataType::Int32);

/// Creates a scalar function implementation for the given function.
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

signature: Signature,
}

impl Atan2 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe if we have more two argument math functions we can eventually macroize this like we have a macro for single argument functions

@alamb alamb merged commit 66c8ba2 into apache:main Mar 31, 2024
25 checks passed
@alamb
Copy link
Contributor

alamb commented Mar 31, 2024

merging this quickly to keep the train going and minimize potential conflicts

Lordworms pushed a commit to Lordworms/arrow-datafusion that referenced this pull request Apr 1, 2024
…on` (apache#9872)

* Refactor math functions in datafusion code

* fic ci

* fix: avoid regression

* refactor: move atan2 function

* chore: move atan2 test
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.

2 participants