tarak271 commented on code in PR #4469:
URL: https://github.com/apache/hive/pull/4469#discussion_r1257916705
##########
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFArrayIntersect.java:
##########
@@ -43,19 +47,27 @@ public GenericUDFArrayIntersect() {
ObjectInspector defaultOI = super.initialize(arguments);
checkArgCategory(arguments, ARRAY2_IDX, ObjectInspector.Category.LIST,
FUNC_NAME,
org.apache.hadoop.hive.serde.serdeConstants.LIST_TYPE_NAME); //Array1
is already getting validated in Parent class
+ if
(!ObjectInspectorUtils.compareTypes(arrayOI.getListElementObjectInspector(),
((ListObjectInspector) arguments[ARRAY2_IDX]).getListElementObjectInspector()))
{ // check if elements of arrays are comparable
+ throw new UDFArgumentTypeException(1, ERROR_NOT_COMPARABLE);
+ }
return defaultOI;
}
@Override public Object evaluate(DeferredObject[] arguments) throws
HiveException {
Object array = arguments[ARRAY_IDX].get();
+ Object array2 = arguments[ARRAY2_IDX].get();
+ if (array == null) {
+ return null;
+ }
- if (array == null || arrayOI.getListLength(array) <= 0) {
+ if (array2 == null) {
return null;
}
List<?> retArray3 = ((ListObjectInspector)
argumentOIs[ARRAY_IDX]).getList(array);
Review Comment:
changed variable names to match their usage
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]