- 카테고리:
집계 함수 (Percentile Estimation) , 윈도우 함수 구문 및 사용법
APPROX_PERCENTILE_ACCUMULATE¶
집계 종료 시 t-Digest 상태의 내부 표현을 (JSON 오브젝트로) 반환합니다. (t-Digest에 대한 자세한 내용은 다음 참조: 백분위수 값 추정하기.)
The function APPROX_PERCENTILE discards this internal, intermediate state when the final percentile estimate is returned. However, in certain advanced use cases, such as estimating incremental percentile during bulk loading, you may wish to keep the intermediate state, in which case you would use APPROX_PERCENTILE_ACCUMULATE instead of APPROX_PERCENTILE.
APPROX_PERCENTILE_ACCUMULATE does not return a percentile value. Instead, it returns the algorithm state itself. The intermediate state can later be:
별개이지만 관련된 데이터 배치의 다른 중간 상태와 결합(즉, 병합)됩니다.
중간 상태에서 직접 작동하는 다른 함수(예: APPROX_PERCENTILE_ESTIMATE)에 의해 처리됩니다. (예를 들어, 아래의 예 섹션을 참조하십시오.)
외부 도구로 내보냅니다.
구문¶
인자¶
expr숫자 값으로 평가되는 유효한 식(예: 열 이름)입니다.
사용법 노트¶
백분위수는 숫자 값에서만 작동하므로
expr은 숫자이거나 숫자로 캐스팅할 수 있는 값을 생성해야 합니다.
10진수 부동 소수점(DECFLOAT) 값은 지원되지 않습니다.
예¶
Store the t-Digest state of the testtable.c1 column in a table and then use the state to compute percentiles:
Here is a more extensive example that shows the usage of all three related functions: APPROX_PERCENTILE_ACCUMULATE, APPROX_PERCENTILE_ESTIMATE, and APPROX_PERCENTILE_COMBINE.
간단한 테이블과 데이터를 만듭니다.
Create a table that contains the “state” that represents the current
approximate percentile information for the table named test_table1:
해당 상태 정보를 사용하여 중앙값의 현재 추정치를 표시합니다(0.5는 50번째 백분위수의 값이 필요함을 의미함).
이제 두 번째 테이블을 만들고 데이터를 추가합니다. (보다 현실적인 상황에서 사용자는 첫 번째 테이블에 더 많은 데이터를 로딩하고, 데이터가 로딩된 시간을 기준으로 데이터를 겹치지 않는 세트로 나눌 수 있었습니다.)
새 데이터에 대한 “상태” 정보만 가져옵니다.
행의 두 배치에 대한 “상태” 정보를 결합합니다.
결합된 행 세트의 대략적인 중앙값을 가져옵니다.