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


##########
ql/src/test/queries/clientpositive/udf_array_distinct.q:
##########
@@ -0,0 +1,20 @@
+--! qt:dataset:src
+set hive.fetch.task.conversion=more;
+
+DESCRIBE FUNCTION array_distinct;
+DESCRIBE FUNCTION EXTENDED array_distinct;
+
+-- evalutes function for array of primitives
+SELECT array_distinct(array(1, 2, 3, null,3,4)) FROM src tablesample (1 rows);
+
+SELECT array_distinct(array()) FROM src tablesample (1 rows);
+
+SELECT array_distinct(array(null)) FROM src tablesample (1 rows);
+
+SELECT array_distinct(array(1.12, 2.23, 3.34, null,1.11,1.12,2.9)) FROM src 
tablesample (1 rows);
+
+SELECT array_distinct(array(1.1234567890, 2.234567890, 3.34567890, null, 
3.3456789, 2.234567,1.1234567890)) FROM src tablesample (1 rows);
+
+SELECT array_distinct(array(11234567890, 2234567890, 334567890, null, 
11234567890, 2234567890, 334567890, null)) FROM src tablesample (1 rows);
+
+SELECT 
array_distinct(array(array("a","b","c","d"),array("a","b","c","d"),array("a","b","c","d","e"),null,array("e","a","b","c","d")))
 FROM src tablesample (1 rows);

Review Comment:
   Added another table that contains NULL values in array, since `SELECT 
array_distinct(null) FROM src tablesample (1 rows);` is throwing exception from 
UDF code
   
   `Caused by: org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException: "array" 
expected at function ARRAY_DISTINCT, but "void" is found`       
   `at 
org.apache.hadoop.hive.ql.udf.generic.AbstractGenericUDFArrayBase.checkArgCategory(AbstractGenericUDFArrayBase.`



-- 
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]

Reply via email to