MarkLogic Connector for Hadoop 1.1-3

com.marklogic.mapreduce.examples
Class HelloWorld

java.lang.Object
  extended by com.marklogic.mapreduce.examples.HelloWorld

public class HelloWorld
extends Object

Read the first word from each input document, then produce a single output document containing the words, sorted, and concatenated into a single string. Only XML documents with text nodes contribute to the final result.

This sample uses the marklogic-hello-world.xml config file.

The config file name is hard-coded into the sample for simplicity, so no additional command line options are required by the sample.

The mapper creates key-value pairs where the key is always the same constant and the value is the first word from the document. The reducer sorts the words, concatenates them together, and writes them to an output document. Since all key-value pairs produced by the mapper have the same key, there's only one input pair to the reducer, producing a a single output document.

For example, given 2 input documents whose first words are "hello" and "world", the mapper produces: (1, "hello") and (1, "world"). The reducer receives (1, ("hello", "world")) as input and inserts HelloWorld.txt in the database, containing "hello world".


Nested Class Summary
static class HelloWorld.MyMapper
           
static class HelloWorld.MyReducer
           
 
Constructor Summary
HelloWorld()
           
 
Method Summary
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HelloWorld

public HelloWorld()
Method Detail

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

MarkLogic Connector for Hadoop 1.1-3

Copyright © 2013 MarkLogic Corporation. All Rights Reserved.

Complete online documentation for MarkLogic Server, XQuery and related components may be found at developer.marklogic.com