-
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
Port ArrayResize
to functions-array
subcrate
#9570
Conversation
ArrayResize
to function-arrays
subcrateArrayResize
to functions-arrays
subcrate
ArrayResize
to functions-arrays
subcrateArrayResize
to functions-array
subcrate
@@ -238,7 +238,7 @@ select log(-1), log(0), sqrt(-1); | |||
| array_intersect(array1, array2) | Returns an array of the elements in the intersection of array1 and array2. `array_intersect([1, 2, 3, 4], [5, 6, 3, 4]) -> [3, 4]` | | |||
| array_union(array1, array2) | Returns an array of the elements in the union of array1 and array2 without duplicates. `array_union([1, 2, 3, 4], [5, 6, 3, 4]) -> [1, 2, 3, 4, 5, 6]` | | |||
| array_except(array1, array2) | Returns an array of the elements that appear in the first array but not in the second. `array_except([1, 2, 3, 4], [5, 6, 3, 4]) -> [3, 4]` | | |||
| array_resize(array, size, value) | Resizes the list to contain size elements. Initializes new elements with value or empty if value is not set. `array_resize([1, 2, 3], 5, 0) -> [1, 2, 3, 4, 5, 6]` | | |||
| array_resize(array, size, value) | Resizes the list to contain size elements. Initializes new elements with value or empty if value is not set. `array_resize([1, 2, 3], 5, 0) -> [1, 2, 3, 0, 0]` | |
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.
👍
field.data_type().clone(), | ||
true, | ||
)))), | ||
_ => exec_err!( |
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.
nit
_ => exec_err!( | |
List(field) | FixedSizeList(field, _) => Ok(List(field.clone())), | |
LargeList(field) => Ok(LargeList(field.clone())), |
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.
Addressed
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.
LGTM! Thanks @erenavsarogullari
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 very much @erenavsarogullari and @Weijun-H for the review
@@ -893,6 +895,100 @@ pub fn array_length(args: &[ArrayRef]) -> Result<ArrayRef> { | |||
} | |||
} | |||
|
|||
/// array_resize SQL function |
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.
I think @jayzhan211 may have a plan to split these functions up into different modules (e.g. not one giant kernels.rs
file). No changes needed for this PR, just FYI
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 @alamb. Yes, our direction will be like that with the next PR.
@@ -2082,6 +2084,36 @@ array_sort(array, desc, nulls_first) | |||
|
|||
- list_sort | |||
|
|||
### `array_resize` |
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.
Its cool to see improvements to the documentation as part of the porting over 👍
Since I was taking a pass through anyways, I merged this PR up to main and fixed a compilation error. |
Thanks again @erenavsarogullari and @jayzhan211 |
Thanks @alamb for follow-up and merge. |
Which issue does this PR close?
Closes #9569.
What changes are included in this PR?
This PR aims to do following changes in terms of Epic #9285:
1-
ArrayResize
is ported tofunctions-array
subcrate,2-
array_resize
function documentation is added.Are these changes tested?
Yes, all
array.slt
basedarray_resize
tests are passed.Are there any user-facing changes?
No