Question

I have Accumulo 1.5 running with the Thrift Proxy. I'm connecting to thrift with Ruby, but I imagine the same situation would arise if I were working with Python.

I have been able to connect to Accumulo, create updates, and scan the table by specific columns. I'm trying to query by a specific Row ID.

querykey = Key.new('row'=>rowid)
querykey_end = Key.new('row'=>"#{rowid}\0")
queryrange = Range.new('start' => querykey, 'startInclusive' => true, 'stop' => querykey_end, 'stopInclusive' => false)
queryscanoptions = ScanOptions.new({'range' => queryrange})

Unfortunately, this throws an error on my Range constructor.

`initialize': wrong number of arguments (1 for 2..3) (ArgumentError)

There isn't exactly much (any) documentation on the Ruby client, so I've been working mostly off of the thrift code. The Range class is defined in proxy_types.rb, but it is defined the same way as the other Thrift classes I'm using.

Was it helpful?

Solution

It was a namespace issue. The Accumulo Thrift code all exists in the root namespace, but Ruby has it's own Range class that was not getting overridden. This problem exists up to Accumulo 1.5.0. To solve it, I went over to github, and grabbed the generated Thrift code from the 1.5.2 branch where all of the Thrift objects are placed in an Accumulo namespace. Now I can call Accumulo::Range.new and it works like a charm. The update also added a namespace to the Python thrift code.

Accumulo 1.5.2 Ruby Thrift code is here: https://github.com/apache/accumulo/tree/1.5.2-SNAPSHOT/proxy/src/main/ruby

This is the commit that fixes everything: https://github.com/apache/accumulo/commit/27ee2367056e5ad0cb6175f91154cd13d49e2c95

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top