uniqTheta 함수

uniqTheta 함수 (uniqTheta functions)

uniqTheta 함수는 두 개의 uniqThetaSketch 객체로 집합 연산(∪ / ∩ / × 즉 합집합 / 교집합 / 차집합)을 수행해, 결과를 담은 새 uniqThetaSketch 객체를 반환해요.

uniqThetaSketch 객체는 집계 함수 uniqTheta-State와 함께 사용해 만들 수 있어요. uniqThetaSketch는 근사 값 집합을 저장하는 데이터 구조입니다.

자세한 내용은 Theta Sketch Framework를 참고해요.

출처: 문서

본문

uniqTheta 함수는 두 개의 uniqThetaSketch 객체로 ∪ / ∩ / × (합집합 / 교집합 / 차집합) 같은 집합 연산 계산을 수행해, 그 결과를 담은 새 uniqThetaSketch 객체를 반환합니다. uniqThetaSketch 객체는 집계 함수 uniqTheta-State와 함께 사용해 만듭니다.

uniqThetaSketch는 근사 값 집합의 저장 데이터 구조입니다.

자세한 내용은 Theta Sketch Framework를 참고하세요.

uniqThetaUnion

두 개의 uniqThetaSketch 객체로 합집합 계산(집합 연산 ∪)을 수행하며, 결과는 새 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 객체로 교집합 계산(집합 연산 ∩)을 수행하며, 결과는 새 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 │
└─────────┴───────────────┴───────────────┘

더 알아보기 (Learn more)