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

LIST functions #535

Closed
ray6080 opened this issue Mar 29, 2022 · 2 comments
Closed

LIST functions #535

ray6080 opened this issue Mar 29, 2022 · 2 comments
Labels
good-warm-up Good warm up feature

Comments

@ray6080
Copy link
Contributor

ray6080 commented Mar 29, 2022

Support common LIST functions.

For phase1:
We can support the following functions:
Assume the list l contains value : [4,5,6]

Function Description Example Result Support
list_extract(list, index), list_element(list, index), list[index] extract the indexth (1-based) value from the list list_extract(l, 2), l[2] 6
list_slice(list, begin, end), list[begin:end] extract a sublist using slice conventions. NULLs are interpreted as the bounds of the LIST. Negative values are accepted list_slice(l, 1, NULL) [5,6]
list_value(any, ...) create a LIST containing the argument values list_value(4, 5, 6) [4, 5, 6]
len(list) return the length of the list len([2,3,4]) 3
list_concat(list1, list2), list_cat(list1, list2), array_concat(list1, list2), array_cat(list1, list2) concatenate two lists list_concat([2, 3], [4, 5, 6]) [2,3,4,5,6]
list_prepend(element, list),array_prepend(element, list),array_push_front(element, list) prepend element to list list_prepend(3, [4, 5, 6]) [3, 4, 5, 6]
list_append(list, element),array_append(element, list),array_push_back(element, list) append element to list list_append([2, 3], 4) [2,3,4]
list_contains(list, element),list_has(list, element),array_contains(list, element),array_has(list, element) return true if the list contains the element list_contains([1, 2, NULL], 1) true
list_position(list, element),list_indexof(list, element),array_position(list, element),array_indexof(list, element) return the index of the element if the list contains the element list_contains([1, 2, NULL], 2) 2

For phase2:
we should support list with aggregation, map, range functions.

See https://duckdb.org/docs/sql/functions/nested for reference.

@ray6080 ray6080 mentioned this issue Mar 31, 2022
46 tasks
@semihsalihoglu-uw semihsalihoglu-uw added the good-warm-up Good warm up feature label Sep 6, 2022
@aziz-mu
Copy link
Contributor

aziz-mu commented Oct 24, 2022

Can this issue be closed? Currently list_creation does the same thing that list_value should do. E.g. MATCH (o:organisation) RETURN list_creation("a",o.name,"b","c") currently works

@ray6080
Copy link
Contributor Author

ray6080 commented Nov 15, 2022

Close this as functions for phase 1 are done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-warm-up Good warm up feature
Projects
None yet
Development

No branches or pull requests

3 participants