uniqTheta 함수는 두 개의 uniqThetaSketch 객체에 대해 ∪ / ∩ / × (union/intersect/not)와 같은 집합 연산을 수행하여, 결과가 포함된 새로운 uniqThetaSketch 객체를 반환합니다.
uniqThetaSketch 객체는 집계 함수 uniqTheta에 -State를 붙여 생성할 수 있습니다.
UniqThetaSketch는 근사값 집합을 저장하는 데이터 구조입니다. 자세한 내용은 Theta Sketch Framework를 참조하십시오.
uniqThetaUnion
두 개의 uniqThetaSketch 객체에 대해 union 계산(집합 연산 ∪)을 수행하며, 결과로 새로운 uniqThetaSketch를 반환합니다.
uniqThetaUnion(uniqThetaSketch,uniqThetaSketch)인수
uniqThetaSketch–uniqThetaSketch객체입니다.
예시
SELECT finalizeAggregation(uniqThetaUnion(a, b)) AS a_union_b, finalizeAggregation(a) AS a_cardinality, finalizeAggregation(b) AS b_cardinality
FROM
(SELECT arrayReduce('uniqThetaState',[1,2]) AS a, arrayReduce('uniqThetaState',[2,3,4]) AS b );┌─a_union_b─┬─a_cardinality─┬─b_cardinality─┐
│ 4 │ 2 │ 3 │
└───────────┴───────────────┴───────────────┘uniqThetaIntersect
두 개의 uniqThetaSketch 객체에 대해 intersect 계산(집합 연산 ∩)을 수행하고, 그 결과로 새로운 uniqThetaSketch를 반환합니다.
uniqThetaIntersect(uniqThetaSketch,uniqThetaSketch)인수
uniqThetaSketch– uniqThetaSketch 객체.
예시
SELECT finalizeAggregation(uniqThetaIntersect(a, b)) AS a_intersect_b, finalizeAggregation(a) AS a_cardinality, finalizeAggregation(b) AS b_cardinality
FROM
(SELECT arrayReduce('uniqThetaState',[1,2]) AS a, arrayReduce('uniqThetaState',[2,3,4]) AS b );┌─a_intersect_b─┬─a_cardinality─┬─b_cardinality─┐
│ 1 │ 2 │ 3 │
└───────────────┴───────────────┴───────────────┘uniqThetaNot
두 개의 uniqThetaSketch 객체에 대해 a_not_b 계산(집합 연산 ×)을 수행하며, 그 결과로 새로운 uniqThetaSketch를 반환합니다.
uniqThetaNot(uniqThetaSketch,uniqThetaSketch)인수
uniqThetaSketch– uniqThetaSketch 객체.
예시
SELECT finalizeAggregation(uniqThetaNot(a, b)) AS a_not_b, finalizeAggregation(a) AS a_cardinality, finalizeAggregation(b) AS b_cardinality
FROM
(SELECT arrayReduce('uniqThetaState',[2,3,4]) AS a, arrayReduce('uniqThetaState',[1,2]) AS b );┌─a_not_b─┬─a_cardinality─┬─b_cardinality─┐
│ 2 │ 3 │ 2 │
└─────────┴───────────────┴───────────────┘관련 항목