3

How do you use "Range" to Scan an entire table in accumulo without apriori knowledge?

How do folks currently do that. I want to take the random search from:I am looking at writing an Accumulo iterator to return a random sample of a percentile of a table

and scan over (then write to hdfs) a sample.

This requires me to scan the entire table I believe.

thanks!

Chris

Community
  • 1
  • 1
Chris Rigano
  • 687
  • 1
  • 11
  • 23

2 Answers2

3

This is the same thing that the previous answer is saying, but I thought it might help to show a line of code.

If you have a scanner, cleverly named 'scanner', you can use the setRange() method to set the range on the scanner. Because the default range is (-inf, +inf), passing setRange a newly created range object will give your scanner, with a range of (-inf, +inf), the ability to scan the entire table.

The sample code looks like:

scanner.setRange(new Range());
milk3422
  • 660
  • 6
  • 10
2

You can scan the entire table by using the no-arg constructor. Per the docs on Range():

Creates a range that goes from negative to positive infinity.

MikeD
  • 3,348
  • 1
  • 23
  • 36
  • You should update this answer to also note that this is the default range if no other range is specified on the Scanner. – Christopher Apr 16 '14 at 00:17
  • Milk you nailed it but Sweeney "Todd" at work hit me with in seconds after my entering it so I have to credit him as well. Thanks Mates, Chris – Chris Rigano Apr 16 '14 at 12:18