create table mydb.userinfo(name string,addressi string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
STORED AS TEXTFILE;
CREATE TABLE mydb.userinfo --創(chuàng)建表
(col1 string, col2 date, col3 double),
partitioned by (datekey date), --可以多個字段的組合分區(qū)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
Stored AS TEXTFILE;
load data local inpath "/home/dahaizi/data/userinfo.txt"
overwrite into table mydb.userinfo;
insert into table(col1,col2,col3) values('a','b','c')
成都創(chuàng)新互聯(lián)專注于南沙網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗。 熱誠為您提供南沙營銷型網(wǎng)站建設(shè),南沙網(wǎng)站制作、南沙網(wǎng)頁設(shè)計、南沙網(wǎng)站官網(wǎng)定制、成都微信小程序服務(wù),打造南沙網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供南沙網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。
INSERT INTO TABLE table_Name
PARTITION (DateKey),
SELECT col1,col2,col3,DateKey FROM otherTable
WHERE DATEKEY IN ('2017-02-26','2013-06-12','2013-09-24'),
GROUP BY col1,col2,col3,DateKey
DISTRIBUTE BY DateKey
insert overwrite directory '/jc_bdcqs/qsy'
row format delimited
fields terminated by ','
select * from zqs_gs_g60_0730_list;
!quit
1)設(shè)置計算容錯率(防止因計算過程出錯而異常退出程序):set mapred.max.map.failures.percent=100;
2)限制查詢輸出文件的個數(shù)set mapred.reduce.tasks=1;
3) 控制最大reduce的數(shù)量,不會影響mapred.reduce.tasks的設(shè)置set hive.exec.reducers.max = 100;
4) 一個job會有多少個reducer來處理,默認(rèn)為1Gset hive.exec.reducers.bytes.per.reducer = 1000000000;
設(shè)置動態(tài)分區(qū)
set hive.exec.dynamic.partition=true;(可通過這個語句查看:set hive.exec.dynamic.partition;),
set hive.exec.dynamic.partition.mode=nonstrict;
SET hive.exec.max.dynamic.partitions=100000;(如果自動分區(qū)數(shù)大于這個參數(shù),將會報錯),
SET hive.exec.max.dynamic.partitions.pernode=100000;
drop table tb_name;
或清空表truncate table table_name;
ALTER TABLE table_Name DROP PARTITION (Datekey='20190606');
alter table tb_name add partition (Datekey = ‘20190606’);