Member since
01-19-2016
1
Post
0
Kudos Received
0
Solutions
01-19-2016
08:55 AM
In Hive how to do collect_list(path) in ascending order based on servicetime column grouping by service_date,timeslot,customer_id,category,product,sub_product. Path order is correct when the select query is executed. Correct Answer Hive Query ->
select sum(calls),concat_ws(':',collect_list(path)) FROM test group by service_date,timeslot,customer_id,category,product,sub_product;
Output : 38,|MN_0038|MN_0008|MN_0003|MN_0002|MN_0001|Dummy:|MN_0003|MN_0002:|MN_0001|Dummy:|MN_0001|Dummy But when I execute on 1 gb of data for bulk aggregation from one table to another table the order of path is not correct. Wrong Answer Hive Query ->
with isort as select calls,path from raw_test order by servicetime asc)
from isort
insert into table test
select sum(calls),concat_ws(':',collect_list(path)) FROM test group by service_date,timeslot,customer_id,category,product,sub_product;
Output : 38,|MN_0003|MN_0002:|MN_0001|Dummy:|MN_0038|MN_0008|MN_0003|MN_0002|MN_0001|Dummy:|MN_0001|Dummy Like Mysql am trying to write hive query with order by clause am facing an error Error Hive Query like MySQL ->
with isort as ( select calls,path from raw_test order by servicetime asc)
from isort
insert into table test
select sum(calls),concat_ws(':',collect_list(path)) FROM test group by service_date,timeslot,customer_id,category,product,sub_product order by servicetime;
... View more
Labels:
- Labels:
-
Apache Hive