Hive 标识符列表及保留方法
1、标识符列表
Hive 有一些保留的关键字,我们在执行一些语句时,不能将这些关键字作为标识符(Identifier),比如建表语句的 表名 或者 字段名,以下我们具体看看什么是 Hive 中的 标识符。
官方标识符列表:入口
2、保留标识符方法
如果你非要使用“保留的关键字”作为标识符,官网也给出了建议
原文如下:
Reserved keywords are permitted as identifiers if you quote them as described in Supporting Quoted Identifiers in Column Names (version 0.13.0 and later, see HIVE-6013). Most of the keywords are reserved through HIVE-6617 in order to reduce the ambiguity in grammar (version 1.2.0 and later). There are two ways if the user still would like to use those reserved keywords as identifiers: (1) use quoted identifiers, (2) set hive.support.sql11.reserved.keywords=false. (version 2.1.0 and earlier)
总结后就是如下两点:
- 对标识符使用倒引号(backtick);
- set hive.support.sql11.reserved.keywords=false
本文作者:Dancing-Pierre
本文链接:https://www.cnblogs.com/wyc-1009/p/17548038.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步