@SuppressWarnings("unchecked")
  public PTFValueCache init(int length) {
    cache = new TreeMap[length];
    for (int i = 0; i < length; i++) {
      cache[i] = new TreeMap<>(new Comparator<Range>() {
        @Override
        public int compare(Range r1, Range r2) {
          return r1.compareTo(r2);
        }
      });
    }
    maxSizePerEvaluator = (int) Math.ceil(maxSize / length);
    LOG.info("PTFValueCache is initialized to {} evaluators, maxSize: {} ({} entries / evaluator)",
        length, maxSize, maxSizePerEvaluator);
    return this;
  }
Cache for storing aggregated values that were already calculated within a partition - used for
PTF functions. This cache can lead to performance improvement when PTFPartition would have to
calculate a particular aggregation for the same range again and again. The caching relies on the
fact that evaluators are deterministic in a sense that they'll give the same result for the same
range in the same partition (no matter for which row is the current target).
ql/src/java/org/apache/hadoop/hive/ql/exec/PTFValueCache.java