druid/codestyle
Gian Merlino 529b983ad0
GroupBy: Reduce allocations by reusing entry and key holders. (#12474)
* GroupBy: Reduce allocations by reusing entry and key holders.

Two main changes:

1) Reuse Entry objects returned by various implementations of
   Grouper.iterator.

2) Reuse key objects contained within those Entry objects.

This is allowed by the contract, which states that entries must be
processed and immediately discarded. However, not all call sites
respected this, so this patch also updates those call sites.

One particularly sneaky way that the old code retained entries too long
is due to Guava's MergingIterator and CombiningIterator. Internally,
these both advance to the next value prior to returning the current
value. So, this patch addresses that in two ways:

1) For merging, we have our own implementation MergeIterator already,
   although it had the same problem. So, this patch updates our
   implementation to return the current item prior to advancing to the
   next item. It also adds a forbidden-api entry to ensure that this
   safer implementation is used instead of Guava's.

2) For combining, we address the problem in a different way: by copying
   the key when creating the new, combined entry.

* Attempt to fix test.

* Remove unused import.
2022-04-28 23:21:13 -07:00
..
LICENSE.txt Update license headers. (#5976) 2018-07-11 09:55:18 -07:00
checkstyle-suppressions.xml handle timestamps of complex types when parsing protobuf messages (#11293) 2021-06-07 15:19:39 +05:30
checkstyle.xml Add Checkstyle check for String literal equality (#8386) 2019-08-28 17:53:42 +03:00
druid-forbidden-apis.txt GroupBy: Reduce allocations by reusing entry and key holders. (#12474) 2022-04-28 23:21:13 -07:00
guava16-forbidden-apis.txt Forbiddenapis: Split the guava16-only signatures file from main signatures file (#12170) 2022-01-19 17:50:28 -08:00
joda-time-forbidden-apis.txt Introduce SegmentId class (#6370) 2019-01-21 11:11:10 -08:00
pmd-ruleset.xml Remove use of deprecated PMD ruleset (#12044) 2021-12-09 13:04:27 -08:00
spotbugs-exclude.xml Add syntax support for PARTITIONED BY/CLUSTERED BY in INSERT queries (#12163) 2022-02-08 16:23:15 +05:30