Skip to content

Commit

Permalink
test(frontend): test two phase approx percentile with group key is ba…
Browse files Browse the repository at this point in the history
…nned (#18085)
  • Loading branch information
kwannoel authored Aug 19, 2024
1 parent 1699b3e commit a10e61f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/frontend/planner_test/tests/testdata/input/agg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,13 @@
expected_outputs:
- logical_plan
- stream_plan
- name: test approx_percentile hash_agg forced should use single phase agg
sql: |
SET RW_FORCE_TWO_PHASE_AGG=true;
create table t (v1 int, grp_col int);
select approx_percentile(0.5, 0.01) WITHIN GROUP (order by v1) from t group by grp_col;
expected_outputs:
- stream_error
- name: test approx percentile with default relative_error
sql: |
CREATE TABLE t (v1 int);
Expand Down
8 changes: 8 additions & 0 deletions src/frontend/planner_test/tests/testdata/output/agg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2103,6 +2103,14 @@
└─StreamHashAgg { group_key: [$expr5], aggs: [sum(t.v1), count, max(t.v2)] }
└─StreamProject { exprs: [t.v1, t.v1::Float64 as $expr3, t.v2, t.v2::Float64 as $expr4, t._row_id, Vnode(t._row_id) as $expr5] }
└─StreamTableScan { table: t, columns: [t.v1, t.v2, t._row_id], stream_scan_type: ArrangementBackfill, stream_key: [t._row_id], pk: [_row_id], dist: UpstreamHashShard(t._row_id) }
- name: test approx_percentile hash_agg forced should use single phase agg
sql: |
SET RW_FORCE_TWO_PHASE_AGG=true;
create table t (v1 int, grp_col int);
select approx_percentile(0.5, 0.01) WITHIN GROUP (order by v1) from t group by grp_col;
stream_error: |-
Feature is not yet implemented: two-phase streaming approx percentile aggregation with group key, please use single phase aggregation instead
No tracking issue yet. Feel free to submit a feature request at https://github.com/risingwavelabs/risingwave/issues/new?labels=type%2Ffeature&template=feature_request.yml
- name: test approx percentile with default relative_error
sql: |
CREATE TABLE t (v1 int);
Expand Down
5 changes: 4 additions & 1 deletion src/frontend/src/optimizer/plan_node/logical_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@ impl LogicalAgg {
col_mapping: approx_percentile_col_mapping,
} = approx;
if !self.group_key().is_empty() && !approx_percentile_agg_calls.is_empty() {
bail_not_implemented!("two-phase approx percentile agg with group key, please use single phase agg for approx_percentile with group key");
bail_not_implemented!(
"two-phase streaming approx percentile aggregation with group key, \
please use single phase aggregation instead"
);
}

// Either we have approx percentile aggs and non_approx percentile aggs,
Expand Down

0 comments on commit a10e61f

Please sign in to comment.