diff --git a/e2e_test/streaming/aggregate/two_phase_approx_percentile_merge_normal_agg.slt b/e2e_test/streaming/aggregate/two_phase_approx_percentile_merge_normal_agg.slt new file mode 100644 index 0000000000000..299fa02e5bdfd --- /dev/null +++ b/e2e_test/streaming/aggregate/two_phase_approx_percentile_merge_normal_agg.slt @@ -0,0 +1,93 @@ +# Single phase approx percentile +statement ok +create table t(p_col double, grp_col int); + +statement ok +insert into t select a, 1 from generate_series(-1000, 1000) t(a); + +statement ok +flush; + +query I +select + percentile_cont(0.01) within group (order by p_col) as p01, + sum(p_col), + percentile_cont(0.5) within group (order by p_col) as p50, + count(*), + percentile_cont(0.99) within group (order by p_col) as p99 +from t; +---- +-980 0 0 2001 980 + +statement ok +create materialized view m1 as + select + approx_percentile(0.01, 0.01) within group (order by p_col) as p01, + sum(p_col), + approx_percentile(0.5, 0.01) within group (order by p_col) as p50, + count(*), + approx_percentile(0.99, 0.01) within group (order by p_col) as p99 + from t; + +query I +select * from m1; +---- +-982.5779489474152 0 0 2001 982.5779489474152 + +# Test state encode / decode +onlyif can-use-recover +statement ok +recover; + +onlyif can-use-recover +sleep 10s + +query I +select * from m1; +---- +-982.5779489474152 0 0 2001 982.5779489474152 + +# Test state encode / decode +onlyif can-use-recover +statement ok +recover; + +onlyif can-use-recover +sleep 10s + +query I +select * from m1; +---- +-982.5779489474152 0 0 2001 982.5779489474152 + +# Test 0