-
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
refactor: clean up loading of UDFs/UDTFs/UDAFs #3726
refactor: clean up loading of UDFs/UDTFs/UDAFs #3726
Conversation
private <T> Map<String, T> createMap(Function<Integer, T> valueSupplier) { | ||
Map<String, T> map = new HashMap<>(); | ||
for (int i = 0; i < ENTRIES; i++) { | ||
map.put(UUID.randomUUID().toString(), valueSupplier.apply(i)); |
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.
Add a test for null keys and null values. I see that you have an assertion for values to not be null but since the keys are optional schema, they could be null right? Also, there is not check in the actual class for null keys and values.
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.
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.
Ooops sorry, will add them there
private Range rangeUdf = new Range(); | ||
|
||
@Test | ||
public void shouldComputeIntRange() { |
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.
Is it an overkill to test for negative start and end?
], | ||
"inputs": [ | ||
{ | ||
"topic": "test_topic", "key": 1, "value": { |
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.
Add cases where key and value 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.
Hi @purplefox! It LGTM with one comment on handling null keys/values in the entries udf.
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 @purplefox! I like this patch :) (only reviewed the second commit, please merge the first one separately)
724c0a5
to
efa27bd
Compare
This PR cleans up some of the function loading code, mainly replacing some overly complex streams based logic with simpler direct iteration.
Description
This PR is a copy of #3702 which has been closed due to a corrupt Jenkins workspace.
Please note this is a stacked PR. Please don't review changes from other PRs in the stack.
This PR cleans up the loading of functions. The code has been simplified by replacing grungy stream logic with good old fashioned for loops. I've also extracted a couple of other things out to new functions to aid clarity.
Testing done
Non functional change
Reviewer checklist