Validate myReduceByKey¶
Let us perform few tasks to validate myReduceKey Function.
Use the function to get the count by date from orders.
['1,2013-07-25 00:00:00.0,11599,CLOSED',
'2,2013-07-25 00:00:00.0,256,PENDING_PAYMENT',
'3,2013-07-25 00:00:00.0,12111,COMPLETE',
'4,2013-07-25 00:00:00.0,8827,CLOSED',
'5,2013-07-25 00:00:00.0,11318,COMPLETE',
'6,2013-07-25 00:00:00.0,7130,COMPLETE',
'7,2013-07-25 00:00:00.0,4530,COMPLETE',
'8,2013-07-25 00:00:00.0,2911,PROCESSING',
'9,2013-07-25 00:00:00.0,5657,PENDING_PAYMENT',
'10,2013-07-25 00:00:00.0,5648,PENDING_PAYMENT']
[('2013-07-25 00:00:00.0', 1),
('2013-07-25 00:00:00.0', 1),
('2013-07-25 00:00:00.0', 1),
('2013-07-25 00:00:00.0', 1),
('2013-07-25 00:00:00.0', 1),
('2013-07-25 00:00:00.0', 1),
('2013-07-25 00:00:00.0', 1),
('2013-07-25 00:00:00.0', 1),
('2013-07-25 00:00:00.0', 1),
('2013-07-25 00:00:00.0', 1)]
[('2013-07-25 00:00:00.0', 143),
('2013-07-26 00:00:00.0', 269),
('2013-07-27 00:00:00.0', 202),
('2013-07-28 00:00:00.0', 187),
('2013-07-29 00:00:00.0', 253),
('2013-07-30 00:00:00.0', 227),
('2013-07-31 00:00:00.0', 252),
('2013-08-01 00:00:00.0', 246),
('2013-08-02 00:00:00.0', 224),
('2013-08-03 00:00:00.0', 183)]
Use the function to get the revenue for each order id.
Use the function to get the revenue as well as the number of items for each order id.