您的位置:首页 > 大数据 > 人工智能

Failed to recognize predicate 'xxx'. Failed rule: 'identifier' in column specification

2017-06-14 16:10 465 查看


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_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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Hive 保留关键字
相关文章推荐