Skip to content

[datafusion-spark] Add Spark-compatible char expression #15994

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

Merged
merged 5 commits into from
May 16, 2025

Conversation

andygrove
Copy link
Member

@andygrove andygrove commented May 8, 2025

Which issue does this PR close?

Part of #15914

Rationale for this change

Add another Spark expression. This expression was originally contributed to Comet by @vaibhawvipul in apache/datafusion-comet#513

What changes are included in this PR?

Add new expression and tests

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label May 8, 2025
@andygrove
Copy link
Member Author

@shehabgamin @alamb fyi

@vaibhawvipul
Copy link

Thank you for mention! ❤️

Copy link
Contributor

@shehabgamin shehabgamin left a comment

Choose a reason for hiding this comment

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

🚀

fn chr(args: &[ArrayRef]) -> Result<ArrayRef> {
let integer_array = as_int64_array(&args[0])?;

// first map is the iterator, second is for the `Option<_>`
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this part can be more optimal by using Stringbuilder (like this) 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. I filed a tracking issue #16009

@alamb alamb merged commit 3e30f77 into apache:main May 16, 2025
27 checks passed
@alamb
Copy link
Contributor

alamb commented May 16, 2025

Thanks @andygrove and @shehabgamin -- how close do you think we are to being able to open up the datafusion-spark floodgates to contributors?

@andygrove
Copy link
Member Author

Thanks @andygrove and @shehabgamin -- how close do you think we are to being able to open up the datafusion-spark floodgates to contributors?

Ideally, I would like to wait for 48 release, upgrade Comet to use that and adopt the new expressions added so far to confirm all is ok, then I plan on writing an epic in Comet to convert all of our expressions from PhysicalExpr to ScalarUDFImpl as step 1, and contribute upstream as step 2.

@andygrove andygrove deleted the spark-char branch May 16, 2025 19:46
@alamb
Copy link
Contributor

alamb commented May 16, 2025

Makes sense to me 👍

jfahne pushed a commit to jfahne/datafusion that referenced this pull request May 18, 2025
* Add Spark-compatible char expression

* Add slt test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants