Impala Doesn't Have a histogram() function

Impala Doesn’t Have a histogram() function.

Ibis’s histogram works by normalizing a column and rounding to integers:

1
2
3
4
5
6
7
8
9
WITH t0 AS
  ( SELECT *
   FROM db.`table_name`)
SELECT floor((t0.`column_name` - (t1.`min_1fe5be` - 1e-13)) / ((t1.`max_1fe5be` - (t1.`min_1fe5be` - 1e-13)) / (NUM_BINS - 1))) AS `tmp`
FROM t0
CROSS JOIN
  ( SELECT min(`column_name`) AS `min_1fe5be`,
           max(`column_name`) AS `max_1fe5be`
   FROM t0 ) t1
Last updated on Feb 12, 2024 09:29 -0500
Feedback
FOOTER