hive row_number用了也不少,感觉用法应该没问题
参考mysql文档:https://dev.mysql.com/doc/refman/8.0/en/window-function-descriptions.html#function_row-number
MySQL [data_pre]> select gid
-> ,feed_id
-> ,row_number() over() rank
-> from (
-> select min(cast(
-> SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(scm,".",-1),"|",3),"|",-1) as float)) pre_score
-> ,gid
-> ,feed_id
-> from data_pre.processed_hot_impression_sdk
-> where create_time >= '2020-07-14 14:20:00'
-> and create_time < '2020-07-14 14:30:00'
-> and scm like "%.%.%.%|%|%"
-> group by gid,feed_id
-> ) a
-> limit 10;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 3 column 30 near "rank
MySQL [data_pre]> select gid
-> ,feed_id
-> ,row_number() over(order by pre_score) rank
-> from (
-> select min(cast(
-> SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(scm,".",-1),"|",3),"|",-1) as float)) pre_score
-> ,gid
-> ,feed_id
-> from data_pre.processed_hot_impression_sdk
-> where create_time >= '2020-07-14 14:20:00'
-> and create_time < '2020-07-14 14:30:00'
-> and scm like "%.%.%.%|%|%"
-> group by gid,feed_id
-> ) a
-> limit 10;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 3 column 48 near "rank