Skip to content

Conversation

@erenavsarogullari
Copy link
Member

@erenavsarogullari erenavsarogullari commented Mar 12, 2024

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 to functions-array subcrate,
2- array_resize function documentation is added.

Are these changes tested?

Yes, all array.slt based array_resize tests are passed.

Are there any user-facing changes?

No

@github-actions github-actions bot added logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates labels Mar 12, 2024
@erenavsarogullari erenavsarogullari changed the title Port ArrayResize to function-arrays subcrate Port ArrayResize to functions-arrays subcrate Mar 12, 2024
@erenavsarogullari erenavsarogullari changed the title Port ArrayResize to functions-arrays subcrate Port ArrayResize to functions-array subcrate Mar 12, 2024
| 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]` |
Copy link
Member

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!(
Copy link
Member

Choose a reason for hiding this comment

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

nit

Suggested change
_ => exec_err!(
List(field) | FixedSizeList(field, _) => Ok(List(field.clone())),
LargeList(field) => Ok(LargeList(field.clone())),

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed

Copy link
Member

@Weijun-H Weijun-H left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @erenavsarogullari

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 very much @erenavsarogullari and @Weijun-H for the review

}
}

/// array_resize SQL function
Copy link
Contributor

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

Copy link
Member Author

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.


- list_sort

### `array_resize`
Copy link
Contributor

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 👍

@erenavsarogullari
Copy link
Member Author

Thanks @alamb and @Weijun-H for the reviews. Merge conflict is also addressed.

@alamb
Copy link
Contributor

alamb commented Mar 14, 2024

Since I was taking a pass through anyways, I merged this PR up to main and fixed a compilation error.

@alamb alamb merged commit 9d0c05b into apache:main Mar 14, 2024
@alamb
Copy link
Contributor

alamb commented Mar 14, 2024

Thanks again @erenavsarogullari and @jayzhan211

@erenavsarogullari
Copy link
Member Author

Thanks @alamb for follow-up and merge.

@erenavsarogullari erenavsarogullari deleted the Issue-9569 branch March 14, 2024 14:57
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 physical-expr Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port ArrayResize to functions-array subcrate

3 participants