protected Object computeValueUseCache(int r, PTFPartition p) throws HiveException {
    BoundaryCache cache = p.getBoundaryCache();

    Map.Entry<Integer, Object> floorEntry = null;
    Map.Entry<Integer, Object> ceilingEntry = null;

    if (cache != null) {
      floorEntry = cache.floorEntry(r);
      ceilingEntry = cache.ceilingEntry(r);
    }

    if (ceilingEntry != null && ceilingEntry.getKey().equals(r)){
      return ceilingEntry.getValue();
    }
    if (floorEntry != null && ceilingEntry != null) {
      return floorEntry.getValue();
    } else {
      return computeValue(p.getAt(r));
    }
  }
Uses cache to lookup row value. Computes it on the fly on cache miss.
@param r
@param p
@return row value.
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/ValueBoundaryScanner.java