@InterfaceAudience.Public @InterfaceStability.Unstable public final class AsyncKuduScanner extends Object
This class is not synchronized as it's expected to be used from a single thread at a time. It's rarely (if ever?) useful to scan concurrently from a shared scanner using multiple threads. If you want to optimize large table scans using extra parallelism, create a few scanners and give each of them a partition of the table to scan. Or use MapReduce.
There's no method in this class to explicitly open the scanner. It will open
itself automatically when you start scanning by calling nextRows()
.
Also, the scanner will automatically call close()
when it reaches the
end key. If, however, you would like to stop scanning before reaching the
end key, you must call close()
before disposing of the scanner.
Note that it's always safe to call close()
on a scanner.
A AsyncKuduScanner
is not re-usable. Should you want to scan the same rows
or the same table again, you must create a new one.
byte
arrays in argumentbyte[]
in argument will copy it.
For more info, please refer to the documentation of KuduRpc
.
String
s in argumentModifier and Type | Class and Description |
---|---|
static class |
AsyncKuduScanner.AsyncKuduScannerBuilder
A Builder class to build
AsyncKuduScanner . |
static class |
AsyncKuduScanner.ReadMode
The possible read modes for scanners.
|
Modifier and Type | Method and Description |
---|---|
com.stumbleupon.async.Deferred<RowResultIterator> |
close()
Closes this scanner (don't forget to call this when you're done with it!).
|
long |
getBatchSizeBytes()
Returns the maximum number of bytes returned by the scanner, on each batch.
|
boolean |
getCacheBlocks()
Returns if this scanner was configured to cache data blocks or not.
|
long |
getLimit()
Returns the maximum number of rows that this scanner was configured to return.
|
Schema |
getProjectionSchema()
Returns the projection schema of this scanner.
|
AsyncKuduScanner.ReadMode |
getReadMode()
Returns the ReadMode for this scanner.
|
boolean |
hasMoreRows()
Tells if the last rpc returned that there might be more rows to scan.
|
com.stumbleupon.async.Deferred<RowResultIterator> |
nextRows()
Scans a number of rows.
|
String |
toString() |
public long getLimit()
public boolean hasMoreRows()
public boolean getCacheBlocks()
public long getBatchSizeBytes()
public AsyncKuduScanner.ReadMode getReadMode()
public Schema getProjectionSchema()
public com.stumbleupon.async.Deferred<RowResultIterator> nextRows()
Once this method returns null
once (which indicates that this
Scanner
is done scanning), calling it again leads to an undefined
behavior.
public com.stumbleupon.async.Deferred<RowResultIterator> close()
Closing a scanner already closed has no effect. The deferred returned will be called back immediately.
Object
can be null, a RowResultIterator if there was data left
in the scanner, or an Exception.Copyright © 2016. All rights reserved.