drop table if exists table_name; CREATE EXTERNAL TABLE beike.beike_ershoufang ( details_name string, postition_url string , house_url string, house_id string, house_info string, follew_info string, subway string, total_price float, total_price_danwei string, unit_price float, district string, city_name string, fetchtime timestamp )COMMENT '贝壳二手房' PARTITIONED BY (dt STRING, cd3 STRING) row format delimited fields terminated by ',';
load data local inpath '/home/andrew/output.csv' into table beike.beike_ershoufang PARTITION(dt='2017-03-31' ,cd3='1389');;
3. Hive看包括行数在内的信息
1 2
show tblproperties table_name; desc formatted table_name;
4. Hive一次写入一个表的多个分区的数据
1 2 3 4
set hive.exec.dynamic.partition=true; set hive.exec.dynamic.partition.mode=nonstrict; insert overwrite table table1 partition(partition_column) select col1, col2,..., partition_column from table1;
5. Hive一次写入大量分区
1 2 3 4 5
set hive.exec.max.dynamic.partitions=100000; --每一个mapreduce job允许创建的分区的最大数量,如果超过了这个数量就会报错 set hive.exec.max.dynamic.partitions.pernode=100000; --hive.exec.max.created.files :所有的mapreduce job允许创建的文件的最大数量 set hive.exec.max.created.files=10000;