-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix concat
simplifier for Utf8View types
#13346
Conversation
6c9f13e
to
8bad384
Compare
concat
simplifier for Utf8View types
@@ -282,15 +293,34 @@ pub fn simplify_concat(args: Vec<Expr>) -> Result<ExprSimplifyResult> { | |||
let mut new_args = Vec::with_capacity(args.len()); | |||
let mut contiguous_scalar = "".to_string(); | |||
|
|||
let mut merged_type = DataType::Utf8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than re-computing the merged type, could you just call
datafusion/datafusion/functions/src/string/concat.rs
Lines 70 to 71 in 6686e03
fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> { |
And use that type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @timsaucer -- I have a minor suggestion about how to clean up the code but I don't think it is necessary for merging this PR
I’ll apply the suggestion, but out of pocket for a few days. Likely Friday |
Converting to a draft so I don't accidentally merge this PR by accident :) |
@alamb this is ready for re-review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @timsaucer
Which issue does this PR close?
This addresses one item of #13330
Rationale for this change
Concat simplifier was not correctly combining the return types, so Utf8View was instead getting returned as Utf8, causing a schema failure.
What changes are included in this PR?
When combining schema in simplifier, follows the same rules to set the return type.
Are these changes tested?
Tested in unit tests and with tests in
datafusion-python
that identified the problem.Added additional checks in current unit test.
Are there any user-facing changes?
None