Search in sources :

Example 1 with IndexScanKeyRangeBuilder

use of com.pingcap.tikv.key.IndexScanKeyRangeBuilder in project tispark by pingcap.

the class TiKVScanAnalyzer method buildIndexScanKeyRangeWithIds.

@VisibleForTesting
private Map<Long, List<KeyRange>> buildIndexScanKeyRangeWithIds(List<Long> ids, TiIndexInfo index, List<IndexRange> indexRanges) {
    Map<Long, List<KeyRange>> idRanges = new HashMap<>();
    for (long id : ids) {
        List<KeyRange> ranges = new ArrayList<>(indexRanges.size());
        for (IndexRange ir : indexRanges) {
            IndexScanKeyRangeBuilder indexScanKeyRangeBuilder = new IndexScanKeyRangeBuilder(id, index, ir);
            ranges.add(indexScanKeyRangeBuilder.compute());
        }
        idRanges.put(id, ranges);
    }
    return idRanges;
}
Also used : HashMap(java.util.HashMap) KeyRange(org.tikv.kvproto.Coprocessor.KeyRange) ArrayList(java.util.ArrayList) IndexScanKeyRangeBuilder(com.pingcap.tikv.key.IndexScanKeyRangeBuilder) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ImmutableList (com.google.common.collect.ImmutableList)1 IndexScanKeyRangeBuilder (com.pingcap.tikv.key.IndexScanKeyRangeBuilder)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 KeyRange (org.tikv.kvproto.Coprocessor.KeyRange)1