我需要从 hdfs 位置创建一个外部配置单元表,其中文件中的一列具有保留名称(结束)。
运行脚本时出现错误:“无法识别列规范中'end''STRUCT''<'附近的输入”
我找到了 2 个解决方案。
第一个是设置hive.support.sql11.reserved.keywords=false,但是这个选项已经去掉了。 https://issues.apache.org/jira/browse/HIVE-14872
第二种解决方案是使用带引号的标识符 ( column
)。
但在这种情况下,我收到错误:“org.apache.hadoop.hive.serde2.SerDeException: org.codehaus.jackson.JsonParseException: Unexpected character ('c' (code 99)): was expecting comma to separate OBJECT entries”
这是我创建表的代码:
CREATE TEMPORARY EXTERNAL TABLE ${tmp_db}.${tmp_table}
(
id STRING,
email STRUCT<string:STRING>,
start STRUCT<long:BIGINT>,
end STRUCT<long:BIGINT>
)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
LOCATION '${input_dir}';
无法重命名该列。
有人知道这个问题的解决方案吗?或者可能有什么想法?提前非常感谢!