日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪(fǎng)問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

hdfs orc格式_hive中orc格式表的数据导入

發(fā)布時(shí)間:2024/1/1 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 hdfs orc格式_hive中orc格式表的数据导入 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Hive系列文章

hive創(chuàng)建orc格式表不能像textfile格式一樣直接load數(shù)據(jù)到表中,需要?jiǎng)?chuàng)建臨時(shí)textfile表,然后通過(guò)insert into 或者insert overwrite到orc存儲(chǔ)格式表中。

如果你直接load數(shù)據(jù)到orc格式表中,這個(gè)步驟可以成功,但是會(huì)發(fā)現(xiàn)select * from table limit 1;這個(gè)語(yǔ)句都會(huì)報(bào)錯(cuò),也就是說(shuō)直接load數(shù)據(jù)是不可行的。對(duì)于hive中orc格式表可以參見(jiàn):大數(shù)據(jù):Hive - ORC 文件存儲(chǔ)格式

1)、創(chuàng)建表

需要?jiǎng)?chuàng)建臨時(shí)表和數(shù)據(jù)表。

臨時(shí)表

create table if not exists db.tmp

(

name string,

age int

)

partitioned by (dt string, hour string, msgtype string, action string)

row format delimited fields terminated by '\t';

數(shù)據(jù)表

create external table if not exists db.people

(

name string,

age int

)

partitioned by (dt string, hour string, msgtype string, action string)

row format delimited fields terminated by '\t'

stored as orc;

2)、 導(dǎo)入數(shù)據(jù)

需要先用load命令將數(shù)據(jù)導(dǎo)入textfile格式表,然后再通過(guò)insert into插入orc格式表。

(1) 導(dǎo)入數(shù)據(jù)到textfile

load data inpath 'hdfs://path' into table db.tmp partition(dt="2018-06-22",hour="00",msgtype="web", action="click");

(2)查詢(xún)數(shù)據(jù)插入orc格式表

insert into db.people partition(dt="2018-06-22",hour="00",msgtype="web", action="click")

select name,age

from db.tmp where dt = "2018-06-22" and hour = "00"

and msgtype = "web" and action = "click";

關(guān)注公眾號(hào):Java大數(shù)據(jù)與數(shù)據(jù)倉(cāng)庫(kù),學(xué)習(xí)大數(shù)據(jù)技術(shù)。

喜歡 (0)or分享 (0)

總結(jié)

以上是生活随笔為你收集整理的hdfs orc格式_hive中orc格式表的数据导入的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。