Hive 标识符列表及保留方法

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

猜你喜欢

转载自blog.csdn.net/a6661314/article/details/124616089