You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: presto-native-execution/src/test/java/com/facebook/presto/nativeworker/AbstractTestNativeAggregations.java
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -354,6 +354,27 @@ public void testMultiMapAgg()
354
354
assertQuery("SELECT orderkey, multimap_agg(linenumber % 3, discount) FROM lineitem GROUP BY 1");
355
355
}
356
356
357
+
@Test
358
+
publicvoidtestNumericHistogram()
359
+
{
360
+
assertQuery("SELECT numeric_histogram(2, v) FROM (VALUES (1.0), (2.0), (1000.0)) AS t(v)");
361
+
assertQuery("SELECT numeric_histogram(2, v) FROM (VALUES (1.0), (2.0), (1000.0), (1001.0)) AS t(v)");
362
+
assertQuery("SELECT numeric_histogram(5, v) FROM (VALUES (1.0), (2.0), (3.0)) AS t(v)");
363
+
364
+
assertQuery("SELECT numeric_histogram(2, v, w) FROM (VALUES (0.0, 1.0), (10.0, 3.0), (10000.0, 1.0)) AS t(v, w)");
365
+
assertQuery("SELECT numeric_histogram(3, v, w) FROM (VALUES (1.0, 2.0), (2.0, 3.0), (3.0, 1.5)) AS t(v, w)");
366
+
367
+
assertQuery("SELECT numeric_histogram(3, v) FROM (VALUES (1.0), (null), (2.0), (null), (1000.0)) AS t(v)");
368
+
369
+
// numeric_histogram is approximate; results may differ between Java and C++ on large datasets,
370
+
// consistent with other approximate aggregates (approx_percentile, approx_distinct, etc.).
371
+
assertQuerySucceeds("SELECT numeric_histogram(5, quantity) FROM lineitem");
372
+
assertQuerySucceeds("SELECT numeric_histogram(10, extendedprice, quantity) FROM lineitem");
373
+
374
+
assertQuery("SELECT cardinality(numeric_histogram(3, quantity)) <= 3 FROM lineitem", "SELECT true");
375
+
assertQuery("SELECT reduce(map_values(numeric_histogram(3, v)), 0.0, (s, x) -> s + x, s -> s) FROM (VALUES (1.0), (2.0), (1000.0), (1001.0), (2000.0)) AS t(v)");
0 commit comments