ParyshevSergey commented on code in PR #30215:
URL: https://github.com/apache/flink/pull/30215#discussion_r4764798300
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/join/stream/asyncprocessing/state/JoinRecordAsyncStateViews.java:
##########
@@ -107,13 +104,12 @@ public StateFuture<List<OuterRecord>> findMatchedRecords(
.asyncValue()
.thenApply(
v -> {
- reusedList.clear();
- if (v != null) {
- if (condition.apply(v)) {
- reusedList.add(new OuterRecord(v));
- }
+ // the result records always not more than 1
+ List<OuterRecord> matchedRecords = new
ArrayList<>(1);
Review Comment:
Avoid allocating a list and backing array on every unique-key lookup. new
ArrayList<>(1) allocates both even when the key is absent or the predicate
rejects the row. The join only reads the result. Returning
Collections.emptyList() for a miss and Collections.singletonList(...) for a
match preserves isolation and avoids the backing array. The outer view can also
return the list directly from thenApply.
--
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]