静态分区表:
一级分区表:
CREATE TABLE order_created_partition ( orderNumber STRING , event_time STRING ) PARTITIONED BY (event_month string) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
加载数据方式一:从本地/HDFS目录加载
load data local inpath '/home/spark/software/data/order_created.txt' overwrite into table order_created_partition PARTITION(event_month='2014-05');
select * from order_created_partition where event_month='2014-05';
+-----------------+-----------------------------+--------------+ | ordernumber | event_time | event_month | +-----------------+-----------------------------+--------------+ | 10703007267488 | 2014-05-01 06:01:12.334+01 | 2014-05 | | 10101043505096 | 2014-05-01 07:28:12.342+01 | 2014-05 | | 10103043509747 | 2014-05-01 07:50:12.33+01 | 2014-05 | | 10103043501575 | 2014-05-01 09:27:12.33+01 | 2014-05 | | 10104043514061 | 2014-05-01 09:03:12.324+