hive - 为什么 Hive 不喜欢这个查询?
问题描述
Ratingshive
表是动态分区的Genre
,表包含movie_titles
和rating of movies
select 100 * stars / total
from (select count(rating) as stars
from ratingshive
where rating = 5) t1,
(select count(1) as total
from ratingshive) t2
当我在 Hive 中运行上述查询时,我收到此错误 -
FAILED: ParseException line 1:100 missing EOF at ',' near 't1'
解决方案
Hive 不喜欢您的查询很可能是因为旧版本。但是您不需要查询同一个ratingshive
表两次然后交叉连接标量结果。使用聚合case
:
select 100 * count(case when rating=5 then 1 end)/count(*) as rating_percent
from ratingshive;
推荐阅读
- java - Java如何强制泛型类型
- java - Android Studio org.json.JSONException:值
我正在尝试使用 volley 将一些数据发布到服务器。
问题似乎与编码的字符串图像有关。
在这条线上
String name = namefie
- javascript - 打印多页的HTML表格时,如何仅针对当前页面上的表格调整列宽?
- python - 如何分隔由';'连接的csv数据中的列 表达?
- javascript - 查找具有给定笛卡尔坐标的矩形区域的函数
- tfs - Android项目的Gitlab到TFS迁移
- flutter - 由于 cloud_firestore androidX 兼容性而导致运行错误
- flask - 根据用户类型将字段设置为只读,使用 form_widget_args、Flask、SQLAlchemy
- bash - 如何安排命令在多个非子进程完成后运行?
- database - 如何在postgresql中比较来自不同数据库的表数据?