bvolpato commented on code in PR #41741:
URL: https://github.com/apache/beam/pull/41741#discussion_r4746324776
##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/PrecombineGroupingTable.java:
##########
@@ -126,11 +129,25 @@ public interface SizeEstimator {
private final PipelineOptions options;
private final SizeEstimator sizer;
private final Cache<Key, PrecombineGroupingTable<K, InputT, AccumT>> cache;
- private final LinkedHashMap<GroupingTableKey, GroupingTableEntry> lruMap;
+ private final LinkedHashMap<Object, GroupingTableEntry<K, InputT, AccumT>>
lruMap;
Review Comment:
Yes, each table uses one key representation for its lifetime. In 977dbb0f72
the constructor picks one of two implementations, each with its own typed map
and `put` path. The windowed map takes only `WindowedGroupingTableKey`. The
global map uses `Object` because `Coder.structuralValue()` can return a
different type from `K`. Both share the weight accounting and eviction logic.
I added a test that combines distinct byte arrays with equal contents in
both modes. All 365 harness tests passed. In a short JMH run with uniform and
unique keys, allocations per operation stayed within 0.04% of the previous
commit in both modes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]