@@ -150,21 +150,38 @@ class HiveUDFSuite extends QueryTest with TestHiveSingleton with SQLTestUtils {
150150 }
151151
152152 test(" Generic UDAF aggregates" ) {
153- checkAnswer(sql(" SELECT percentile_approx(2, 0.99999), " +
154- " sum(distinct 1), count(distinct 1,2,3,4) FROM src LIMIT 1" ),
155- sql(" SELECT 2, 1, 1 FROM src LIMIT 1" )
156- .collect().toSeq)
157153
158- checkAnswer(sql(" SELECT ceiling(percentile_approx(distinct key, 0.99999))" +
159- " , count(distinct key), sum(distinct key), " +
160- " count(distinct 1), sum(distinct 1), sum(1) FROM src LIMIT 1" ),
161- sql(" SELECT max(key), count(distinct key), sum(distinct key)," +
162- " 1, 1, sum(1) FROM src LIMIT 1" )
163- .collect().toSeq)
154+ checkAnswer(sql(
155+ """
156+ |SELECT percentile_approx(2, 0.99999),
157+ | sum(distinct 1),
158+ | count(distinct 1,2,3,4) FROM src LIMIT 1
159+ """ .stripMargin), sql(" SELECT 2, 1, 1 FROM src LIMIT 1" ).collect().toSeq)
160+
161+ checkAnswer(sql(
162+ """
163+ |SELECT ceiling(percentile_approx(distinct key, 0.99999)),
164+ | count(distinct key),
165+ | sum(distinct key),
166+ | count(distinct 1),
167+ | sum(distinct 1),
168+ | sum(1) FROM src LIMIT 1
169+ """ .stripMargin),
170+ sql(
171+ """
172+ |SELECT max(key),
173+ | count(distinct key),
174+ | sum(distinct key),
175+ | 1, 1, sum(1) FROM src LIMIT 1
176+ """ .stripMargin).collect().toSeq)
164177
165- checkAnswer(sql(" SELECT ceiling(percentile_approx(distinct key, 0.9 + 0.09999))" +
166- " , count(distinct key), sum(distinct key), " +
167- " count(distinct 1), sum(distinct 1), sum(1) FROM src LIMIT 1" ),
178+ checkAnswer(sql(
179+ """
180+ |SELECT ceiling(percentile_approx(distinct key, 0.9 + 0.09999)),
181+ | count(distinct key), sum(distinct key),
182+ | count(distinct 1), sum(distinct 1),
183+ | sum(1) FROM src LIMIT 1
184+ """ .stripMargin),
168185 sql(" SELECT max(key), count(distinct key), sum(distinct key), 1, 1, sum(1) FROM src LIMIT 1" )
169186 .collect().toSeq)
170187
0 commit comments