계층별 Rollup 집계
| 항목 | 값 |
|---|---|
| 화면 이름 | Rollup |
| 식별자 | rollUpV1 |
| 지원 실행 방식 | Batch, Faster |
| 범주 | 집계 (Aggregate) |
입력 데이터를 여러 세부 수준에서 집계하여 중간 집계와 상위 집계를 함께 제공합니다.
입력 인자
| 이름 | 지정 여부 | 자료형 | 의미와 조건 |
|---|---|---|---|
Aggregations | 필수 | List<Expression<AnyType>> | 데이터셋에 수행할 집계 목록입니다. |
Dataset | 필수 | Table | Rollup을 수행할 데이터셋입니다. |
Rollup columns | 필수 | List<Column<AnyType>> | 집계 시 Rollup할 열 목록입니다. 비어 있으면 Rollup을 적용하지 않습니다. |
입출력 예시
예시 1: 기본 동작
인자 값:
Aggregations: [
alias(
alias: max_price,
expression:
max(
expression:price,
),
)]Dataset: ri.foundry.main.dataset.rollupBaseCaseRollup columns: [city]
입력:
| city | model | price | store |
|---|---|---|---|
| London | new phone | 900.0 | MegaMart |
| London | new phone | 850.75 | AA |
| London | new phone | 870.75 | ABC Zone |
| San Francisco | new phone | 1000.0 | Prescos |
| San Francisco | new phone | 950.25 | XZY Force |
| San Francisco | new phone | 1105.7 | Phone Mart |
| London | forestX 20 | 750.1 | MegaMart |
| London | forestX 20 | 690.0 | AA |
| London | forestX 20 | 730.0 | ABC Zone |
| San Francisco | forestX 20 | 890.4 | Prescos |
| San Francisco | forestX 20 | 900.1 | XZY Force |
| San Francisco | forestX 20 | 1050.75 | Phone Mart |
출력:
| city | max_price |
|---|---|
| London | 900.0 |
| San Francisco | 1105.7 |
| null | 1105.7 |
예시 2: 기본 동작
인자 값:
Aggregations: [
alias(
alias: mean_price,
expression:
mean(
expression:price,
),
)]Dataset: ri.foundry.main.dataset.rollupBaseCaseRollup columns: [city,model]
입력:
| city | model | price | store |
|---|---|---|---|
| London | new phone | 900.0 | MegaMart |
| London | new phone | 850.75 | AA |
| London | new phone | 870.75 | ABC Zone |
| San Francisco | new phone | 1000.0 | Prescos |
| San Francisco | new phone | 950.25 | XZY Force |
| San Francisco | new phone | 1105.7 | Phone Mart |
| London | forestX 20 | 750.1 | MegaMart |
| London | forestX 20 | 690.0 | AA |
| London | forestX 20 | 730.0 | ABC Zone |
| San Francisco | forestX 20 | 890.4 | Prescos |
| San Francisco | forestX 20 | 900.1 | XZY Force |
| San Francisco | forestX 20 | 1050.75 | Phone Mart |
출력:
| city | model | mean_price |
|---|---|---|
| London | new phone | 873.8333333333334 |
| London | forestX 20 | 723.3666666666667 |
| London | null | 798.6 |
| San Francisco | new phone | 1018.65 |
| San Francisco | forestX 20 | 947.0833333333334 |
| San Francisco | null | 982.8666666666667 |
| null | null | 890.7333333333335 |
예시 3: 기본 동작
인자 값:
Aggregations: [
alias(
alias: max_price,
expression:
max(
expression:plan_prices,
),
)]Dataset: ri.foundry.main.dataset.rollupComplexCaseRollup columns: [model]
입력:
| city | model | plan_prices | stores |
|---|---|---|---|
| London | new phone | [ 900.0, 1080.23, 899.99 ] | MegaMart |
| London | new phone | [ 850.75, 800.78, 999.99 ] | AA |
| London | new phone | [ 870.75, 775.0, 804.48 ] | ABC Zone |
| San Francisco | new phone | [ 910.0, 1030.23, 1100.5 ] | Prescos |
| San Francisco | new phone | [ 1020.0, 989.99, 1130.0 ] | XZY Force |
| San Francisco | new phone | [ 1020.0, 1065.25, 1110.99 ] | Phone Mart |
| London | forestX 20 | [ 738.5, 701.25, 834.0 ] | MegaMart |
| London | forestX 20 | [ 703.75, 821.0, 712.5 ] | AA |
| London | forestX 20 | [ 692.0, 787.5, 841.75 ] | ABC Zone |
| San Francisco | forestX 20 | [ 1003.25, 997.75, 893.5 ] | Prescos |
| San Francisco | forestX 20 | [ 981.5, 872.25, 1035.0 ] | XZY Force |
| San Francisco | forestX 20 | [ 928.0, 995.25, 1098.5 ] | Phone Mart |
출력:
| model | max_price |
|---|---|
| new phone | [ 1020.0, 1065.25, 1110.99 ] |
| forestX 20 | [ 1003.25, 997.75, 893.5 ] |
| null | [ 1020.0, 1065.25, 1110.99 ] |
예시 4: null 처리
인자 값:
Aggregations: [
alias(
alias: max_price,
expression:
max(
expression:price,
),
)]Dataset: ri.foundry.main.dataset.rollupNullCaseRollup columns: [city,model]
입력:
| city | model | price | stores |
|---|---|---|---|
| London | new phone | null | MegaMart |
| London | new phone | 850.75 | AA |
| London | new phone | 870.75 | ABC Zone |
| San Francisco | new phone | null | Prescos |
| San Francisco | new phone | null | XZY Force |
| San Francisco | new phone | null | Phone Mart |
| London | forestX 20 | 750.1 | MegaMart |
| London | forestX 20 | 690.0 | AA |
| London | forestX 20 | null | ABC Zone |
| San Francisco | forestX 20 | 890.4 | Prescos |
| San Francisco | forestX 20 | null | XZY Force |
| San Francisco | forestX 20 | 1050.75 | Phone Mart |
출력:
| city | model | max_price |
|---|---|---|
| London | new phone | 870.75 |
| London | forestX 20 | 750.1 |
| London | null | 870.75 |
| San Francisco | new phone | null |
| San Francisco | forestX 20 | 1050.75 |
| San Francisco | null | 1050.75 |
| null | null | 1050.75 |
예시 5: 경계 조건
인자 값:
Aggregations: [
alias(
alias: mean_price,
expression:
mean(
expression:price,
),
)]Dataset: ri.foundry.main.dataset.rollupBaseCaseRollup columns: []
입력:
| city | model | price | store |
|---|---|---|---|
| London | new phone | 900.0 | MegaMart |
| London | new phone | 850.75 | AA |
| London | new phone | 870.75 | ABC Zone |
| San Francisco | new phone | 1000.0 | Prescos |
| San Francisco | new phone | 950.25 | XZY Force |
| San Francisco | new phone | 1105.7 | Phone Mart |
| London | forestX 20 | 750.1 | MegaMart |
| London | forestX 20 | 690.0 | AA |
| London | forestX 20 | 730.0 | ABC Zone |
| San Francisco | forestX 20 | 890.4 | Prescos |
| San Francisco | forestX 20 | 900.1 | XZY Force |
| San Francisco | forestX 20 | 1050.75 | Phone Mart |
출력:
| mean_price |
|---|
| 890.7333333333335 |
예시 6: 경계 조건
인자 값:
Aggregations: [
alias(
alias: max_price,
expression:
max(
expression:price,
),
)]Dataset: ri.foundry.main.dataset.rollupEmptyCaseRollup columns: [city,model]
입력:
| city | model | price | store |
|---|
출력:
| city | model | max_price |
|---|