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

Add list_cat, list_concat, list_repeat #942

Merged
merged 5 commits into from
Nov 12, 2024

Conversation

kosiew
Copy link
Contributor

@kosiew kosiew commented Nov 7, 2024

Which issue does this PR close?

Completes 3 tasks in #463

Rationale for this change

This PR adds new functions list_cat, list_concat, list_repeat.

What changes are included in this PR?

Added the list_cat, list_concat, list_repeat functions.
Updated the Python bindings in functions.py and provided unit tests in test_functions.py.
Updated the documentation (expressions.rst) to include examples on how to use the new functions.

Are there any user-facing changes?

The list_cat, list_concat, list_repeat functions are now available for users working with arrays allowing users to concatenate and repeat arrays within their DataFusion queries.

There are no breaking changes to public APIs.

@kosiew kosiew force-pushed the add-list-functions branch from 9f47b6b to 28e677d Compare November 8, 2024 01:58
Copy link
Contributor

@timsaucer timsaucer 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! This is a nice addition.

I just have the one suggestion to the online documentation.

Comment on lines 113 to 114
To concatenate two arrays, you can use the function :py:func:`datafusion.functions.list_cat` or :py:func:`datafusion.functions.list_concat`.
These functions return a new array that is the concatenation of the input arrays.
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend we change all references in this file to the array_ versions rather than the list_ versions since I think the primary method is array_ and the list_ version is a convenient alias.

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 have changed the list_ references to array_ references.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you! I’ll wait for CI to pass and then I’ll merge. Nice work on this PR!

@timsaucer timsaucer merged commit 53cdb11 into apache:main Nov 12, 2024
15 checks passed
kosiew added a commit to kosiew/datafusion-python that referenced this pull request Nov 19, 2024
* Add list_cat, list_concat

* Add list_repeat

* docs: add examples for list_cat, list_concat, and list_repeat functions

* Amend list_repeat code example - literal

* Amend list_ to array_ in documentation
@kosiew kosiew deleted the add-list-functions branch November 25, 2024 07:05
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.

2 participants