Hive FAILED: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' ;
我收到以下错误:
FAILED: ParseException line 2:0 cannot recognize input near ''macaddress'' 'CHAR' '(' in column specification
首先,列名必须用`
(反引号)括起来,而不是'
(单引号)。
因此您必须将 'macaddress'
替换为 `macaddress`
,以及所有其他列名称。
其次,STORED AS
和TBLPROPERTIES
和PARTITIONED BY
和LOCATION
的顺序是错误的。
正确的顺序是PARTITIONED BY
, STORED AS
, LOCATION
, TBLPROPERTIES
.
详见hive语言手册。
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 -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' ;
我收到以下错误:
FAILED: ParseException line 2:0 cannot recognize input near ''macaddress'' 'CHAR' '(' in column specification
首先,列名必须用`
(反引号)括起来,而不是'
(单引号)。
因此您必须将 'macaddress'
替换为 `macaddress`
,以及所有其他列名称。
其次,STORED AS
和TBLPROPERTIES
和PARTITIONED BY
和LOCATION
的顺序是错误的。
正确的顺序是PARTITIONED BY
, STORED AS
, LOCATION
, TBLPROPERTIES
.
详见hive语言手册。 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");