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 abs to datafusion_functions #9286

Closed
Tracked by #9285
alamb opened this issue Feb 20, 2024 · 3 comments · Fixed by #9313
Closed
Tracked by #9285

Move abs to datafusion_functions #9286

alamb opened this issue Feb 20, 2024 · 3 comments · Fixed by #9313
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@alamb
Copy link
Contributor

alamb commented Feb 20, 2024

Is your feature request related to a problem or challenge?

Part of #9285 and #8045

The goal is to extract function definitions out of the datafusion core.

Describe the solution you'd like

Move the abs function to datafusion-functions

Target location: https://github.com/apache/arrow-datafusion/blob/main/datafusion/functions/src/math

Here is an example function: isnan: https://github.com/apache/arrow-datafusion/blob/e1f7b245168c5762135abc4e594bd81c508d7186/datafusion/functions/src/math/nans.rs#L31-L48

There is already coverage in https://github.com/apache/arrow-datafusion/blob/main/datafusion/sqllogictest/test_files/scalar.slt

Here are the steps I followed when porting isnan:

  1. Create a ScalarUDFImpl in the functions crate following an existing example, and stub out the invoke() function with todo!().
  2. Make sure cargo check -p datafusion-functions --all-features compiles successfully
  3. Remove the enum in BuiltInScalarFunctions (source link)
  4. Try and build with cargo check -p datafusion and the compiler will point out all the places in the code that has logic for this function
  5. While removing old code, copy the relevant parts back into the UDFs (like signature, and return_type and implementation for invoke()
  6. Verify that the sqllogictests pass: `

Describe alternatives you've considered

No response

Additional context

No response

@alamb alamb added enhancement New feature or request good first issue Good for newcomers labels Feb 20, 2024
@alamb
Copy link
Contributor Author

alamb commented Feb 20, 2024

I have tried to make this as well specified as possible and thus I think it would be a good first issue. However, we don't have a huge list of these functions yet so if you hit a snag let us know

@yyy1000
Copy link
Contributor

yyy1000 commented Feb 20, 2024

take

@alamb
Copy link
Contributor Author

alamb commented Feb 27, 2024

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants