コード例 #1
0
ファイル: HdfsScanNode.java プロジェクト: tomdz/impala
  /** Compute file paths and key values based on key ranges. */
  @Override
  public void finalize(Analyzer analyzer) throws InternalException {
    Preconditions.checkNotNull(keyRanges);

    for (HdfsPartition p : tbl.getPartitions()) {
      if (p.getFileDescriptors().size() == 0) {
        // No point scanning partitions that have no data
        continue;
      }

      Preconditions.checkState(p.getPartitionValues().size() == tbl.getNumClusteringCols());
      // check partition key values against key ranges, if set
      Preconditions.checkState(keyRanges.size() == p.getPartitionValues().size());
      boolean matchingPartition = true;
      for (int i = 0; i < keyRanges.size(); ++i) {
        ValueRange keyRange = keyRanges.get(i);
        if (keyRange != null && !keyRange.isInRange(analyzer, p.getPartitionValues().get(i))) {
          matchingPartition = false;
          break;
        }
      }
      if (!matchingPartition) {
        // skip this partition, it's outside the key ranges
        continue;
      }
      // HdfsPartition is immutable, so it's ok to copy by reference
      partitions.add(p);
    }
  }