简体   繁体   English

如何使用Hive QL生成序列号

[英]How to generate the sequence number with hive ql

How to write the hive sql to get the table B from table A (without any UDF) ? 如何编写配置单元sql从表A中获取表B(没有任何UDF)?

table A 表A

PLATFORM    USER_ID CLICK_TIME  CLICK_URL

WEB 12332321 2013-03-21 13:48:31.324 /home/ WEB 12332321 2013-03-21 13:48:31.324 / home /

WEB 12332321 2013-03-21 13:48:32.954 /selectcat/er/ WEB 12332321 2013-03-21 13:48:32.954 / selectcat / er /

WEB 12332321 2013-03-21 13:48:46.365 /er/viewad/12.html WEB 12332321 2013-03-21 13:48:46.365 /er/viewad/12.html

WEB 12332321 2013-03-21 13:48:53.651 /er/viewad/13.html WEB 12332321 2013-03-21 13:48:53.651 /er/viewad/13.html

WEB 12332321 2013-03-21 13:49:13.435 /er/viewad/24.html WEB 12332321 2013-03-21 13:49:13.435 /er/viewad/24.html

WEB 12332321 2013-03-21 13:49:35.876 /selectcat/che/ WEB 12332321 2013-03-21 13:49:35.876 / selectcat / che /

WEB 12332321 2013-03-21 13:49:56.398 /che/viewad/93.html WEB 12332321 2013-03-21 13:49:56.398 /che/viewad/93.html

WEB 12332321 2013-03-21 13:50:03.143 /che/viewad/10.html WEB 12332321 2013-03-21 13:50:03.143 /che/viewad/10.html

WEB 12332321 2013-03-21 13:50:34.265 /home/ WEB 12332321 2013-03-21 13:50:34.265 / home /

WAP 32483923 2013-03-21 23:58:41.123 /m/home/ WAP 32483923 2013-03-21 23:58:41.123 / m / home /

WAP 32483923 2013-03-21 23:59:16.123 /m/selectcat/fang/ WAP 32483923 2013-03-21 23:59:16.123 / m / selectcat / fang /

WAP 32483923 2013-03-21 23:59:45.123 /m/fang/33.html ...... WAP 32483923 2013-03-21 23:59:45.123 /m/fang/33.html ......

table B 表B

PLATFORM USER_ID SEQ FROM_URL TO_URL 平台USER_ID SEQ FROM_URL TO_URL

WEB 12332321 1 NULL /home/ WEB 12332321 1空/ home /

WEB 12332321 2 /home/ /selectcat/er/ WEB 12332321 2 /首页/ / selectcat / er /

WEB 12332321 3 /selectcat/er/ /er/viewad/12.html WEB 12332321 3 / selectcat / er / /er/viewad/12.html

WEB 12332321 4 /er/viewad/12.html /er/viewad/13.html WEB 12332321 4 /er/viewad/12.html /er/viewad/13.html

WEB 12332321 5 /er/viewad/13.html /er/viewad/24.html WEB 12332321 5 /er/viewad/13.html /er/viewad/24.html

WEB 12332321 6 /er/viewad/24.html /selectcat/che/ WEB 12332321 6 /er/viewad/24.html / selectcat / che /

WEB 12332321 7 /selectcat/che/ /che/viewad/93.html WEB 12332321 7 / selectcat / che / /che/viewad/93.html

WEB 12332321 8 /che/viewad/93.html /che/viewad/10.html WEB 12332321 8 /che/viewad/93.html /che/viewad/10.html

WEB 12332321 9 /che/viewad/10.html /home/ WEB 12332321 9 /che/viewad/10.html / home /

WAP 32483923 1 NULL /m/home/ WAP 32483923 1 NULL / m / home /

WAP 32483923 2 /m/home/ /m/selectcat/fang/ WAP 32483923 2 / m / home / / m / selectcat / fang /

WAP 32483923 3 /m/selectcat/fang/ /m/fang/33.html WAP 32483923 3 / m / selectcat / fang / /m/fang/33.html

WAP 32483923 4 /m/fang/33.html /m/fang/54.html WAP 32483923 4 /m/fang/33.html /m/fang/54.html

Rank() without UDF is impossible for now. 没有UDF的Rank()现在是不可能的。 You can use PIG or use pseudo UDF. 您可以使用PIG或伪UDF。 Here is similar post ( source ). 这是类似的帖子( 来源 )。 GL! GL!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM