如何使用多重分隔符在配置单元中插入数据,并且在未指定分隔符的列之间插入数据。
以下是我的数据:
25380 20130101 2.514 -135.69 58.43 8.3 1.1 4.7 4.9 5.6 0.01 C 1.0 -0.1 0.4 97.3 36.0 69.4 -99.000 -99.000 -99.000 -99.000 -99.000 -9999.0 -9999.0 -9999.0 -9999.0 -9999.0
25380 20130102 2.514 -135.69 58.43 3.0 -0.3 1.4 1.2 0.0 0.35 C 1.3 -1.0 -0.1 100.0 89.5 98.2 -99.000 -99.000 -99.000 -99.000 -99.000 -9999.0 -9999.0 -9999.0 -9999.0 -9999.0
我只想在我的配置单元表中插入前 7 列,并且我有一个用于上述数据的 txt 文件。
创建表脚本:
CREATE TABLE hotcold (a int,b int,c float,d float,e float,f float,g float,h string,i string,j string,k string,l string,m string,n string,o string,p string,q string,
r string,s string,t string,u string,v string,w string,x string,y string,z string,aa string,bb string,cc string,dd string,ee string
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.RegexSerDe' WITH SERDEPROPERTIES ('input.regex'='\\s+');
我的数据插入脚本如下:
LOAD DATA LOCAL INPATH '/home/cloudera/WeatherData.txt' into table hotcold;
以下是我的选择语句和错误:
select * from hotcold;
错误 :
Failed with exception java.io.IOException:org.apache.hadoop.hive.serde2.SerDeException: Number of matching groups doesn't match the number of columns