Hive FAILED:ParseException行2:0无法识别''macaddress''''CHAR''('列列中的' [英] Hive FAILED: ParseException line 2:0 cannot recognize input near ''macaddress'' 'CHAR' '(' in column specification

查看:867
本文介绍了Hive FAILED:ParseException行2:0无法识别''macaddress''''CHAR''('列列中的'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过运行 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 $'$首先,列名必须被`(反引号)包围,而不是'(单引号)。



因此,您必须替换'macaddress'`macaddress` ,以及所有其他列名称。

其次,<$ c的顺序$ c> STORED AS 和 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 and TBLPROPERTIES and PARTITIONED BY and LOCATION is wrong. The correct order is PARTITIONED 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆