hive 本地檔案匯入表

2021-10-10 07:58:49 字數 1182 閱讀 8755

在hive中將本地檔案匯入**

建立名為idata_tmp.yanxue_hivetest的表

create

table idata_tmp.yanxue_hivetest(

num int

, name string

)row format delimited fields

terminated

by'\t'

;

注:如果想從本地匯入檔案時建表時必須設定分隔符,保證本地檔案列分隔符和表中的分隔符一致。否則會導致匯入的資料為空。

將桌面檔案上傳到伺服器 (使用shell命令 rz 或者直接在伺服器的目錄下用vim編輯儲存為test.txt)

檢視新建的idata_tmp.yanxue_hivetest表在hdfs的路徑

4. 將檔案上傳到hdfs路徑

hadoop fs -put test.txt hdfs://nn1/warehouse/idata_tmp.db/hivestudent
將檔案匯入表

檢視匯入的檔案

將本地檔案匯入 Hive 案例

需求 將本地 export servers data student.txt 這個目錄下的資料匯入到 hive 的 student id int,name string 表中。1 資料準備 1 在 export servers data 這個目錄下準備資料 root hadoop01 export ...

Hive 表資料的匯出 匯入(HDFS 本地)

資料匯出 1 語法 load data local inpath 資料的path overwrite into table student partition partcol1 val1,1 load data 表示載入資料 2 local 表示從本地載入資料到hive表 否則從hdfs載入資料到h...

將hdfs檔案匯入hive表

hive sql對hdfs的操作最終都會轉化為mr任務,下面介紹如何將已經存在的hdfs檔案 匯入 hive表,很簡單 條件及要求 1 hdfs檔案為經過lzo壓縮的seqfile 2 seqfile資料樣例 3 hive表是外在分割槽表 步驟1.建立hive表 其中external和partiti...