Skip to content

Additional higher order functions to work with arrays#2942

Closed
astudnev wants to merge 8 commits intoClickHouse:masterfrom
astudnev:cum_sum_limit2
Closed

Additional higher order functions to work with arrays#2942
astudnev wants to merge 8 commits intoClickHouse:masterfrom
astudnev:cum_sum_limit2

Conversation

@astudnev
Copy link
Copy Markdown
Contributor

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

I added couple functions to work with arrays, as i found no way to implement the functionality using the provided array functions.

  1. cumulative sum with limit ( if acc value less than 0, zero is accumulated ). Ideal solution would be to implement a reduce function, which accepts 2 parameters - array and accumulating value, but i fail to program so far

  2. difference between values in array. This could be implemented using mapArray and couple other functions, but this will be nice to do in one call

Copy link
Copy Markdown
Contributor

@VadimPlh VadimPlh left a comment

Choose a reason for hiding this comment

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

Hi, thanks for your PR!

  1. Could you add tests, please? (You can see examples here and tutorial here )
  2. Delete ci/default-config from your pr.
  3. Please, add info about new functions to the beginning of the file.
  4. On this simple test SELECT arrayDifference([0, 100, 2]) result is [0,100,18446744073709551518]. I think the result of arrayDifference() should always be a sign.

@alexey-milovidov
Copy link
Copy Markdown
Member

Do you have a time to do the required modifications?

@VadimPlh
Copy link
Copy Markdown
Contributor

#3009 Fix

@VadimPlh VadimPlh closed this Aug 31, 2018
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.

4 participants