Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks Runtime 18.2 and above
Merges a TupleSketch with integer summaries and a Theta Sketch using set union.
Syntax
tuple_union_theta_integer ( first, second [, lgNomEntries [, mode ]] )
Arguments
- first: A TupleSketch in binary format with integer summaries.
- second: A Theta Sketch in binary format, such as from
theta_sketch_aggaggregate function. - lgNomEntries: An optional
INTEGERliteral specifying the log-base-2 of nominal entries. Must be between 4 and 26, inclusive. The default is 12. - mode: An optional
STRINGliteral specifying the aggregation mode. Valid values:'sum','min','max','alwaysone'. The default is'sum'.
Returns
A BINARY value containing the merged TupleSketch with integer summaries.
If first or second is NULL, the result is NULL.
Notes
- Argument order is fixed:
firstmust be a TupleSketch andsecondmust be a Theta Sketch. Passing the sketch types in the reverse order raises TUPLE_INVALID_INPUT_SKETCH_BUFFER_FAMILY. - Theta Sketch keys are assigned a default integer summary based on
mode:0for'sum', the maximumINTEGERvalue for'min', the minimumINTEGERvalue for'max', or1for'alwaysone'. - When a key appears in both sketches, summary values are combined according to
mode.
Common error conditions
- TUPLE_INVALID_INPUT_SKETCH_BUFFER
- TUPLE_INVALID_INPUT_SKETCH_BUFFER_FAMILY
- THETA_INVALID_INPUT_SKETCH_BUFFER
- THETA_INVALID_INPUT_SKETCH_BUFFER_FAMILY
- SKETCH_INVALID_LG_NOM_ENTRIES
- DATATYPE_MISMATCH.TYPE_CHECK_FAILURE_WITH_HINT
- TUPLE_INVALID_SKETCH_MODE
Examples
> SELECT tuple_sketch_estimate_integer(
tuple_union_theta_integer(
tuple_sketch_agg_integer(col1, val1),
theta_sketch_agg(col2)
)
) FROM VALUES (1, 1, 4), (2, 2, 5), (3, 3, 6) tab(col1, val1, col2);
6.0