Search in sources :

Example 51 with KeyRange

use of org.apache.phoenix.query.KeyRange in project phoenix by apache.

the class ExplainTable method explainSkipScan.

private boolean explainSkipScan(StringBuilder buf) {
    ScanRanges scanRanges = context.getScanRanges();
    if (scanRanges.isPointLookup()) {
        int keyCount = scanRanges.getPointLookupCount();
        buf.append("POINT LOOKUP ON " + keyCount + " KEY" + (keyCount > 1 ? "S " : " "));
    } else if (scanRanges.useSkipScanFilter()) {
        buf.append("SKIP SCAN ");
        int count = 1;
        boolean hasRanges = false;
        int nSlots = scanRanges.getBoundSlotCount();
        for (int i = 0; i < nSlots; i++) {
            List<KeyRange> ranges = scanRanges.getRanges().get(i);
            count *= ranges.size();
            for (KeyRange range : ranges) {
                hasRanges |= !range.isSingleKey();
            }
        }
        buf.append("ON ");
        buf.append(count);
        buf.append(hasRanges ? " RANGE" : " KEY");
        buf.append(count > 1 ? "S " : " ");
    } else {
        buf.append("RANGE SCAN ");
    }
    return scanRanges.useSkipScanFilter();
}
Also used : KeyRange(org.apache.phoenix.query.KeyRange) List(java.util.List) ScanRanges(org.apache.phoenix.compile.ScanRanges) Hint(org.apache.phoenix.parse.HintNode.Hint)

Aggregations

KeyRange (org.apache.phoenix.query.KeyRange)51 Test (org.junit.Test)23 Connection (java.sql.Connection)16 ResultSet (java.sql.ResultSet)14 PreparedStatement (java.sql.PreparedStatement)9 ArrayList (java.util.ArrayList)9 List (java.util.List)8 Properties (java.util.Properties)7 Scan (org.apache.hadoop.hbase.client.Scan)7 ScanRanges (org.apache.phoenix.compile.ScanRanges)6 BigDecimal (java.math.BigDecimal)5 PhoenixConnection (org.apache.phoenix.jdbc.PhoenixConnection)5 KeyPart (org.apache.phoenix.compile.KeyPart)4 QueryPlan (org.apache.phoenix.compile.QueryPlan)4 PhoenixStatement (org.apache.phoenix.jdbc.PhoenixStatement)4 Field (org.apache.phoenix.schema.ValueSchema.Field)4 KeyValue (org.apache.hadoop.hbase.KeyValue)3 SkipScanFilter (org.apache.phoenix.filter.SkipScanFilter)3 IOException (java.io.IOException)2 Statement (java.sql.Statement)2