aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorvvvv <vvvv@ydb.tech>2022-10-06 20:01:44 +0300
committervvvv <vvvv@ydb.tech>2022-10-06 20:01:44 +0300
commit8a0c721548ffb3053cb6a3e08c0a9027712e2894 (patch)
tree10c89ae4e33b6eccabecb0d580263dbc6ab881cc /library
parent68fd753127853234cd0812750f9bd10c81ab5fa9 (diff)
downloadydb-8a0c721548ffb3053cb6a3e08c0a9027712e2894.tar.gz
typecheck for explicit phases of GROUP BY
Пример запроса на котором проходит typecheck. Для агрегационных функций с несколькими параметрами в режиме over state, он используется из первого аргумента, при этом параметры - литералы (например limit для max_by) используются в том смысле, что их наличие влияет на тип state. Percentile особая функция, для нее в MergeFinalize можно построить из одного state много срезов по разным значениям percentile. %%(sql) --pragma EmitAggApply; $p = SELECT key,count(value) as a,avg(value) as b,percentile(value,0.1) as c, max_by(value,value) as e, sum_if(value,value>0) as f FROM AS_TABLE([<|key: 1, value: 2|>]) GROUP BY key with combine ; $p = PROCESS $p; select FormatType(TypeOf($p)); $p = SELECT key,count(a) as a,avg(b) as b,percentile(c,0.1) as c,max_by(e,e) as e, sum_if(f,f) as f FROM $p GROUP BY key with combinestate ; $p = PROCESS $p; select FormatType(TypeOf($p)); $p = SELECT key,count(a) as a,avg(b) as b,percentile(c,0.1) as c,max_by(e,e) as e, sum_if(f,f) as f FROM $p GROUP BY key with mergestate ; $p = PROCESS $p; select FormatType(TypeOf($p)); $p = SELECT key,count(a) as a,avg(b) as b,percentile(c,0.1) as c,percentile(c,0.2) as d,max_by(e,e) as e, sum_if(f,f) as f FROM $p GROUP BY key with mergefinalize ; $p = PROCESS $p; select FormatType(TypeOf($p)); $p = SELECT key,count(value) as a,avg(value) as b,percentile(value,0.1) as c,percentile(value,0.2) as d, max_by(value,value) as e, sum_if(value,value>0) as f FROM AS_TABLE([<|key: 1, value: 2|>]) GROUP BY key with finalize ; $p = PROCESS $p; select FormatType(TypeOf($p)); %%
Diffstat (limited to 'library')
0 files changed, 0 insertions, 0 deletions