-
Notifications
You must be signed in to change notification settings - Fork 1k
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_CONCAT
UDF
#7761
feat: add ARRAY_CONCAT
UDF
#7761
Conversation
@confluentinc It looks like @patrickstuedi just signed our Contributor License Agreement. 👍 Always at your service, clabot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! Just a couple of thoughts.
ksqldb-engine/src/test/java/io/confluent/ksql/function/udf/array/ArrayConcatTest.java
Outdated
Show resolved
Hide resolved
ksqldb-engine/src/main/java/io/confluent/ksql/function/udf/array/ArrayConcat.java
Outdated
Show resolved
Hide resolved
8b10c90
to
e421153
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
took a quick scan of the PR - thanks @patrickstuedi!
if (left == null && right == null) { | ||
return null; | ||
} | ||
final List<T> result = new ArrayList(left.size() + right.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if left == null || right == null
wouldn't we get an NPE here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought so too, but there are unit tests for those cases. Not sure what to make of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for pointing out. missed that when changing the initialization to the exact number of elements. No idea what's going on with the tests, they should fail here. Will double check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests did catch this, sorry for missing to run them on that last change. Update fixes the issue in ArrayConcat.
"CREATE STREAM OUTPUT AS SELECT id, array_concat(arr1, arr2) as result FROM INPUT;" | ||
], | ||
"inputs": [ | ||
{"topic": "test_topic", "key": "r1", "value": {"arr1": [0,0,1,0,-1], "arr2": [1,-2,0]}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's also add the null cases here (left is null, right is null, both are null)
|
||
Returns an array representing the concatenation of both input arrays. | ||
|
||
Returns NULL if both input arrays are NULL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns NULL if both input arrays are NULL. | |
Returns NULL if both input arrays are NULL. If only one argument is NULL, the result is the other argument. |
... Or any other way you prefer to say it, but we should specify the behavior if just one arg is null.
6151326
to
ca419e4
Compare
I just checked on the test failures: https://jenkins.confluent.io/job/Confluentinc%20Contributors/job/ksql/job/PR-7761/7/#showFailuresLink It looks like the same set of tests started failing on master yesterday: https://jenkins.confluent.io/job/confluentinc/job/ksql/job/master/7992/#showFailuresLink |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @patrickstuedi !
ca419e4
to
57ce7de
Compare
Description
Adding
array_concat
UDF function.DESCRIBE function array_concat:
Testing done
Tested with different array values, including duplicates, null value array members and null value input parameters