pvary commented on code in PR #18541:
URL: https://github.com/apache/iceberg/pull/18541#discussion_r4295846188
##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/TableMetadataCache.java:
##########
@@ -151,7 +151,7 @@ private ResolvedSchemaInfo schema(
// and a new schema. Performance is paramount as this code is on the hot
path. Every other
// way for comparing 2 schemas were performing worse than the
// {@link CompareByNameVisitor#visit(Schema, Schema, boolean)}, so
caching was useless.
- ResolvedSchemaInfo lastResult = cached.inputSchemas.get(input);
+ ResolvedSchemaInfo lastResult = cachedSchema(identifier, cached, input,
allowRefresh);
if (lastResult != null) {
Review Comment:
Could this work?
```suggestion
if (lastResult != null
&& (lastResult != NOT_FOUND || !needsRefresh(identifier, cached,
allowRefresh))) {
return lastResult;
}
```
Or inline your code:
```suggestion
if (lastResult == NOT_FOUND && needsRefresh(identifier, cached,
allowRefresh)) {
// The table may have been evolved by DynamicTableUpdateOperator
since NOT_FOUND was cached
refreshTable(identifier);
return schema(identifier, input, false);
} else if (lastResult != null) {
return lastResult;
}
```
--
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]