1. 问题描述
在Hive1.2.2版本运行如下HQL时:
select dt as date, comMap['searchType'] as search_type, comMap['clickType'] as click_typefrom search_clickwhere dt = '20170614';
会抛出如下异常:
Failed to recognize predicate 'date'. Failed rule: 'identifier' in column specification
2. 问题分析
在Hive1.2.0版本开始增加了如下配置选项,默认值为true
:
hive.support.sql11.reserved.keywords
该选项的目的是:是否启用对SQL2011保留关键字的支持。 启用后,将支持部分SQL2011保留关键字。
3. 解决方案
从上面可以知道是因为启用了对保留关键字的支持导致的,上面语句中date
是保留关键字.所以解决方案如下:
- 弃用保留关键字
date
select dt, comMap['searchType'] as search_type, comMap['clickType'] as click_typefrom search_clickwhere dt = '20170614';
- 弃用对保留关键字的支持
sudo -uwirelessdev hive -e " set hive.support.sql11.reserved.keywords = false ; select dt, comMap['searchType'] as search_type, comMap['clickType'] as click_type from search_click where dt = '20170614';" > a.txt
或者在conf
下的hive-site.xml
配置文件中修改配置选项:
<property> <name>hive.support.sql11.reserved.keywords</name> <value>false</value></property>
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn/jiangjunshow
更多推荐
Failed to recognize predicate 'xxx' Failed rule 'identifie
发布评论