SET mapreduce.job.queuename=xxx;
WITH a AS (
SELECT 'a' col_1, 1 col_2
union all
SELECT 'b' col_1, 2 col_2
union all
SELECT 'c' col_1, 3 col_2
),
b AS (
SELECT 'd' col_1, 1 col_2
union all
SELECT 'e' col_1, 2 col_2
union all
SELECT 'c' col_1, 3 col_2
),
c AS (SELECT * from a UNION SELECT * FROM b)
-- 直接添加序号
-- SELECT row_number() OVER() rnk,* FROM c;
-- 按照col_1排序添加序号
SELECT row_number() OVER(ORDER BY col_1) rnk,* FROM c;
结果如下: