aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/udfs/common/histogram/test/cases/Weights.sql
blob: 77229008f6e1b10fdfc89773fa536fc91f0a0e80 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
/* syntax version 1 */
SELECT
    HISTOGRAM(key, value / subkey) AS basic_weight,
    HISTOGRAM(key, value, 3) AS weight_and_bins,
    Histogram::Print(HISTOGRAM(key)) <> Histogram::Print(HISTOGRAM(key, value)) AS equality_check
FROM (
    SELECT
        CAST(key AS Double) AS key,
        COALESCE(CAST(subkey AS Double), 1.0) AS subkey,
        COALESCE(CAST(value AS Double), 1.0) AS value
    FROM Input
);