You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "tarak271 (via GitHub)" <gi...@apache.org> on 2023/07/10 08:39:18 UTC

[GitHub] [hive] tarak271 commented on a diff in pull request #4469: HIVE-27482 - Minor issues in array_intersect udf

tarak271 commented on code in PR #4469:
URL: https://github.com/apache/hive/pull/4469#discussion_r1257916240


##########
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) {

Review Comment:
   Changed as recommended



-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org