Muistiinpano
Tämän sivun käyttö edellyttää valtuutusta. Voit yrittää kirjautua sisään tai vaihtaa hakemistoa.
Tämän sivun käyttö edellyttää valtuutusta. Voit yrittää vaihtaa hakemistoa.
Applies to:
Databricks Runtime 18.1 and above
Aggregates the summary values from a TupleSketch with integer summaries according to the specified mode.
Syntax
tuple_sketch_summary_integer ( sketch [, mode ] )
Arguments
- sketch: A TupleSketch in binary format with integer summaries.
- mode: An optional
STRINGliteral specifying the aggregation mode. Valid values:'sum','min','max','alwaysone'. The default is'sum'.
Returns
A LONG value representing the aggregated summary across all keys in the sketch.
Notes
- In
'sum'mode, the function returns the sum of all summary values. - In
'min'mode, the function returns the minimum summary value. - In
'max'mode, the function returns the maximum summary value. - In
'alwaysone'mode, the function returns the count of entries (equivalent to distinct count).
Error messages
Examples
-- Sum of all summary values
> SELECT tuple_sketch_summary_integer(tuple_sketch_agg_integer(key, summary)) FROM VALUES (1, 1), (1, 2), (2, 3) tab(key, summary);
6
-- Get maximum summary value
> SELECT tuple_sketch_summary_integer(tuple_sketch_agg_integer(key, summary), 'max') FROM VALUES (1, 1), (1, 2), (2, 3) tab(key, summary);
5