Search in sources :

Example 26 with ReadOnly

use of io.cdap.cdap.api.annotation.ReadOnly in project cdap by cdapio.

the class LevelDBTable method scanPersisted.

@ReadOnly
@Override
protected Scanner scanPersisted(Scan scan) throws Exception {
    FuzzyRowFilter filter = null;
    if (scan.getFilter() != null) {
        // todo: currently we support only FuzzyRowFilter as an experimental feature
        if (scan.getFilter() instanceof FuzzyRowFilter) {
            filter = (FuzzyRowFilter) scan.getFilter();
        } else {
            throw new DataSetException("Unknown filter type: " + scan.getFilter());
        }
    }
    final Scanner scanner = core.scan(scan.getStartRow(), scan.getStopRow(), filter, null, tx);
    return new Scanner() {

        @Nullable
        @Override
        public Row next() {
            return LevelDBTable.this.next(scanner);
        }

        @Override
        public void close() {
            scanner.close();
        }
    };
}
Also used : Scanner(io.cdap.cdap.api.dataset.table.Scanner) DataSetException(io.cdap.cdap.api.dataset.DataSetException) FuzzyRowFilter(io.cdap.cdap.data2.dataset2.lib.table.FuzzyRowFilter) ReadOnly(io.cdap.cdap.api.annotation.ReadOnly)

Aggregations

ReadOnly (io.cdap.cdap.api.annotation.ReadOnly)26 DataSetException (io.cdap.cdap.api.dataset.DataSetException)14 IOException (java.io.IOException)10 Result (io.cdap.cdap.api.dataset.table.Result)8 Row (io.cdap.cdap.api.dataset.table.Row)8 Scanner (io.cdap.cdap.api.dataset.table.Scanner)6 RecordScanner (io.cdap.cdap.api.data.batch.RecordScanner)4 NavigableMap (java.util.NavigableMap)4 PartitionAlreadyExistsException (io.cdap.cdap.api.dataset.lib.PartitionAlreadyExistsException)2 Get (io.cdap.cdap.api.dataset.table.Get)2 FuzzyRowFilter (io.cdap.cdap.data2.dataset2.lib.table.FuzzyRowFilter)2 ScanBuilder (io.cdap.cdap.data2.util.hbase.ScanBuilder)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 ConcurrentSkipListMap (java.util.concurrent.ConcurrentSkipListMap)2 Get (org.apache.hadoop.hbase.client.Get)2 Result (org.apache.hadoop.hbase.client.Result)2 ResultScanner (org.apache.hadoop.hbase.client.ResultScanner)2 Location (org.apache.twill.filesystem.Location)2