use of com.pingcap.tikv.predicates.IndexRange in project tispark by pingcap.
the class IndexStatistics method getRowCount.
public double getRowCount(List<IndexRange> indexRanges) {
double rowCount = 0.0;
for (IndexRange ir : indexRanges) {
StatisticsKeyRangeBuilder builder = new StatisticsKeyRangeBuilder(ir);
Pair<Key, Key> range = builder.compute();
// TODO: Implement CMSketch point query
// if (cmSketch != null) {
// rowCount += cmSketch.queryBytes(convertedKey.getBytes());
// } else {
// rowCount += histogram.betweenRowCount(convertedKey, convertedNext);
// }
rowCount += histogram.betweenRowCount(range.first, range.second);
}
if (rowCount > histogram.totalRowCount()) {
rowCount = histogram.totalRowCount();
} else if (rowCount < 0) {
rowCount = 0;
}
return rowCount;
}
Aggregations