Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
Databricks Runtime 18.1 and above
Unions multiple TupleSketch binary representations with double summaries into a single merged sketch. Use this function to combine pre-aggregated sketches from different partitions or data sources.
Syntax
tuple_union_agg_double ( sketch [, lgNomEntries [, mode ]] )
Arguments
- sketch: A TupleSketch in binary format with double summaries (such as from tuple_sketch_agg_double).
- lgNomEntries: An optional
INTEGERliteral specifying the log-base-2 of nominal entries for the union. Must be between 4 and 26, inclusive. The default is 12. - mode: An optional
STRINGliteral specifying the aggregation mode for combining duplicate key summaries. Valid values:'sum','min','max','alwaysone'. The default is'sum'.
Returns
A BINARY value containing the merged TupleSketch with double summaries.
Notes
NULLinput sketches are ignored during aggregation.- The union operation combines sketches even when they have different lgNomEntries values.
- For merging exactly two sketches, use the scalar tuple_union_double function.
Error messages
Examples
-- Union sketches from different partitions
> SELECT tuple_sketch_estimate_double(tuple_union_agg_double(sketch)) FROM (
SELECT tuple_sketch_agg_double(key, summary) as sketch FROM VALUES (1, 5.0D), (2, 10.0D) tab(key, summary)
UNION ALL
SELECT tuple_sketch_agg_double(key, summary) as sketch FROM VALUES (2, 3.0D), (3, 7.0D) tab(key, summary)
);
3.0