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

feat: add ARRAY_LENGTH UDF #4725

Merged
merged 3 commits into from
Mar 9, 2020

Conversation

big-andy-coates
Copy link
Contributor

@big-andy-coates big-andy-coates commented Mar 6, 2020

Description

fixes: #4724

ARRAY_LENGTH returns the length of any array passed to it, or 0 if null is passed.

Note, postgres's version takes a second INT parameter, which identifies which dimension to measure. The ksql version does not support this. It can be added later.

Do we want this in 5.5? cc @apurvam @derekjn @MichaelDrogalis ?

Testing done

Usual. Unit + QTT.

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

fixes: confluentinc#4724

`ARRAY_LENGTH` returns the length of any array passed to it, or `0` if null is passed.
@big-andy-coates big-andy-coates requested a review from a team as a code owner March 6, 2020 13:04
@big-andy-coates big-andy-coates changed the title fix: add ARRAY_LENGTH UDF feat: add ARRAY_LENGTH UDF Mar 6, 2020
Copy link
Contributor

@purplefox purplefox left a comment

Choose a reason for hiding this comment

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

LGTM

@big-andy-coates big-andy-coates merged commit 31a9d9d into confluentinc:master Mar 9, 2020
@big-andy-coates big-andy-coates deleted the array_length branch March 9, 2020 13:42
@hpgrahsl
Copy link
Contributor

very helpful and long-awaited function - THX!
can you maybe explain the intention why you decided to return 0 for null input? for me this feels unnatural. besides you also cannot distinguish the empty array case. THX for shedding some light on this.

big-andy-coates added a commit to big-andy-coates/ksql that referenced this pull request Apr 21, 2020
* fix: add ARRAY_LENGTH UDF

fixes: confluentinc#4724

`ARRAY_LENGTH` returns the length of any array passed to it, or `0` if null is passed.

(cherry picked from commit 31a9d9d)
big-andy-coates added a commit that referenced this pull request Apr 30, 2020
* feat: add ARRAY_LENGTH UDF (#4725)

fixes: #4724

`ARRAY_LENGTH` returns the length of any array passed to it, or `0` if null is passed.

(cherry picked from commit 31a9d9d)

* docs: scalar funcs update

Fix links in doc and improve docs around EXTRACTJSONFIELD

(cherry picked from commit 778570f)

* chore: switch array_length to return null on null (#4848)

(cherry picked from commit d464120)

Co-authored-by: Andy Coates <[email protected]>
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.

Add ARRAY_LENGTH UDF
4 participants