gpt4 book ai didi

hadoop - 在配置单元窗口范围内使用表列

转载 作者:可可西里 更新时间:2023-11-01 16:38:05 25 4
gpt4 key购买 nike

我正在尝试在一个窗口上收集列表,我想根据同一表中的一列值动态限制窗口大小。

select concat_ws('->', collect_list(CASE WHEN b.colA IN ("bla", "blabla") THEN concat_ws("-", colB,colC) END) OVER (PARTITION BY colD ORDER BY time-stamp ROWS BETWEEN colE PRECEDING AND CURRENT ROW)) AS myCol from ( select colA,colB,colC,colD,colE from mytable) a

colA|colB|colC|colD|colE|time-stamp
bla|abc|pqr|INDIA|1|2017-12-10
bla|abc|pqr|CHINA|1|2017-12-11
bla|abc|pqr|INDIA|2|2017-12-12
bla|abc|pqr|INDIA|3|2017-12-13
bla|abc|pqr|CHINA|2|2017-12-14

此处配置单元不接受具有有效数字值的范围内的 colE。我得到错误:

Error while compiling statement: FAILED: ParseException line 177:89 cannot recognize input near 'colE' 'preceding' 'AND' in windowframeboundary

最佳答案

来自文档 here . Hive 不期望 between word 之后的任何列。以下是可用的选项

(ROWS | RANGE) BETWEEN (UNBOUNDED | [num]) PRECEDING AND ([num] PRECEDING | CURRENT ROW | (UNBOUNDED | [num]) FOLLOWING)
(ROWS | RANGE) BETWEEN CURRENT ROW AND (CURRENT ROW | (UNBOUNDED | [num]) FOLLOWING)
(ROWS | RANGE) BETWEEN [num] FOLLOWING AND (UNBOUNDED | [num]) FOLLOWING

关于hadoop - 在配置单元窗口范围内使用表列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47713792/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com