Apache Hive:失败:此处不支持 ParseException 行 4:1 字符 ''

Apache Hive: FAILED: ParseException line 4:1 character '' not supported here

我正在尝试在 Apache Hive 中创建一个新的 table,它从 CSV 文件加载数据。 我写了这个脚本

CREATE SCHEMA IF NOT EXISTS practica2;

CREATE EXTERNAL TABLE IF NOT EXISTS practica2.station_data 
(IDPROVINCIA string,
SPROVINCIA string,
IDESTACION string, 
SESTACION string,
FECHA string,
DIA string,
TEMPMAX string,
HORMINTEMPMAX string,
TEMPMIN string,
HORMINTEMPMIN string,
TEMPMEDIA string,
HUMEDADMAX string,
HUMEDADMIN string,
HUMEDADMEDIA string,
VELVIENTO string,
DIRVIENTO string, 
RADIACION string, 
PRECIPITACION string) 
ROW FORMAT DELIMITED 
FIELDS TERMINATED BY ';'
STORED AS TEXTFILE
LOCATION 'hdfs://0.0.0.0:9000/user/hive';

但是,当我执行脚本时,出现此错误

FAILED: ParseException line 4:1 character '' not supported here

我测试了另一种选择,结果相同:

CREATE SCHEMA IF NOT EXISTS practica2;

CREATE TABLE IF NOT EXISTS practica2.station_data 
(IDPROVINCIA string,
SPROVINCIA string,
IDESTACION string, 
SESTACION string,
FECHA string,
DIA string,
TEMPMAX string,
HORMINTEMPMAX string,
TEMPMIN string,
HORMINTEMPMIN string,
TEMPMEDIA string,
HUMEDADMAX string,
HUMEDADMIN string,
HUMEDADMEDIA string,
VELVIENTO string,
DIRVIENTO string, 
RADIACION string, 
PRECIPITACION string) 
ROW FORMAT DELIMITED 
FIELDS TERMINATED BY ';';

LOAD DATA LOCAL INPATH './RIA_exportacion_datos_diarios_Huelva_20140206.csv' INTO TABLE practica2.station_data;

完整报告是这样的:

almu@debian:~/Practicas_BigData/Practica2/Hive$ hive -f practica2.hql 
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hive/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]

Logging initialized using configuration in jar:file:/usr/local/hive/lib/hive-common-2.3.7.jar!/hive-log4j2.properties Async: true
OK
Time taken: 3.894 seconds
FAILED: ParseException line 4:1 character '' not supported here

当我从 Hive 命令行创建 table 时,它的创建没有问题。但是,当我执行脚本时,它总是失败。

哪里出错了?

更新:关于';'的建议可能是错误的原因,我这样替换了这一行:

FIELDS TERMINATED BY ',';

但错误依旧

尝试删除新行?

CREATE SCHEMA IF NOT EXISTS practica2;

CREATE EXTERNAL TABLE IF NOT EXISTS practica2.station_data (IDPROVINCIA string, SPROVINCIA string, IDESTACION string, SESTACION string, FECHA string, DIA string, TEMPMAX string, HORMINTEMPMAX string, TEMPMIN string, HORMINTEMPMIN string, TEMPMEDIA string, HUMEDADMAX string, HUMEDADMIN string, HUMEDADMEDIA string, VELVIENTO string, DIRVIENTO string, RADIACION string, PRECIPITACION string) 
ROW FORMAT DELIMITED 
FIELDS TERMINATED BY ';'
STORED AS TEXTFILE
LOCATION 'hdfs://0.0.0.0:9000/user/hive';

或者您的 sql 文件中可能有全角 space。参见 this post。如果您想摆脱全角 spaces,请手动键入 sql 文件,并避免从其他地方输入 copy/paste。