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

Feature: support Array functions #7931

Closed
15 of 17 tasks
sundy-li opened this issue Sep 28, 2022 · 3 comments · Fixed by #12315
Closed
15 of 17 tasks

Feature: support Array functions #7931

sundy-li opened this issue Sep 28, 2022 · 3 comments · Fixed by #12315
Assignees
Labels
C-feature Category: feature

Comments

@sundy-li
Copy link
Member

sundy-li commented Sep 28, 2022

Summary

Description for this feature.

common functions for array @TCeason

aggr combinators @b41sh

  • array_unique(array) Counts the unique elements of a list.
  • array_distinct(array) Removes all duplicates and NULLs from a list.
  • array_aggr(array, 'agg'), aka array_<aggr>(array), eg: array_aggr([1,2,3], 'sum'), array_aggr([1,2,3], 'avg'), array_sum([1,2,3]
  • array_prepend(element, array)
  • array_append(array, element)
  • array_any_value(array)

low-priority tasks:

  • array_transform(array, lambda) (low-priority), eg: array_transform([1,2,3], x -> x + 1)
  • array_filter(array, lambda) (low-priority), eg: array_filter([1,2,3], x -> x > 1)
  • python style array comprehension (low-priority), eg: select [x+3 for x in [1,2,3]]
  • array_join(array)
  • ...
@sundy-li sundy-li added the C-feature Category: feature label Sep 28, 2022
@BohuTANG
Copy link
Member

Comments by @sundy-li :

  1. https://duckdb.org/docs/sql/functions/nested
  2. After the new expression is done.(Middle of November)

@BohuTANG
Copy link
Member

BohuTANG commented Feb 13, 2023

@sundy-li

There are two array-related aggregate functions are required from the user:

ClickHouse SQL like:

select UserID,  c, arrayReduce('count',RequestNum1) from (  
  select UserID, count(RequestNum) as c, groupArrayMovingAvg(50)(RequestNum) as RequestNum1 from
    (select UserID, RequestNum from hits_v1 order by RequestNum DESC)  
  group by UserID order by c DESC limit 1000)

Or are these two functions easy to use window functions?

@sundy-li
Copy link
Member Author

sundy-li commented Feb 13, 2023

we have array_<aggr> which covers arrayReduce function.

group_array_moving_avg can be implemented after we have window aggr function.

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

Successfully merging a pull request may close this issue.

4 participants