I've been trying to get a simple map-reduce working all day. While I'd like to make a map-reduce which does a batch roll-up of keys using a key-filter, for no all I'm trying to do is get MR to return the values in a particular bucket.
Here's my code (scala using the 2.0 riak java client):
import com.basho.riak.client.api.commands.mapreduce.BucketMapReduce
import com.basho.riak.client.core.query.functions.{Function => RiakFunction}
new BucketMapReduce.Builder().withNamespace(ns).
withMapPhase(RiakFunction.newAnonymousJsFunction("""function(v) { return [v]; }""")).
build()
I've also tried:
import com.basho.riak.client.api.commands.mapreduce.BucketMapReduce
import com.basho.riak.client.core.query.functions.{Function => RiakFunction}
new BucketMapReduce.Builder().withNamespace(ns).
withMapPhase(RiakFunction.newErlangFunction("riak_kv_mapreduce", "map_identity")).
build()
Both of these return empty-arrays when I hit my riak server. Anything I'm missing that would cause this to happen? I see no error output whatsoever in the logs (which is actually been par for the course when errors occur in the Java client).