2016-06-20 48 views
0

輸入文件:我有地圖在方括號內輸入和我想讀它,它在蜂巢

[Tom,123,0,jump] 
[jerry,345,1,run] 

我想讀在蜂巢上面的輸入, 我DDL是

創建外部表,如果NOT EXISTS db1.tomjerrry (名稱字符串,ID INT,isGood INT,活動字符串)通過終止

行格式分隔的字段 ''

位置 '/user/myname/sample.txt'

當我嘗試讀取, 從db1.tomjerrry

我得到選擇的名字,

[湯姆

[jerry

如何去除配置單元輸出中的方括號。

+0

仍然面臨問題.. –

回答

0

添加ESCAPED BY '['

CREATE EXTERNAL TABLE IF NOT EXISTS db1.tomjerrry (name ARRAY<string>, id int, isGood int, activity string) 

    row format delimited fields terminated by ',' ESCAPED BY '['; 

    LOCATION '/user/myname/sample.txt' 

或者更新CSV文件刪除[。

+0

謝謝它有幫助,對延遲抱歉 – Mahadevan