File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import java.util
22
22
import java .util .Properties
23
23
24
24
import org .apache .hadoop .conf .Configuration
25
- import org .apache .hadoop .hive .ql .udf .generic .GenericUDF
25
+ import org .apache .hadoop .hive .ql .udf .generic .{ GenericUDAFAverage , GenericUDF }
26
26
import org .apache .hadoop .hive .ql .udf .generic .GenericUDF .DeferredObject
27
27
import org .apache .hadoop .hive .serde2 .objectinspector .primitive .PrimitiveObjectInspectorFactory
28
28
import org .apache .hadoop .hive .serde2 .objectinspector .{ObjectInspector , ObjectInspectorFactory }
@@ -93,6 +93,15 @@ class HiveUdfSuite extends QueryTest {
93
93
sql(" DROP TEMPORARY FUNCTION IF EXISTS testUdf" )
94
94
}
95
95
96
+ test(" SPARK-6409 UDAFAverage test" ) {
97
+ sql(s " CREATE TEMPORARY FUNCTION test_avg AS ' ${classOf [GenericUDAFAverage ].getName}' " )
98
+ checkAnswer(
99
+ sql(" SELECT test_avg(1), test_avg(substr(value,5)) FROM src" ),
100
+ Seq (Row (1.0 , 260.182 )))
101
+ sql(" DROP TEMPORARY FUNCTION IF EXISTS test_avg" )
102
+ TestHive .reset()
103
+ }
104
+
96
105
test(" SPARK-2693 udaf aggregates test" ) {
97
106
checkAnswer(sql(" SELECT percentile(key, 1) FROM src LIMIT 1" ),
98
107
sql(" SELECT max(key) FROM src" ).collect().toSeq)
You can’t perform that action at this time.
0 commit comments