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

Implement array_element function #6974

Closed
izveigor opened this issue Jul 15, 2023 · 0 comments · Fixed by #6936
Closed

Implement array_element function #6974

izveigor opened this issue Jul 15, 2023 · 0 comments · Fixed by #6936
Labels
enhancement New feature or request

Comments

@izveigor
Copy link
Contributor

Is your feature request related to a problem or challenge?

Summary

Characteristic Description
Function name: array_element
Aliases: array_extract, list_element, list_extract, array[i]
Original function?: No
Function Description: Clickhouse: Get the element with the index n from the array arr. n must be any integer type. Indexes in an array begin from one. Negative indexes are supported. In this case, it selects the corresponding element numbered from the end. For example, arr[-1] is the last item in the array. If the index falls outside of the bounds of an array, it returns some default value (0 for numbers, an empty string for strings, etc.), except for the case with a non-constant array and a constant index 0 (in this case there will be an error Array indices are 1-based).
DuckDB: Extract the indexth (1-based) value from the list.
Sources: Concept ClickHouse DuckDB

Examples:

select array_element([1, 2, 3, 4], 3);
----
3
select array_element([1, 2, 3, 4], 1);
----
1

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant