环境:
Hive: 2.7.7
Oracle SQL Developer
Cloudera JDBC Driver
案例:
select type,nameobject,`*date`
from tblobj2
limit 10 ;
错误:
1 - 使用 Oracle SQL Developer 执行上述 HQL 语句报错:
[Cloudera][HiveJDBCDriver](500051) ERROR processing query/statement. Error Code: 40000, SQL state: TStatus(statusCode:ERROR_STATUS, infoMessages:[*org.apache.hive.service.cli.HiveSQLException:Error while compiling statement: FAILED: SemanticException Line 1:23 Invalid column reference '`*date`': Dangling meta character '*' near index 0
*date
....(省却其他错误输出)
java.lang.Thread:run:Thread.java:745, *org.apache.hadoop.hive.ql.parse.SemanticException:Line 1:23 Invalid column reference '`*date`': Dangling meta character '*' near index 0
*date
....(省却其他错误输出)
sqlState:42000, errorCode:40000, errorMessage:Error while compiling statement: FAILED: SemanticException Line 1:23 Invalid column reference '`*date`': Dangling meta character '*' near index 0
*date
^), Query: select type,nameobject,`*date`
from tblobj2
limit 10.
2 - 使用 Hive 同样 也报错:
hive> select nameobject,type,`*date` from tblobj2 limit 10 ;
FAILED: SemanticException [Error 10004]: Line 1:23 Invalid table alias or column reference '*date': (possible column names are: nameobject, object_id, principal_id, schema_id, parent_object_id, type, type_desc, create_date, modify_date, is_ms_shipped, is_published, is_schema_published)
解决方案:
set hive.support.quoted.identifiers=none
select type,nameobject, `.+date`
from tblobj2
where create_date is not null
limit 10
set hive.support.quoted.identifiers=none
quoted.identifier 这才是解决问题的关键。《Hive Programming》中居然也没有提到如何解决。
image
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有