Java MR

niedomnie niedomnie at
Wed Dec 3 08:04:35 EST 2014

no results (prints 0) on below code (using 2.0 java client from maven, and
connecting to riak 2.0),
I've changed map/reduce functions JS or Erlang, used different MapReduce
classes (for Bucket, BucketKey, or Index one) but without any luck.
It is written in groovy - but I do not think that it differs from java code
in this example

def client = RiakClient.newClient(RiakNode.Builder.DEFAULT_REMOTE_PORT,

Namespace ns = new Namespace("current", "bucket");
    for (int i = 0; i < 200; i++) {
        Location loc = new Location(ns, "key" + i);
        RiakObject ro = new RiakObject().setContentType("text/plain")
                .setValue(BinaryValue.create("" + i));
        StoreValue sv = new
        RiakFuture<StoreValue.Response, Location> future =
//    BucketMapReduce bmr =
//            new BucketMapReduce.Builder()
//                    .withNamespace(ns)
"map_object_value"), false)
"reduce_string_to_integer"), false)
"reduce_sort"), true)
//                    .build();
//    MapReduce.Response response = G.client.execute(bmr);

    BucketMapReduce bmr =
            new BucketMapReduce.Builder()
.withMapPhase(Function.newNamedJsFunction("Riak.mapValuesJson"), false)
    RiakFuture<MapReduce.Response, BinaryValue> future =
    MapReduce.Response response = future.get();
    println "MR " + response.getResultsFromAllPhases().size()


View this message in context:
Sent from the Riak Users mailing list archive at

More information about the riak-users mailing list