refactor: DH-22466: Remove trove Dependencies (Phase 1)#7960
Open
cpwright wants to merge 16 commits intodeephaven:mainfrom
Open
refactor: DH-22466: Remove trove Dependencies (Phase 1)#7960cpwright wants to merge 16 commits intodeephaven:mainfrom
cpwright wants to merge 16 commits intodeephaven:mainfrom
Conversation
Contributor
No docs changes detected for b1d8946 |
82ac1ad to
a80e442
Compare
Replace TLongArrayList with fastutil's LongArrayList in PerfStats (the only Trove-using file in this module) and swap libs.trove for libs.dsi.fastutil. samples.sort() becomes sort(null) since fastutil's LongArrayList.sort takes a LongComparator (null = natural order). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace TObjectLongMap/TObjectLongHashMap with fastutil's Object2LongMap/Object2LongOpenHashMap in RDMModelFarm. The TObjectLongHashMap(initialCapacity, loadFactor, noEntryValue) constructor becomes new Object2LongOpenHashMap(initialCapacity, loadFactor) plus a defaultReturnValue(NO_ENTRY_VALUE) call, factored into a small newKeyIndexMap() helper. forEachEntry becomes Object2LongMaps.fastForEach over the entry set, get becomes getLong, and remove inside the iteration becomes removeLong. ModelFarm previously got Trove transitively from Configuration; add an explicit implementation libs.dsi.fastutil. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace TIntObjectMap/TIntObjectHashMap with Int2ObjectMap/ Int2ObjectOpenHashMap in GenUtils' cachedIndents map and swap libs.trove for libs.dsi.fastutil. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace TIntObjectHashMap with Int2ObjectOpenHashMap in DeephavenTimeZoneParser's ZONE_ID_MAP and swap libs.trove for libs.dsi.fastutil. The migrated class uses only get/put with identical semantics (null for missing key on both Trove and fastutil for object-valued maps). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace TIntSet/TIntHashSet/TObjectIntHashMap with IntSet/ IntOpenHashSet/Object2IntOpenHashMap in PropertyFile (the only Trove-using file in Configuration), including the fully-qualified gnu.trove.set.hash.TIntHashSet construction at line 648. None of the four Trove-typed accessor methods has any caller in the repository, so the public-API return-type change is safe. Drop api libs.trove from Configuration/build.gradle and replace with api libs.dsi.fastutil. The previously-transitive Trove dependency was relied on by Util, extensions/barrage, extensions/parquet/table, and extensions/iceberg/s3 (test only); each now declares its own implementation/testImplementation libs.trove. engine/function and engine/tuple's api leaks of Trove/fastutil cover the rest of engine/* until those modules are migrated themselves. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace TLongArrayList with fastutil's LongArrayList in IcebergToolsTest (the only Trove-using file in the module) and swap testImplementation libs.trove for libs.dsi.fastutil. Pure rename — add/size/contains all behave identically. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace TObjectIntHashMap with Object2IntMap/Object2IntOpenHashMap in ModifiedColumnSet's idMap, and translate the Trove "no-entry value" semantics to fastutil's defaultReturnValue() (Trove constructor took the sentinel as its third arg; fastutil sets it via a setter on the impl, so we instantiate the impl, call defaultReturnValue(-1), then store into the Object2IntMap field). The previous Constants.DEFAULT_LOAD_FACTOR (0.5f) is preserved as a literal rather than switching to fastutil's 0.75f default. get() is replaced with getInt() to avoid Integer boxing now that the field type is the Object2IntMap interface. Swap implementation libs.trove for libs.dsi.fastutil. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace TIntArrayList with fastutil's IntArrayList in UniqueIntArrayGenerator and FromUniqueIntArrayGenerator (the only two Trove-using files in this module). value.toArray() becomes value.toIntArray() since fastutil's IntArrayList.toArray() inherits the Object[]-returning AbstractCollection method. libs.trove is left in place because engine/test-utils transitively imports classes (e.g. ChunkColumnSource from engine/table) whose public API still mentions Trove types. That dep can be dropped once engine/table is migrated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
BarrageMessageWriterImpl: replace TIntArrayList with fastutil's IntArrayList; the forEachDescending(procedure) call (no fastutil analog) becomes a manual reverse-index for-loop using getInt. BarrageTable: the processedStep field changes from TLongList/TLongLinkedList to LongArrayFIFOQueue, which is fastutil's purpose-built primitive FIFO queue and matches the original usage (add at end, remove from front). add becomes enqueue, remove(0) becomes dequeueLong. The field is private and has no external consumers, so the type change is contained. libs.trove is left in place because BarrageTable transitively references engine/table classes (e.g. WritableRowRedirection) whose signatures still mention Trove types; that dep can be dropped once engine/table is migrated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace TObjectLongHashMap with fastutil's Object2LongOpenHashMap in CategoryDataSeriesKernel and CategoryErrorBarDataSeriesKernel, and TLongObjectHashMap with Long2ObjectOpenHashMap in IndexableDataInstant. The two TObjectLongHashMap fields were constructed with a -1 no-entry value via Trove's three-arg constructor; the equivalent on fastutil is a separate defaultReturnValue(-1) call, factored into a tiny newCatIndex() helper. catIndex.get becomes getLong to avoid Long boxing. Plot does not declare libs.trove or libs.dsi.fastutil directly; fastutil is now visible via engine/tuple's api leak (api libs.dsi.fastutil), and the residual Trove transitive route via engine/function's api libs.trove keeps the rest of the engine classpath compiling. No build.gradle change is needed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… to fastutil
ArrowFlightUtil: replace TByteObjectHashMap with fastutil's
Byte2ObjectOpenHashMap for the requestHandlerFactories map; pure
rename, identical get/put semantics.
CharacterChunkedStats: replace TCharLongMap/TCharLongHashMap and
TCharSet/TCharHashSet with Char2LongOpenHashMap and CharOpenHashSet.
The Trove adjustOrPutValue(val, 1, 1) call (returns *new* value,
returns 1 iff key was absent or had value 0) becomes
addTo(val, 1) (returns *previous* value, returns 0 iff key was
absent or had value 0); the surrounding count-only-grows invariant
makes the two equivalent for this code. forEachEntry becomes
Char2LongMaps.fastForEach over the entry set.
ObjectChunkedStats is auto-generated from CharacterChunkedStats by
ReplicateColumnStats.fixupObjectChunk. Update that fixup to drop
the now-irrelevant TObjectSet/TObjectHashSet → java Set/HashSet
substitutions, fix the package case that charToObject mangles
("it.unimi.dsi.fastutil.Objects." → ".objects."), parameterize the
generated ObjectOpenHashSet, and rewrite the add_entries region to
use Object2LongMaps.fastForEach. Regenerated via
:replication-static:replicateColumnStats.
server does not declare libs.trove or libs.dsi.fastutil directly;
fastutil is now visible via the engine/api transitive route.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ParquetMetadataFileLayout: TIntList/TIntArrayList → IntList/ IntArrayList. entry.getValue().toArray() becomes toIntArray() since fastutil's IntList.toArray() inherits the Object[]-returning Collection method. StringDictionary: TObjectIntHashMap with NO_ENTRY_VALUE = -1 becomes Object2IntMap (interface) backed by Object2IntOpenHashMap with defaultReturnValue(-1). Trove Constants.DEFAULT_CAPACITY (10) and Constants.DEFAULT_LOAD_FACTOR (0.5f) are preserved as literals rather than switching to fastutil's 16/0.75 defaults. get becomes getInt; getNoEntryValue becomes defaultReturnValue. ChunkDictionary: TObjectIntMap → Object2IntMap, TObjectIntHashMap → Object2IntOpenHashMap, get → getInt. Both Trove and fastutil default the no-entry value to 0 with the no-arg setter, so rget's "missing → 0" semantics are preserved. Swap implementation libs.trove for libs.dsi.fastutil in the module build. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
KafkaTools.partitionToOffsetFromParallelArrays: TIntLongHashMap becomes Int2LongOpenHashMap. The Trove four-arg constructor's no-key-value parameter has no fastutil analog (fastutil doesn't reserve a key value); the no-entry-value KafkaIngester.DONT_SEEK moves to defaultReturnValue. The map::get method reference still resolves to a long-returning IntToLongFunction. KafkaIngester: TIntObjectHashMap → Int2ObjectOpenHashMap for the streamConsumers map; Trove's valueCollection() becomes fastutil's values(). MultiFieldChunkAdapter: TObjectIntMap/TObjectIntHashMap with the three-arg (cap, lf, noEntry) constructor becomes Object2IntOpenHashMap(cap, lf) plus defaultReturnValue(-1). get becomes getInt; getNoEntryValue becomes defaultReturnValue. Swap implementation libs.trove for libs.dsi.fastutil. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ReplicateHashTable's mixinOpenLine stack changes from TIntStack/TIntArrayStack to fastutil's IntStack interface backed by IntArrayList (fastutil has no dedicated primitive ArrayStack; IntArrayList implements IntStack and supplies the same FILO ops). pop() becomes popInt(); peek() becomes topInt(); push() is unchanged. Swap implementation libs.trove for libs.dsi.fastutil. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Update Basic.ftl, the Freemarker template that the build's
GenPrimitivesBasic task expands into Basic.java on every compile:
- Swap the three gnu.trove wildcard imports for the eight per-primitive
fastutil packages.
- THashSet<T> → ObjectOpenHashSet<T> in the two object-typed sites.
- T${pt.primitive?capitalize}{Set,HashSet,ArrayList} →
${pt.primitive?capitalize}{Set,OpenHashSet,ArrayList} in the
per-primitive blocks.
- orderedList.toArray() → orderedList.to${pt.primitive?capitalize}Array()
since fastutil's primitive ArrayList inherits the Object[]-returning
toArray from AbstractCollection.
build.gradle: drop api libs.trove and add implementation
libs.dsi.fastutil. Trove never appeared in Basic's public signature
(only in local variables), so api visibility was unnecessary; the
new fastutil dep is implementation only.
This was the last api libs.trove declaration in the project. The
only downstream module that lost the transitive route is
engine/table, which now declares its own implementation libs.trove
(it has 100+ Trove-using files of its own and was never going to
escape Trove via this commit anyway).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Swap gnu.trove.impl.PrimeFinder for io.deephaven.hash.PrimeFinder (from libs.deephaven.hash, already on the compile classpath of both Base and Util) in the four files that used it: Base/cache/KeyedObjectCache.java Base/cache/OpenAddressedCanonicalizationCache.java Util/datastructures/WeakIdentityHashSet.java Util/datastructures/hash/HashMapBase.java PrimeFinder.nextPrime(int) is the only API used and has identical semantics in both implementations, so this is a pure import swap. Existing user io.deephaven.engine.table.impl.by.HashedRunFinder already pulls from io.deephaven.hash.PrimeFinder; this commit brings the four remaining call sites into line. libs.trove is left in place on Base and Util because RetentionCache (Constants, TObjectIntCustomHashMap, IdentityHashingStrategy) and HashMapBase (TLongLongMap, TLongCollection, etc.) still reference other Trove types. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
a80e442 to
b1d8946
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.