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

feat: The "character_length" function handle "Binary" type #7350

Closed
wants to merge 6 commits into from

Conversation

parkma99
Copy link
Contributor

Which issue does this PR close?

Closes #7344

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 Aug 21, 2023
@JayjeetAtGithub
Copy link
Contributor

Thanks for working on this @parkma99. The fix works great !

@parkma99 parkma99 marked this pull request as ready for review August 22, 2023 12:56
let args: Vec<ColumnarValue> = args
.iter()
.map(|col_value| {
cast_column(col_value, &DataType::Utf8, None).unwrap()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In there ,I do not know how to handle this unwrap.

@tustvold
Copy link
Contributor

Perhaps we could implement this as part of the coercion rules as opposed to internal to the evaluation logic? See coerce_arguments_for_fun perhaps?

@parkma99
Copy link
Contributor Author

Perhaps we could implement this as part of the coercion rules as opposed to internal to the evaluation logic? See coerce_arguments_for_fun perhaps?

Thank you, it looks good, I will have a try lately

@parkma99
Copy link
Contributor Author

in #7344 (comment)

But I think it might also be necessary to make the LENGTH function support binaries.

I think it is a good solution. What do you think @tustvold ?

@tustvold
Copy link
Contributor

Responded on the linked ticket

@github-actions github-actions bot added the optimizer Optimizer rules label Aug 24, 2023
@github-actions github-actions bot removed the physical-expr Physical Expressions label Aug 24, 2023
@parkma99
Copy link
Contributor Author

cc @tustvold @JayjeetAtGithub

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.

Thank you for working on this @parkma99 and @JayjeetAtGithub

Can we please add a .slt level test for this functionality?

I think there is a single coercion rule change (the same as https://github.com/apache/arrow-datafusion/pull/7365/files#r1303360870) that will fix this issue as well

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 optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Internal error: The "character_length" function can only accept strings
4 participants