hive -e "set mapred.job.queue.name=root.common;select userid,filehash from common.st_common_clfile where dt='20151026' and db=0 limit 1000000;">shfile.txt
7.将数据插入到表中,overwrite会覆盖,into会追加
INSERT OVERWRITE TABLE tablename1 [PARTITION (partcol1=val1, partcol2=val2 ...) [IF NOT EXISTS]] select_statement1 FROM from_statement;
INSERT INTO TABLE tablename1 [PARTITION (partcol1=val1, partcol2=val2 ...)] select_statement1 FROM from_statement;
hive -e"
set mapreduce.job.queuename=root.baseDepSarchQueue;
set hive.support.quoted.identifiers=none;
INSERT OVERWRITE TABLE temp.jimmy_song_houlai PARTITION (dt='2017-07-13') select '(dt)?+.+' from ddl.dt_search_ard_d
where dt='2017-07-13'
and inputstring='后来 刘若英'
and is_valid=0
and inputtype in ('1','2','4')
;">insertsampletable.txt
ALTER TABLE temp.jimmylian_menu_parse RENAME TO extern.jimmylian_menu_parse;
ALTER TABLE temp.jimmylian_menu_seg RENAME TO extern.jimmylian_menu_seg;
ALTER TABLE temp.jimmylian_menu_tag RENAME TO extern.jimmylian_menu_tag;
ALTER TABLE temp.jimmylian_menu_list_tag RENAME TO extern.jimmylian_menu_list_tag;
ALTER TABLE temp.search_offline_play_favor_ratio_h CHANGE play_favor_raito play_favor_ratio Double;
ALTER TABLE Table_Name DROP IF EXISTS PARTITION(column1<1,column2=101)
Alter table 表名 change column 原字段名称 现字段名称 数据类型
show create table common.dim_qk_audio_d;
create table temp.jdual (dummy string);
create table temp.jdual4 (kw string, scid string, play int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ' ' LINES TERMINATED BY '\n' ;
load data local inpath'/data1/baseDepSarch/tempstatic/queryhot/jdual.txt' overwrite into table temp.jdual;
select max(dummy) from temp.jdual; #发现max会对字符串,返回b在a前,不管a后面有多少长度,猜测应该是ascii值的比较
val sql_group_create= """
create table if not exists """+s"""$datatable"""+"""_group_orc
(
query string,
word string,
score double
)
partitioned by (cdt string)
ROW FORMAT SERDE
'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
STORED AS INPUTFORMAT
'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
"""