duckdb-spreadsheets / list_functions.tsv
lhoestq's picture
lhoestq HF staff
add all functions
4c86203
Name Description
list[index] Bracket notation serves as an alias for list_extract.
list[begin:end] Bracket notation with colon is an alias for list_slice.
list[begin:end:step] list_slice in bracket notation with an added step feature.
array_pop_back(list) Returns the list without the last element.
array_pop_front(list) Returns the list without the first element.
flatten(list_of_lists) Concatenate a list of lists into a single list. This only flattens one level of the list (see examples).
len(list) Return the length of the list.
list_aggregate(list, name) Executes the aggregate function name on the elements of list. See the List Aggregates section for more details.
list_any_value(list) Returns the first non-null value in the list.
list_append(list, element) Appends element to list.
list_concat(list1, list2) Concatenate two lists. NULL inputs are skipped. See also ||
list_contains(list, element) Returns true if the list contains the element.
list_cosine_similarity(list1, list2) Compute the cosine similarity between two lists.
list_cosine_distance(list1, list2) Compute the cosine distance between two lists. Equivalent to 1.0 - list_cosine_similarity.
list_distance(list1, list2) Calculates the Euclidean distance between two points with coordinates given in two inputs lists of equal length.
list_distinct(list) Removes all duplicates and NULL values from a list. Does not preserve the original order.
list_dot_product(list1, list2) Computes the dot product of two same-sized lists of numbers.
list_negative_dot_product(list1, list2) Computes the negative dot product of two same-sized lists of numbers. Equivalent to - list_dot_product.
list_extract(list, index) Extract the indexth (1-based) value from the list.
list_filter(list, lambda) Constructs a list from those elements of the input list for which the lambda function returns true. See the Lambda Functions page for more details.
list_grade_up(list) Works like sort, but the results are the indexes that correspond to the position in the original list instead of the actual values.
list_has_all(list, sub-list) Returns true if all elements of sub-list exist in list.
list_has_any(list1, list2) Returns true if any elements exist is both lists.
list_intersect(list1, list2) Returns a list of all the elements that exist in both l1 and l2, without duplicates.
list_position(list, element) Returns the index of the element if the list contains the element. If the element is not found, it returns NULL.
list_prepend(element, list) Prepends element to list.
list_reduce(list, lambda) Returns a single value that is the result of applying the lambda function to each element of the input list. See the Lambda Functions page for more details.
list_resize(list, size[, value]) Resizes the list to contain size elements. Initializes new elements with value or NULL if value is not set.
list_reverse_sort(list) Sorts the elements of the list in reverse order. See the Sorting Lists section for more details about the NULL sorting order.
list_reverse(list) Reverses the list.
list_select(value_list, index_list) Returns a list based on the elements selected by the index_list.
list_slice(list, begin, end, step) list_slice with added step feature.
list_slice(list, begin, end) Extract a sublist using slice conventions. Negative values are accepted. See slicing.
list_sort(list) Sorts the elements of the list. See the Sorting Lists section for more details about the sorting order and the NULL sorting order.
list_transform(list, lambda) Returns a list that is the result of applying the lambda function to each element of the input list. See the Lambda Functions page for more details.
list_unique(list) Counts the unique elements of a list.
list_value(any, ...) Create a LIST containing the argument values.
list_where(value_list, mask_list) Returns a list with the BOOLEANs in mask_list applied as a mask to the value_list.
list_zip(list_1, list_2, ...[, truncate]) Zips k LISTs to a new LIST whose length will be that of the longest list. Its elements are structs of k elements from each list list_1, …, list_k, missing elements are replaced with NULL. If truncate is set, all lists are truncated to the smallest list length.
unnest(list) Unnests a list by one level. Note that this is a special function that alters the cardinality of the result. See the unnest page for more details.