Hive 查询错误
Posted
技术标签:
【中文标题】Hive 查询错误【英文标题】:Error with Hive Query 【发布时间】:2017-11-23 07:18:16 【问题描述】:我正在尝试使用以下查询运行 Map Reduce 作业,
SELECT b.userId, a.movieId, a.title, a.genre, b.rating
FROM streaming.movies a JOIN streaming.ratings b
ON a.movieId = b.movieId
WHERE a.genre LIKE '%Adventure%' OR a.genre LIKE '%Children% OR a.genre LIKE '%Action%' OR a.genre LIKE '%Fantasy%' OR a.genre LIKE '%Mystery%' OR a.genre LIKE '%Thriller%' OR a.genre LIKE '%Drama%' OR a.genre LIKE '%Romance%' OR a.genre LIKE '%Sci-Fi%' OR a.genre LIKE '%Comedy%' OR a.genre LIKE '%Horror%'
LIMIT 10;
Hive 抛出错误,
Error: Error while compiling statement: FAILED: ParseException line 5:6 cannot recognize input near 'LIMIT' '10' '<EOF>' in expression specification (state=42000,code=40000)
谁能帮帮我?提前致谢。
注意:我已使用“RLIKE”成功运行我的工作。我正在尝试使用“LIKE”进行锻炼。我的“RLIKE”版本的代码是,
WHERE a.genre RLIKE '.*(Adventure|Children|Action|Fantasy|Mystery|Thriller|Drama|Romance|Sci-Fi|Comedy|Horror).*'
【问题讨论】:
您在'%Children%
之后缺少结束语
【参考方案1】:
尝试运行此查询
SELECT b.userId, a.movieId, a.title, a.genre, b.rating
FROM streaming.movies a JOIN streaming.ratings b
ON a.movieId = b.movieId
WHERE a.genre LIKE '%Adventure%' OR a.genre LIKE '%Children%' OR a.genre LIKE '%Action%' OR a.genre LIKE '%Fantasy%' OR a.genre LIKE '%Mystery%' OR a.genre LIKE '%Thriller%' OR a.genre LIKE '%Drama%' OR a.genre LIKE '%Romance%' OR a.genre LIKE '%Sci-Fi%' OR a.genre LIKE '%Comedy%' OR a.genre LIKE '%Horror%'
LIMIT 10;
你在LIKE '%Children%
中缺少'
【讨论】:
谢谢@Geetika以上是关于Hive 查询错误的主要内容,如果未能解决你的问题,请参考以下文章
Hive 查询错误 java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException