Hive中有相同的功能吗?
oracle中的atio_to_report
SELECT last_name, salary, RATIO_TO_REPORT(salary) OVER () AS rr
FROM employees
WHERE job_id = 'PU_CLERK';
LAST_NAME SALARY RR
------------------------- ---------- ----------
Khoo 3100 .223021583
Baida 2900 .208633094
Tobias 2800 .201438849
Himuro 2600 .18705036
Colmenares 2500 .179856115
答案 0 :(得分:0)
Hive中没有此类功能。但是,您可以利用可用的分析功能执行相同的操作。
SELECT last_name, salary, salary/SUM(salary) OVER () AS rr
FROM employees
WHERE job_id = 'PU_CLERK'
要获取每个job_id
的比率,请使用
SELECT last_name, salary, salary/SUM(salary) OVER (PARTITION BY job_id) AS rr
FROM employees