2016-03-18 91 views
0

我有一個拼花表格式如下:創建文本表分區表拼花

.impala_insert_staging 
yearmonth=2013-04 
yearmonth=2013-05 
yearmonth=2013-06 
... 
yearmonth=2016-04 

底下每個目錄都是我的實木複合地板的文件。我需要把它們放到我的另一個表中,它只有一個

.impala_insert_staging 

文件。

請幫忙。

+0

我真的,真的不明白是什麼問題。爲什麼不運行一個簡單的查詢,比如'INSERT INTO TABLE target SELECT cola,colb,... FROM source'並使用Impala來實現它,即數據庫引擎? –

回答

0

我發現的最好的方法是將文件在本地拉出,然後sqoop將它們備份到文本列表中。

拉實木複合地板表下來,我執行以下操作:

impala-shell -i <ip-addr> -B -q "use default; select * from <table>" -o filename '--output_delimiter=\x1A' 

很不幸,這增加了yearmonth值作爲我的桌子另一列。所以,我要麼去到我的750GB文件,並sed/awk的是最後一列或使用mysqlimport(因爲我使用MySQL和)只導入我感興趣的列。

最後,我會sqoop了數據到一個新的文本表格。

sqoop import --connect jdbc:mysql://<mysqlip> --table <mysql_table> -uroot -p<pass> --hive-import --hive-table <new_db_text>