0

I have code like the following:

Scanner s = conn.createScanner("userdata", auths);
s.setRange(new Range(input));
s.fetchColumnFamily(new Text("age"));

My question is, does anyone know that what should be the "input" part in the "new Range(input)"? is the input RowId?

user3502577
  • 99
  • 2
  • 7

1 Answers1

0

The input to Range would be what you are looking for. Have a look at the docs:

http://accumulo.apache.org/1.6/apidocs/org/apache/accumulo/core/data/Range.html#Range(java.lang.CharSequence)

An example might be:

s.setRange(new Range(new Text("Foo")));
FuriousGeorge
  • 4,561
  • 5
  • 29
  • 52
  • Thanks. But in Accumulo, one row has "rowId, column family, column qualifier", so which part should be regarded as the arguments in new Range()? – user3502577 May 05 '15 at 21:09
  • The rowID. The CF, CQ are set separately, as you have noted in your example. – FuriousGeorge May 06 '15 at 01:28
  • So did you mean that we could also do "s.setRange(new Range(new Text(column qualifier))); "? – user3502577 May 06 '15 at 16:29
  • for example, we have "Range(Key startKey, Key endKey) ", so could this key be rowId, column family or column qualifier(any of them)? Or the Key be "rowId+column family+column qualifier"? Thanks – user3502577 May 06 '15 at 16:32
  • There are lots of ways to go about this. You can set just the Range on the RowID and then call fetchColumn() or fetchColumnFamily() to set the CF and CQ you care about. Or, you can do it all in the Keys. It'd probably help if you listed an example of what you're trying to query. – FuriousGeorge May 06 '15 at 20:11