okumin commented on code in PR #4513:
URL: https://github.com/apache/hive/pull/4513#discussion_r1272154121
##########
ql/src/test/queries/clientpositive/udf_array_union.q:
##########
@@ -0,0 +1,42 @@
+--! qt:dataset:src
+
+-- SORT_QUERY_RESULTS
+
+set hive.fetch.task.conversion=more;
+
+DESCRIBE FUNCTION array_union;
+DESCRIBE FUNCTION EXTENDED array_union;
Review Comment:
For our info: I ran some edge cases with Spark SQL
```
spark-sql (default)>
> SELECT array_union(array(1, 2, 3, null,3,4),array(1, 3,
null));
[1,2,3,null,4]
spark-sql (default)> SELECT array_union(array(),array());
[]
spark-sql (default)> SELECT array_union(array(null),array(null));
[null]
spark-sql (default)> SELECT array_union(CAST(null AS ARRAY<INT>), CAST(null
AS ARRAY<INT>));
NULL
spark-sql (default)> SELECT array_union(CAST(null AS ARRAY<INT>), ARRAY(1,
2));
NULL
spark-sql (default)> SELECT array_union(ARRAY(1, 2), CAST(null AS
ARRAY<INT>));
NULL
```
##########
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFArrayUnion.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.ql.udf.generic;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
+import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
+
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * GenericUDFArrayUnion
+ */
+@Description(name = "array_union", value = "_FUNC_(array1, array2) - Returns
an array of the elements in the union of "
+ + "array1 and array2 without duplicates.", extended = "Example:\n"
+ + " > SELECT _FUNC_(array(1, 2, 2,4), array(2,3)) FROM src LIMIT 1;\n"
+ + " [1,2,3,4]")
+public class GenericUDFArrayUnion extends AbstractGenericUDFArrayBase {
+ static final int ARRAY2_IDX = 1;
Review Comment:
NIT: This can be private
--
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]