Hive 失败:ParseException 行 2:0 无法识别“macaddress"附近的输入,“CHAR"“("在列规范中 [英] Hive FAILED: ParseException line 2:0 cannot recognize input near ''macaddress'' 'CHAR' '(' in column specification
问题描述
我试过运行 hive -v -f sqlfile.sql
这是文件的内容
CREATE TABLE UpStreamParam (
'macaddress' CHAR(50),
'datats' BIGINT,
'cmtstimestamp' BIGINT,
'modulation' INT,
'chnlidx' INT,
'severity' BIGINT,
'rxpower' FLOAT,
'sigqnoise' FLOAT,
'noisedeviation' FLOAT,
'prefecber' FLOAT,
'postfecber' FLOAT,
'txpower' FLOAT,
'txpowerdrop' FLOAT,
'nmter' FLOAT,
'premtter' FLOAT,
'postmtter' FLOAT,
'unerroreds' BIGINT,
'corrected' BIGINT,
'uncorrectables' BIGINT)
STORED AS ORC TBLPROPERTIES ("orc.compress"="SNAPPY","orc.bloom.filters.columns"="macaddress")
PARTITIONED BY ('cmtsid' CHAR(50),' date' INT)
LOCATION '/usr/hive/warehouse/UpStreamParam' ;
我收到以下错误:
失败:ParseException 行 2:0 无法识别靠近 ''macaddress'' 'CHAR' '(' 在列规范中的输入
FAILED: ParseException line 2:0 cannot recognize input near ''macaddress'' 'CHAR' '(' in column specification
推荐答案
首先,列名必须用`
(反引号)包围,而不是'
(单引号).
First, the column name must be surrounded by `
(backticks), not '
(single quote).
因此您必须将 'macaddress'
替换为 `macaddress`
,以及所有其他列名称.
Therefore you have to replace 'macaddress'
to `macaddress`
, as well as all other column names.
其次,STORED AS
和TBLPROPERTIES
和PARTITIONED BY
和LOCATION
的顺序是错误的.正确的顺序是PARTITIONED BY
、STORED AS
、LOCATION
、TBLPROPERTIES
.
Second, the order of STORED AS
and TBLPROPERTIES
and PARTITIONED BY
and LOCATION
is wrong.
The correct order is PARTITIONED BY
, STORED AS
, LOCATION
, TBLPROPERTIES
.
详情请参阅 hive 语言手册.https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTable
See the hive language manual for detail. https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTable
所以正确的代码是
CREATE TABLE UpStreamParam (
`macaddress` CHAR(50),
`datats` BIGINT,
`cmtstimestamp` BIGINT,
`modulation` INT,
`chnlidx` INT,
`severity` BIGINT,
`rxpower` FLOAT,
`sigqnoise` FLOAT,
`noisedeviation` FLOAT,
`prefecber` FLOAT,
`postfecber` FLOAT,
`txpower` FLOAT,
`txpowerdrop` FLOAT,
`nmter` FLOAT,
`premtter` FLOAT,
`postmtter` FLOAT,
`unerroreds` BIGINT,
`corrected` BIGINT,
`uncorrectables` BIGINT)
PARTITIONED BY (`cmtsid` CHAR(50), `date` INT)
STORED AS ORC
LOCATION '/usr/hive/warehouse/UpStreamParam'
TBLPROPERTIES ("orc.compress"="SNAPPY","orc.bloom.filters.columns"="macaddress");
这篇关于Hive 失败:ParseException 行 2:0 无法识别“macaddress"附近的输入,“CHAR"“("在列规范中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!