Skip to content
New issue

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

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

Already on GitHub? # to your account

DRAFT: arrow_cast function as UDF #9235

Closed

Conversation

brayanjuls
Copy link
Contributor

@brayanjuls brayanjuls commented Feb 15, 2024

Which issue does this PR close?

Closes #9143
Closes #9287

Rationale for this change

Migration of core functions to UDF.

What changes are included in this PR?

arrow_cast function migration.

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

@brayanjuls brayanjuls marked this pull request as draft February 15, 2024 06:03
@github-actions github-actions bot added the sql SQL Planner label Feb 15, 2024

pub const ARROW_CAST_NAME: &str = "arrow_cast";
#[derive(Debug)]
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks just about perfect. Thank you @brayanjuls

I plan to get #8985 merged shortly and then this PR should be possible.

🙏

alamb and others added 3 commits February 15, 2024 07:25
…ScalarStructBuilder` (apache#9229)

* Improve documentation on how to build `ScalarValue::Struct` and add `ScalarStructBuilder`

* Update datafusion/common/src/scalar/struct_builder.rs

* Improved docs

* update test

---------

Co-authored-by: comphead <comphead@users.noreply.github.com>
…aTypes) (apache#8985)

* ScalarValue return types from argument values

* change file name

* try using ?Sized

* use Ok

* move method default impl outside trait

* Use type trait for ExprSchemable

* fix nit

* Proposed Return Type from Expr suggestions (apache#1)

* Improve return_type_from_args

* Rework example

* Update datafusion/core/tests/user_defined/user_defined_scalar_functions.rs

---------

Co-authored-by: Junhao Liu <junhaoliu2023@gmail.com>

* Apply suggestions from code review

Co-authored-by: Alex Huang <huangweijun1001@gmail.com>

* Fix tests + clippy

* rework types to use dyn trait

* fmt

* docs

* Apply suggestions from code review

Co-authored-by: Jeffrey Vo <jeffrey.vo.australia@gmail.com>

* Add docs explaining what happens when both `return_type` and `return_type_from_exprs` are called

* clippy

* fix doc -- comedy of errors

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Co-authored-by: Alex Huang <huangweijun1001@gmail.com>
Co-authored-by: Jeffrey Vo <jeffrey.vo.australia@gmail.com>
@alamb
Copy link
Contributor

alamb commented Feb 15, 2024

Now that #8985 is merged, I think this PR can proceed.

matthewmturner and others added 11 commits February 15, 2024 11:30
* Dont call multiunzip when no stats

* Update docstring
* GROUP-BY prioritizes input columns in case of ambiguity

* Update datafusion/sqllogictest/test_files/aggregate.slt

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

* Update datafusion/sqllogictest/test_files/aggregate.slt

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
…l` `ScalarValue::Struct` (apache#9238)

* Minor: Add example for `ScalarStructBuilder::new_null`

* Fix null display

* fix docs

* tweak
…join (apache#9154)

* fix: issue apache#9130 substitute redundant columns when doing cross join

* add test

* fix:bugs

* optimize code

* optimize code

* deleting extra debug info

* adding test and optimized code

* fix test

* fix test
…w_cast to be resolved when added to an expression.
…into feat/migrate_arrow_cast_to_udf

# Conflicts:
#	datafusion/functions/src/core/arrow_cast.rs
@github-actions github-actions bot added documentation Improvements or additions to documentation development-process Related to development process of DataFusion logical-expr Logical plan and expressions physical-expr Physical Expressions optimizer Optimizer rules core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) labels Feb 19, 2024
@brayanjuls
Copy link
Contributor Author

I messed the merge of the latest changes and somehow now they all appear in this PR. I will try to fix it, otherwise I will open a new PR.

@alamb
Copy link
Contributor

alamb commented Feb 20, 2024

Thanks @brayanjuls -- I also filed #9287 to track this issue. I thought of a potential issue we may hit as well which I will link to #9287 as well

@brayanjuls
Copy link
Contributor Author

@alamb I am closing this PR as I opened #9298 to fix the merging issues I have here.

@brayanjuls brayanjuls closed this Feb 21, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
core Core DataFusion crate development-process Related to development process of DataFusion documentation Improvements or additions to documentation logical-expr Logical plan and expressions optimizer Optimizer rules physical-expr Physical Expressions sql SQL Planner sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move arrow_cast to datafusion-functions crate Issue using arrow_cast in ORDER BY expressions
10 participants