大數(shù)據(jù)學(xué)習(xí)路線(xiàn)之hive存儲(chǔ)格式,hive的存儲(chǔ)格式通常是三種:textfile 、 sequencefile 、 rcfile 、 orc 、自定義 set hive.default.fileformat=TextFile; 默認(rèn)存儲(chǔ)格式為:textfile textFile:普通文本存儲(chǔ),不進(jìn)行壓縮。查詢(xún)效率較低。 1.sequencefile: hive提供的二進(jìn)制序列文件存儲(chǔ),天生壓縮。 sequeceFile 和 rcfile都不允許使用load方式加載數(shù)據(jù)。需要使用insert 方式插入 默認(rèn)支付壓縮、分割,使用便捷、寫(xiě)和查詢(xún)較快。sequencefile和壓縮屬性可以搭配使用。 create table if not exists seq1( 2.rcfile: rcfile可以進(jìn)行行列混合壓縮,將附近的列和行的數(shù)據(jù)盡量保存到相同的塊里面,該存儲(chǔ)格式會(huì)提高查詢(xún)效率,但是寫(xiě)數(shù)據(jù)較慢。該方式和gzcodeC壓縮屬性結(jié)合不是很好() set mapred.output.compression=true; set mapred.output.compression.codec=org.apache.hadoop.io.compress.GzipCodec; ###創(chuàng)建rcfile表: 3.存儲(chǔ)自定義: 數(shù)據(jù): seqyd元數(shù)據(jù)文件: aGVsbG8saGl2ZQ== aGVsbG8sd29ybGQ= aGVsbG8saGFkb29w seqyd文件為base64編碼后的內(nèi)容,decode后數(shù)據(jù)為: ##hello,hive 通常是使用 defaultCodec + rcfile搭配效率最好 |
|
來(lái)自: 好程序員IT > 《大數(shù)據(jù)培訓(xùn)教程》