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

Properly return a scalar value from a UDF when only input is scalar #753

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

mwylde
Copy link
Member

@mwylde mwylde commented Oct 10, 2024

We always send inputs to UDFs as arrays, because that's what the FFI is defined over. For scalar arguments (like literals) we convert it to an array with the same length as the non-scalar arguments. However, if there is only a scalar argument we don't know how long the array is supposed to be so we create a single element array. But this causes a runtime failure when trying to use the result of the UDF in the query.

The fix is to keep track of whether the original arguments were all scalars, and if so return a scalar result back instead of an array.

Fixes #699

@mwylde mwylde enabled auto-merge (squash) October 10, 2024 01:34
@mwylde mwylde merged commit 1d95e13 into master Oct 10, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sync UDFs: Unexpected Requirement for Parameter
1 participant