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
这里是file
$ b
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)
存储为ORC TBLPROPERTIES(orc.compress=SNAPPY,orc.bloom.filters.columns=macaddress)
PARTITIONED BY( 'cmtsid'CHAR(50),'date'INT)
LOCATION'/ usr / hive / warehouse / UpStreamParam';
而且我收到以下错误:
FAILED:ParseException行2:0无法识别''macaddress'''CHAR''('在列规格中'''''''''''''$'$ b $ / $ block $'$首先,列名必须被
`
(反引号)包围,而不是'
(单引号)。
因此,您必须替换
其次,<$ c的顺序$ c> STORED AS 和'macaddress'
到`macaddress`
,以及所有其他列名称。TBLPROPERTIES
和PARTITIONED BY
和LOCATION
是错误的。
正确的顺序是PARTITIONED BY
,STORED AS
,LOCATION
,TBLPROPERTIES
。
查看蜂巢语言详细手册。
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTable
<因此,正确的代码是:
$ b $ pre $ prestreamParam(
`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,
`correct` BIGINT,
`uncorrectables` BIGINT)
PARTITIONED BY(`cmtsid` CHAR(50),`date` INT)
存储为ORC
LOCATION'/ usr / hive / warehouse / UpStreamParam'
TBLPROPERTIES(orc.compress=SNAPPY,orc.bloom.filters.columns=macaddress);
I've tried running
hive -v -f sqlfile.sql
Here is the content of the file
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' ;
And i'm getting the following error:
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).Therefore you have to replace
'macaddress'
to`macaddress`
, as well as all other column names.Second, the order of
STORED AS
andTBLPROPERTIES
andPARTITIONED BY
andLOCATION
is wrong. The correct order isPARTITIONED BY
,STORED AS
,LOCATION
,TBLPROPERTIES
.See the hive language manual for detail. https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTable
So the correct code is
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 FAILED:ParseException行2:0无法识别''macaddress''''CHAR''('列列中的'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!