Skip to content

Instantly share code, notes, and snippets.

@okram
Created July 28, 2012 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okram/3194495 to your computer and use it in GitHub Desktop.
Save okram/3194495 to your computer and use it in GitHub Desktop.
public static class Map extends Mapper<ByteBuffer, SortedMap<ByteBuffer, IColumn>, Text, Text> {
@Override
public void map(final ByteBuffer key, final SortedMap<ByteBuffer, IColumn> value, final Mapper<ByteBuffer, SortedMap<ByteBuffer, IColumn>, Text, Text>.Context context) throws IOException, InterruptedException {
final StringBuffer string = new StringBuffer();
for (java.util.Map.Entry<ByteBuffer, IColumn> entry : value.entrySet()) {
string.append(ByteBufferUtil.string(entry.getKey())).append("\t").append(ByteBufferUtil.string(entry.getValue().value()));
}
context.write(new Text(ByteBufferUtil.string(key, Charset.forName("UTF-8"))), new Text(string.toString()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment