create table order_items_part(
order_item_id int,
order_item_order_id int,
order_item_product_id int,
order_item_quantity tinyint,
order_item_subtotal float,
order_item_product_price float
)
PARTITIONED BY (order_month string)
STORED AS avro
;
insert into order_items_part partition(order_month)
> select
> oi.order_item_id,
> oi.order_item_order_id,
> oi.order_item_product_id,
> oi.order_item_quantity,
> oi.order_item_subtotal,
> oi.order_item_product_price, substr(o.order_date,1,7)
> from
> orders o
> inner join
> order_items oi
> ON o.order_id = oi.order_item_order_id ;
Query ID = catchask_20161214055450_14430669-f3ab-42f0-a1e8-9a1ced8c9ddf
Total jobs = 1
Execution log at: /tmp/catchask/catchask_20161214055450_14430669-f3ab-42f0-a1e8-9a1ced8c9ddf.log
2016-12-14 05:54:54 Starting to launch local task to process map join; maximum memory = 1046478848
2016-12-14 05:54:56 Dump the side-table for tag: 0 with group count: 68883 into file: file:/tmp/catchask/fd5e75b3-da65-4316-b3ef-2611412b6669/hive_2016-12-14_05-54-50_239_1854064839581894744-1/-local-10002/HashTable-Stage-4/MapJoin-mapfile00–.hashtable
2016-12-14 05:54:56 Uploaded 1 File to: file:/tmp/catchask/fd5e75b3-da65-4316-b3ef-2611412b6669/hive_2016-12-14_05-54-50_239_1854064839581894744-1/-local-10002/HashTable-Stage-4/MapJoin-mapfile00–.hashtable (2979673 bytes)
2016-12-14 05:54:56 End of local task; Time Taken: 1.895 sec.
Execution completed successfully
MapredLocal task succeeded
Launching Job 1 out of 1
Number of reduce tasks is set to 0 since there’s no reduce operator
Starting Job = job_1480307771710_2763, Tracking URL = http://rm01.itversity.com:8088/proxy/application_1480307771710_2763/
Kill Command = /usr/hdp/2.5.0.0-1245/hadoop/bin/hadoop job -kill job_1480307771710_2763
Hadoop job information for Stage-4: number of mappers: 1; number of reducers: 0
2016-12-14 05:55:08,037 Stage-4 map = 0%, reduce = 0%
2016-12-14 05:55:17,384 Stage-4 map = 100%, reduce = 0%, Cumulative CPU 9.94 sec
MapReduce Total cumulative CPU time: 9 seconds 940 msec
Ended Job = job_1480307771710_2763
Loading data to table catchask.order_items_part partition (order_month=null)
Time taken for load dynamic partitions : 5372
Loading partition {order_month=2014-01}
Loading partition {order_month=2014-04}
Loading partition {order_month=2013-08}
Loading partition {order_month=2013-11}
Loading partition {order_month=2014-05}
Loading partition {order_month=2013-12}
Loading partition {order_month=2014-07}
Loading partition {order_month=2014-06}
Loading partition {order_month=2013-10}
Loading partition {order_month=2013-07}
Loading partition {order_month=2014-02}
Loading partition {order_month=2014-03}
Loading partition {order_month=2013-09}
Time taken for adding to write entity : 4
Partition catchask.order_items_part{order_month=2013-07} stats: [numFiles=1, numRows=3821, totalSize=81865, rawDataSize=0]
Partition catchask.order_items_part{order_month=2013-08} stats: [numFiles=1, numRows=14268, totalSize=312176, rawDataSize=0]
Partition catchask.order_items_part{order_month=2013-09} stats: [numFiles=1, numRows=14694, totalSize=333504, rawDataSize=0]
Partition catchask.order_items_part{order_month=2013-10} stats: [numFiles=1, numRows=13216, totalSize=304824, rawDataSize=0]
Partition catchask.order_items_part{order_month=2013-11} stats: [numFiles=1, numRows=15905, totalSize=366756, rawDataSize=0]
Partition catchask.order_items_part{order_month=2013-12} stats: [numFiles=1, numRows=14729, totalSize=339683, rawDataSize=0]
Partition catchask.order_items_part{order_month=2014-01} stats: [numFiles=1, numRows=14666, totalSize=338235, rawDataSize=0]
Partition catchask.order_items_part{order_month=2014-02} stats: [numFiles=1, numRows=14034, totalSize=323675, rawDataSize=0]
Partition catchask.order_items_part{order_month=2014-03} stats: [numFiles=1, numRows=14350, totalSize=330944, rawDataSize=0]
Partition catchask.order_items_part{order_month=2014-04} stats: [numFiles=1, numRows=14192, totalSize=327317, rawDataSize=0]
Partition catchask.order_items_part{order_month=2014-05} stats: [numFiles=1, numRows=13754, totalSize=317237, rawDataSize=0]
Partition catchask.order_items_part{order_month=2014-06} stats: [numFiles=1, numRows=13305, totalSize=306881, rawDataSize=0]
Partition catchask.order_items_part{order_month=2014-07} stats: [numFiles=1, numRows=11264, totalSize=259894, rawDataSize=0]
MapReduce Jobs Launched:
Stage-Stage-4: Map: 1 Cumulative CPU: 9.94 sec HDFS Read: 5419008 HDFS Write: 3943809 SUCCESS
Total MapReduce CPU Time Spent: 9 seconds 940 msec
OK
Time taken: 36.398 seconds
hive>
> desc formatted order_items_part;
OK
col_name data_type comment
order_item_id int
order_item_order_id int
order_item_product_id int
order_item_quantity int
order_item_subtotal float
order_item_product_price float
Partition Information
col_name data_type comment
order_month string
Detailed Table Information
Database: catchask
Owner: catchask
CreateTime: Wed Dec 14 04:30:34 EST 2016
LastAccessTime: UNKNOWN
Protect Mode: None
Retention: 0
Location: hdfs://nn01.itversity.com:8020/apps/hive/warehouse/catchask.db/order_items_part
Table Type: MANAGED_TABLE
Table Parameters:
transient_lastDdlTime 1481707834
Storage Information
SerDe Library: org.apache.hadoop.hive.serde2.avro.AvroSerDe
InputFormat: org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat
OutputFormat: org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat
Compressed: No
Num Buckets: -1
Bucket Columns: []
Sort Columns: []
Storage Desc Params:
serialization.format 1
Time taken: 0.361 seconds, Fetched: 36 row(s)
hdfs dfs -ls /apps/hive/warehouse/catchask.db/order_items_part
;Found 13 items
drwxrwxrwx - catchask hdfs 0 2016-12-14 05:55 /apps/hive/warehouse/catchask.db/order_items_part/order_month=2013-07
drwxrwxrwx - catchask hdfs 0 2016-12-14 05:55 /apps/hive/warehouse/catchask.db/order_items_part/order_month=2013-08
drwxrwxrwx - catchask hdfs 0 2016-12-14 05:55 /apps/hive/warehouse/catchask.db/order_items_part/order_month=2013-09
drwxrwxrwx - catchask hdfs 0 2016-12-14 05:55 /apps/hive/warehouse/catchask.db/order_items_part/order_month=2013-10
drwxrwxrwx - catchask hdfs 0 2016-12-14 05:55 /apps/hive/warehouse/catchask.db/order_items_part/order_month=2013-11
drwxrwxrwx - catchask hdfs 0 2016-12-14 05:55 /apps/hive/warehouse/catchask.db/order_items_part/order_month=2013-12
drwxrwxrwx - catchask hdfs 0 2016-12-14 05:55 /apps/hive/warehouse/catchask.db/order_items_part/order_month=2014-01
drwxrwxrwx - catchask hdfs 0 2016-12-14 05:55 /apps/hive/warehouse/catchask.db/order_items_part/order_month=2014-02
drwxrwxrwx - catchask hdfs 0 2016-12-14 05:55 /apps/hive/warehouse/catchask.db/order_items_part/order_month=2014-03
drwxrwxrwx - catchask hdfs 0 2016-12-14 05:55 /apps/hive/warehouse/catchask.db/order_items_part/order_month=2014-04
drwxrwxrwx - catchask hdfs 0 2016-12-14 05:55 /apps/hive/warehouse/catchask.db/order_items_part/order_month=2014-05
drwxrwxrwx - catchask hdfs 0 2016-12-14 05:55 /apps/hive/warehouse/catchask.db/order_items_part/order_month=2014-06
drwxrwxrwx - catchask hdfs 0 2016-12-14 05:55 /apps/hive/warehouse/catchask.db/order_items_part/order_month=2014-07
select * from order_items_part limit 10;
OK
1 1 957 1 299.98 299.98 2013-07
2 2 1073 1 199.99 199.99 2013-07
3 2 502 5 250.0 50.0 2013-07
4 2 403 1 129.99 129.99 2013-07
5 4 897 2 49.98 24.99 2013-07
6 4 365 5 299.95 59.99 2013-07
7 4 502 3 150.0 50.0 2013-07
8 4 1014 4 199.92 49.98 2013-07
9 5 957 1 299.98 299.98 2013-07
10 5 365 5 299.95 59.99 2013-07