通过


theta_intersection 函数

适用于:检查标记为“是”的 Databricks SQL 检查标记为“是”是 Databricks Runtime 18.0 及更高版本

计算两个 Theta Sketch 二进制表示形式的集交集。 返回的草图仅包含两个草图中显示的值。

Syntax

theta_intersection ( first, second )

Arguments

  • first:采用二进制格式的 Theta Sketch。
  • second:采用二进制格式的 Theta Sketch。

退货

一个 BINARY 值,该值包含表示交集的序列化 Theta Sketch。

注释

  • 作是通勤的:theta_intersection(A、B) = theta_intersection(B、A)。
  • 结果包含两个输入草图中显示的值。
  • 若要相交两个以上的草图,请改用聚合theta_intersection_agg函数函数

错误消息

例子

-- Find values appearing in both sketches
> SELECT theta_sketch_estimate(theta_intersection(theta_sketch_agg(col1), theta_sketch_agg(col2)))
  FROM VALUES (5, 4), (1, 4), (2, 5), (2, 5), (3, 1) tab(col1, col2);
2