Example #1
0
  private ScanRanges(
      RowKeySchema schema,
      int[] slotSpan,
      List<List<KeyRange>> ranges,
      KeyRange scanRange,
      KeyRange minMaxRange,
      boolean useSkipScanFilter,
      boolean isPointLookup,
      Integer bucketNum,
      TimeRange rowTimestampRange) {
    this.isPointLookup = isPointLookup;
    this.isSalted = bucketNum != null;
    this.useSkipScanFilter = useSkipScanFilter;
    this.scanRange = scanRange;
    this.minMaxRange = minMaxRange;
    this.rowTimestampRange = rowTimestampRange;

    // Only blow out the bucket values if we're using the skip scan. We need all the
    // bucket values in this case because we use intersect against a key that may have
    // any of the possible bucket values. Otherwise, we can pretty easily ignore the
    // bucket values.
    if (useSkipScanFilter && isSalted && !isPointLookup) {
      ranges.set(0, SaltingUtil.generateAllSaltingRanges(bucketNum));
    }
    this.ranges = ImmutableList.copyOf(ranges);
    this.slotSpan = slotSpan;
    this.schema = schema;
    if (schema != null && !ranges.isEmpty()) {
      if (!this.useSkipScanFilter) {
        int boundSlotCount = this.getBoundSlotCount();
        ranges = ranges.subList(0, boundSlotCount);
        slotSpan = Arrays.copyOf(slotSpan, boundSlotCount);
      }
      this.filter = new SkipScanFilter(ranges, slotSpan, this.schema);
    }
  }