我有一个来自视频流日志的数据集。每个视频都由 FileGUID 标识。日志条目记录 FileGUID、观看的视频片段和观看的带宽。
我想创建一个mapreduce,为每个视频输出一个片段总数和每个带宽的计数。理想情况下,它看起来像;
{"FileGUID":"50acb3a5796634df0e073285",
{
"1":{"total":76, "0832":34, "1028":42},
"2":{"total":42, "0832":28, "1028":14},
...
}
}
这是否可以通过一个 mapreduce 实现,或者它是一个多步骤过程,还是我应该使用不同的方法?
这是数据示例。
{
"_id": ObjectId("50acb3a5796634df0e073285"),
"IP": "46.7.1.88",
"DateTime": ISODate("2012-10-24T22:59:57.0Z"),
"FileGUID": "8cdde821fb934a6da7c125a012a26612",
"Bandwidth": NumberInt(1028),
"Segment": NumberInt(1),
"Fragment": NumberInt(237),
"Status": NumberInt(200),
"Size": NumberInt(576790),
"UserAgent": "Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko\/20100101 Firefox\/16.0"
}
{
"_id": ObjectId("50acb3a5796634df0e073284"),
"IP": "46.7.1.88",
"DateTime": ISODate("2012-10-24T22:59:52.0Z"),
"FileGUID": "8cdde821fb934a6da7c125a012a26612",
"Bandwidth": NumberInt(1028),
"Segment": NumberInt(1),
"Fragment": NumberInt(236),
"Status": NumberInt(200),
"Size": NumberInt(577100),
"UserAgent": "Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko\/20100101 Firefox\/16.0"
}
{
"_id": ObjectId("50acb3a5796634df0e073283"),
"IP": "46.7.1.88",
"DateTime": ISODate("2012-10-24T22:59:47.0Z"),
"FileGUID": "8cdde821fb934a6da7c125a012a26612",
"Bandwidth": NumberInt(0832),
"Segment": NumberInt(1),
"Fragment": NumberInt(234),
"Status": NumberInt(200),
"Size": NumberInt(576664),
"UserAgent": "Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko\/20100101 Firefox\/16.0"
}
{
"_id": ObjectId("50acb3a5796634df0e073282"),
"IP": "46.7.1.88",
"DateTime": ISODate("2012-10-24T22:59:42.0Z"),
"FileGUID": "8cdde821fb934a6da7c125a012a26612",
"Bandwidth": NumberInt(0832),
"Segment": NumberInt(1),
"Fragment": NumberInt(233),
"Status": NumberInt(200),
"Size": NumberInt(575692),
"UserAgent": "Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko\/20100101 Firefox\/16.0"
}