0
我有以下內容的TXT:
$ hdfs dfs -cat result/
[5,AA,ABE,US,AGU,MX,DNE0M0Z1,99991231,20160421,MX13,706,1,,33,,BOX,,,60,INNJ,31,2419221]
[5,AA,ABE,US,AGU,MX,DNE0M0Z1,99991231,20160421,MX13,706,1,,33,,BOX,,,60,INNJ,31,2419244]
[5,AA,ABE,US,AGU,MX,DNE0M0Z1,99991231,20160421,MX13,706,1,,33,,BOX,,,60,INNJ,31,2419319]
由Spark在HDFS生成此文件。我想要的是創建一個從該文件中讀取的表HIVE,並將結果顯示在表中。問題是記錄以[]開頭和結尾。因爲我可以在不更改txt的情況下執行此操作,因爲它是自動生成的?
現在我的表是:
DROP TABLE IF EXISTS RESULT_LATAM;
CREATE EXTERNAL TABLE IF NOT EXISTS RESULT_LATAM
(
FARDET_NUM_RULE_TARIFF BIGINT,
FARDET_CD_CARRIER VARCHAR(3),
FARDET_CD_ORIGIN_CITY VARCHAR(5),
FARDET_CD_ORIGIN_COUNTRY VARCHAR(2),
FARDET_CD_DEST_CITY VARCHAR(5),
FARDET_CD_DEST_COUNTRY VARCHAR(2),
FARDET_CD_FARE_BASIS VARCHAR(8),
.
.
.
)
STORED AS TEXTFILE
LOCATION '/user/ubuntu/result/';