本文主要是介绍Failed to recognize predicate 'xxx'. Failed rule: 'identifier' in column specification,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1. 问题描述
在Hive1.2.2版本运行如下HQL时:
select dt as date, comMap['searchType'] as search_type, comMap['clickType'] as click_type
from search_click
where 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_type
from search_click
where dt = '20170614';
- 弃用对保留关键字的支持
sudo -uwirelessdev hive -e "
set hive.support.sql11.reserved.keywords = false ;select dt, comMap['searchType'] as search_type, comMap['clickType'] as click_typefrom search_clickwhere dt = '20170614';
" > a.txt
或者在conf
下的hive-site.xml
配置文件中修改配置选项:
<property><name>hive.support.sql11.reserved.keywords</name><value>false</value>
</property>
这篇关于Failed to recognize predicate 'xxx'. Failed rule: 'identifier' in column specification的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!