1、Hive: 2、Presto: 列转行 Hive 1、split将order_ids拆分成数组,lateral view explode将数组炸裂开 Presto 1、split将order_ids拆分成数组,cross join unnest将数组炸裂开 2、炸裂 + map 行转列 1、Hive: collect_set转为数组并去重,concat_ws将数组用逗号间隔连接成字符串 select fuid, concat_ws(',', ...
hive> select col1,col2,concat_ws(',',collect_set(col3)) as col3 from row2col_2 group by col1,col2; FAILED: SemanticException [Error 10016]: Line 1:31 Argument type mismatch 'col3': Argument 2 of function CONCAT_WS must be "string or array<string>", but "array<int>" was foun...
hive concat拼接函数 ref . hive中的拼接函数(concat,group_concat,concat_ws,collect_set)_hive拼接函数-CSDN博客 concat('abc', '_', 'def') -- abc_def` concat_ws('_', str1, str2) -- 返回str1_str2 -- presto 不支持 concat_ws GROUP_CONCAT 函数 GROUP_CONCAT([DISTINCT] expr [,expr ....
hive: dim_ext['mode_type'] = '7' presto: element_at(dim_ext,'mode_type') ='7' 字段value字符串拼接: Hive: select concat_ws(',',collect_set(skuid)) sku_list from tmp -- 去重 select expid, concat_ws(',',collect_list(skuid)) sku_list from tmp-- 不去重 Presto: select arra...
collect_list->array_agg concat_ws->array_join collect_set->array_agg 后 array_distinct去重 代码语言:javascript 代码运行次数:0 运行 行专列 Hive:split拆分成数组,lateral view explode将数组分开 代码语言:javascript 代码运行次数:0 运行 AI代码解释 ...
--prestoselectarray_join(array_distinct(array_agg(name)),',')--hiveselectconcat_ws(',',collect_set(cast(nameasstring))) 时间差计算 Presto:selectdate_diff('day',cast('2020-07-23 15:01:13'astimestamp),cast('2020-07-24 11:42:58'astimestamp)) ...
selectconcat_ws(',',collect_set(cast(nameasstring))) 时间差计算 代码语言:javascript 代码运行次数:0 运行 AI代码解释 Presto:selectdate_diff('day',cast('2020-07-23 15:01:13'astimestamp),cast('2020-07-24 11:42:58'astimestamp))Hive:selectdatediff('2020-07-24 11:42:58','2020-07-23...
select columnA, group_concat(columnB separator ',') from table group by columnA 1 2 3 4 5 Hive select columnA, concat_ws('_', collect_set(columnB)) from table group by columnA 1 2 3 4 5 Presto select columnA, array_join(array_agg(columnB), ',') from table group by columnA...
array_agg转为数组,array_distinct去重,array_join将数组用逗号间隔连接成字符串。collect_set转为数组并去重,concat_ws将数组用逗号间隔连接成字符串。###炸裂 + map。 hive hadoop 数据仓库 数组 Hive 原创 _温柔一刀 2024-03-01 11:05:35 500阅读 ...
--presto select array_join(array_distinct(array_agg(name)),',') --hive select concat_ws(',',collect_set(cast(name as string))) 5 其他注意事项 hive中别名的符号为``,presto中别名的符号为""。 hive中如果有子查询时必须对子查询取别名,但是在presto中可不必。 hive中字符串类型用string表示,在...