常用hive

create table t_downloadAd (
event_number bigint,
user_id bigint,
apk_id         bigint,
cloud_id       bigint,
push_id        bigint, 
visit_url      string,
visit_date timestamp,
 action_date  timestamp,
 session_id             string,
 imei                   string,
 network_type           string,
 app_version_code       string,
 mobile_os              string,
 req_type               string,
 screen                 string,
 airpush_version_code   string,
 agent                  string,
 sim                    string,
 ip                     string,
 referer                string,
 service_ip             string,
 log_serial_num         string,
 simcard_type           string,
 uuadv_key              string,
 uuid                   string,
 iccid                  string,
 mac                    string,
 mnc                    string,
 cid                    string,
 from_module            string,
 client_type           int,
 from_system           int,
 mcc                   int,
 lac                   int,
 airpush_type     int,  
 request_type  int,
 click_type   int,
 real_link_url  string,
 website_id   bigint,
 link_id    bigint,
 request_url   string,
 resource_type  int,
 case_id    bigint,
 app_key    string,
 resource_id   string,
 receive_date string
)
partitioned by (report_date string)
stored as ORC ;

 

alter table t_downloadAd add  PARTITION(report_date='20131226');


 LOAD DATA local INPATH '/hadoop/datafile/report_date=20131226' OVERWRITE INTO TABLE t_downloadad partition (report_date = '20131226');

 select session_id,uuadv_key from t_downloadad where report_date='20131226' limit 50;
 alter table t_downloadAd drop partition(report_date = '20131228');
 conf.setBoolean("mongo.input.split.create_input_splits", false);

CREATE TABLE test_hive
   STORED AS TEXTFILE
   LOCATION '/user/test_hive'
   AS
select session_id,cloud_id from t_downloadad where report_date='20131226';


INSERT OVERWRITE TABLE test_hive
select session_id,cloud_id from t_downloadad where report_date='20131227';

你可能感兴趣的:(常用hive)