我想在apache hive中创建一个新的表,从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 命令行中创建一个表时,它的创建没有问题,但当我执行脚本时,它总是失败。
错误在哪里?
我把这行替换成这样。
FIELDS TERMINATED BY ',';
但错误依旧
1条答案
按热度按时间9rnv2umw1#
试着删除新的行?
或者你的sql文件里有全幅空间,请看这个帖子。如果你想去掉全幅空间,请手动输入sql文件,避免从其他地方复制/粘贴。