赞
踩
create table table1 as with hive1 as ( select a1, a2, a3, a4, a5, a6, a7, a8, a9 from ( select a1, a2, a3, a4, a5, a6, a7, a8, a9, ROW_NUMBER() OVER(PARTITION BY a1, a2 ORDER BY `timestamp` desc) AS rn from source_table1 where partition_key=key_value and conditions ) as b where b.rn = 1 ), hive2 as( select get_json_object(json_string,'$.json_key') as b1, b2 from source_table2 where partition_key=key_value and condition ), hive3 as( select c1,c2,c3 from source_table3 where partition_key=key_value and condition ) select * from hive1 join hive2 on hive2.a1=hive1.b1 join hive3 on hive3.c1=hive1.a1 ;
get json object
函数create table if not exists table_name(
q string,
dd bigint,
cc float,
)
partitioned by (q string);
/*先with as, 再insert into,后select*/ with hive1 as ( select aa from aa_table, where partition_key=key_value hive2 as( select bb from bb_table where partition_key=key_value ), hive3 as( select cc from cc_table where partition_key=key_value ) insert into table target_table partition(partition_key=key_value) select * from hive1 join hive2 on hive2.photo_id=hive1.dd join hive3 on hive3.photo_id=hive1.dd;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。