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

Fix panic in struct function with mixed scalar/array arguments #9775

Merged
merged 1 commit into from
Mar 24, 2024

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Mar 24, 2024

Which issue does this PR close?

Fixes #9773

Rationale for this change

Bug (see #9773)

What changes are included in this PR?

Fix bug by calling the correct api, add test

Are these changes tested?

Yes, new test

Are there any user-facing changes?

Less bugs

@alamb alamb requested a review from Ted-Jiang March 24, 2024 12:04
@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Mar 24, 2024
})
})
.collect::<Result<Vec<ArrayRef>>>()?;
let arrays = ColumnarValue::values_to_arrays(args)?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also filed
I also filed #9774 to improve the documentation

.map(|x| {
Ok(match x {
ColumnarValue::Array(array) => array.clone(),
ColumnarValue::Scalar(scalar) => scalar.to_array()?.clone(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the bug here is that this always makes a 1 row array, even if one of the other arguments has more than 1 row.

Copy link
Contributor

@yyy1000 yyy1000 left a comment

Choose a reason for hiding this comment

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

I reviewed it and it looks good to me :)
(when I port this function I didn't notice this XD

@alamb
Copy link
Contributor Author

alamb commented Mar 24, 2024

I reviewed it and it looks good to me :) (when I port this function I didn't notice this XD

Thanks @yyy1000 !

It certainly didn't have test coverage either, and I think that bug has existed for quite a while

@alamb
Copy link
Contributor Author

alamb commented Mar 24, 2024

Thank you for the review @viirya

@alamb alamb merged commit bd9b33c into apache:main Mar 24, 2024
23 checks passed
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.

Panic with struct function with arguments intermixed arrays / scalar
3 participants