HIVE-27563: Add typeof UDF#4547
Conversation
There was a problem hiding this comment.
Most of the functionality is tested in the unit test.
The q test is mostly verification that the UDF is registered correctly and executable.
|
|
||
| @Override | ||
| public Object evaluate(DeferredObject[] arguments) throws HiveException { | ||
| Text returnValue = new Text(); |
There was a problem hiding this comment.
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.
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!
|
…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