sqd commented on code in PR #17618:
URL: https://github.com/apache/iceberg/pull/17618#discussion_r3776779083
##########
flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicRecordProcessor.java:
##########
@@ -233,8 +234,11 @@ public void close() {
*/
@VisibleForTesting
static boolean isForwardEligible(DynamicRecord data) {
+ Set<String> equalityFields = data.equalityFields();
+ // Checks identifier field ids directly rather than resolving equality
field names, which would
+ // allocate per record.
return data.distributionMode() == null
- && DynamicSinkUtil.resolveEqualityFieldNames(data.equalityFields(),
data.schema())
- .isEmpty();
+ && (equalityFields == null || equalityFields.isEmpty())
+ && data.schema().identifierFieldIds().isEmpty();
Review Comment:
More concretely, little to no difference between memoization and handcoded
fast return path
| variant | idFields | result |
|---|---|---|
| upstream (`namesPerRecord`) | 0 | 36.18 ns, 352 B/op |
| upstream | 2 | 74.01 ns, 496 B/op |
| commit 1 (ids only) | 0 | 3.56 ns, 0 B |
| commit 1 | 2 | 3.57 ns, 0 B |
| commit 2 (memoized) | 0 | 3.33 ns, 0 B |
| commit 2 | 2 | 3.25 ns, 0 B |
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]