-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
HIVE-27563: Add typeof UDF #4547
Conversation
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.
Most of the functionality is tested in the unit test.
The q test is mostly verification that the UDF is registered correctly and executable.
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
|
||
@Override | ||
public Object evaluate(DeferredObject[] arguments) throws HiveException { | ||
Text returnValue = new Text(); |
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.
We can reuse the Writable instance for output as we do so in most UDFs.
https://github.com/apache/hive/blob/rel/release-4.0.0-alpha-2/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFSha2.java#L56
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've made the suggested change of reusing the returnValue. I also eliminated the inputType variable and just set the returnValue directly in initialize.
I've also added a multi row test.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information The version of Java (11.0.8) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17. |
…yush Saxena, okumin)
What changes were proposed in this pull request?
New UDF to get type of supplied argument
Why are the changes needed?
Helpful in tests and debugging
Does this PR introduce any user-facing change?
It adds a new UDF the users can use.
Is the change a dependency upgrade?
No
How was this patch tested?
Unit test added
q test added