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,
"127.0.0.1")
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
StoreValue.Builder(ro).withLocation(loc).build();
RiakFuture<StoreValue.Response, Location> future =
G.client.executeAsync(sv);
future.await();
}
// BucketMapReduce bmr =
// new BucketMapReduce.Builder()
// .withNamespace(ns)
//
.withMapPhase(Function.newErlangFunction("riak_kv_mapreduce",
"map_object_value"), false)
//
.withReducePhase(Function.newErlangFunction("riak_kv_mapreduce",
"reduce_string_to_integer"), false)
//
.withReducePhase(Function.newErlangFunction("riak_kv_mapreduce",
"reduce_sort"), true)
// .build();
// MapReduce.Response response = G.client.execute(bmr);
BucketMapReduce bmr =
new BucketMapReduce.Builder()
.withNamespace(ns)
.withMapPhase(Function.newNamedJsFunction("Riak.mapValuesJson"), false)
.withReducePhase(Function.newNamedJsFunction("Riak.reduceNumericSort"),
true)
.build();
RiakFuture<MapReduce.Response, BinaryValue> future =
G.client.executeAsync(bmr);
future.await();
MapReduce.Response response = future.get();
println "MR " + response.getResultsFromAllPhases().size()
client.shutdown()
--
View this message in context:
http://riak-users.197444.n3.nabble.com/Java-MR-tp4032117p4032207.html
Sent from the Riak Users mailing list archive at Nabble.com.
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com