gpt4 book ai didi

sql - 如何使用Hive QL生成序列号

转载 作者:行者123 更新时间:2023-12-02 21:55:00 25 4
gpt4 key购买 nike

如何编写配置单元sql以从表A(没有任何UDF)获取表B?

表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:32.954 / selectcat / er /

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: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: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:34.265 / 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:45.123 /m/fang/33.html
......

表B

平台USER_ID SEQ FROM_URL TO_URL

WEB 12332321 1空/ home /

WEB 12332321 2 /家庭/ / selectcat / er /

WEB 12332321 3 / selectcat / er / /er/viewad/12.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 6 /er/viewad/24.html / selectcat / che /

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

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

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

WAP 32483923 1 NULL / m / home /

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

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

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

最佳答案

目前没有UDF的Rank()是不可能的。您可以使用PIG或伪UDF。这是类似的帖子(source)。 GL!

关于sql - 如何使用Hive QL生成序列号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15721577/

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