我有一个 Java MR 程序。我的 Map 方法的输出是各种字符串/数字,我现在将它们放入字符串中。然后在 Reduce 中拆分字符串并使用参数。现在我想知道这是否更容易完成。
我正在考虑一个地图,我将我的字符串/数字存储为值,并带有一个描述每个值的命名键。这个地图将是我的“价值输出”(MapOutputValueClass)。
这可能吗?当我在文档中读到这个时,我想我的想法是不可实现的:
The key and value classes have to be serializable by the framework and hence need to implement the Writable interface. Additionally, the key classes have to implement the WritableComparable interface to facilitate sorting by the framework.
那么你会建议我为我的 MapOutputValueClass 选择什么?:-) 也许拿一张地图并将其转换为 ImmutableBytesWritable?我也不想放慢我的程序...
感谢您的回答!