首页 > 解决方案 > Hive 命令行 - 列名中的反引号问题

问题描述

当我尝试使用 beeline / hive 命令行为以下 DDL 创建表时:

CREATE EXTERNAL TABLE schema.table
(
`Week` string,
`Orders` string,
`Units` string
)
COMMENT 'This table was auto generated'
 ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
 WITH SERDEPROPERTIES (
   'separatorChar' = ',',
   'quoteChar' = '\"',
   'escapeChar' = '\\'
   )
 STORED AS TEXTFILE
 LOCATION '/data/qa/ingest_id=1543338670'
 TBLPROPERTIES ("skip.header.line.count"="1");

我收到以下错误

Error: Error while compiling statement: FAILED: ParseException line 3:0 character '▒' not supported here
line 3:1 character '▒' not supported here
line 3:2 character '▒' not supported here (state=42000,code=40000)

有没有人遇到过这个问题?此 DDL 在 GUI 客户端上执行没有问题。

标签: hadoophivehiveql

解决方案


问题与 UTF 8 编码有关。从 shell 中删除了 unicode 字符。

tr -d '\200-\277' | tr -d '\300-\377'

推荐阅读