private void checkIfCacheCanEvict(int rowIdx, PTFPartition p, boolean willScanFwd) {
    BoundaryCache cache = p.getBoundaryCache();
    if (cache == null) {
      return;
    }
    Map.Entry<Integer, Object> floorEntry = cache.floorEntry(rowIdx);
    if (floorEntry != null) {
      floorEntry = cache.floorEntry(floorEntry.getKey() - 1);
      if (floorEntry != null) {
        if (willScanFwd) {
          cache.evictThisAndAllBefore(floorEntry.getKey());
        } else {
          floorEntry = cache.floorEntry(floorEntry.getKey() - 1);
          if (floorEntry != null) {
            cache.evictThisAndAllBefore(floorEntry.getKey());
          }
        }
      }
    }
  }
Retrieves the range for rowIdx, then removes all previous range entries before it.
@param rowIdx row index.
@param p partition.
@param willScanFwd false: removal is started only from the previous previous range.
ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/ValueBoundaryScanner.java