snuyanzin commented on code in PR #1920:
URL: https://github.com/apache/fluss/pull/1920#discussion_r2482156742
##########
fluss-client/src/main/java/org/apache/fluss/client/converter/ConverterCommons.java:
##########
@@ -67,15 +68,15 @@ private static Map<DataTypeRoot, Set<Class<?>>>
createSupportedTypes() {
static void validatePojoMatchesTable(PojoType<?> pojoType, RowType
tableSchema) {
Set<String> pojoNames = pojoType.getProperties().keySet();
- Set<String> tableNames = new HashSet<>(tableSchema.getFieldNames());
- if (!pojoNames.equals(tableNames)) {
+ List<String> fieldNames = tableSchema.getFieldNames();
+ if (!pojoNames.containsAll(fieldNames)) {
throw new IllegalArgumentException(
String.format(
"POJO fields %s must exactly match table schema
fields %s.",
- pojoNames, tableNames));
+ pojoNames, fieldNames));
}
for (int i = 0; i < tableSchema.getFieldCount(); i++) {
- String name = tableSchema.getFieldNames().get(i);
Review Comment:
Avoid calling it inside a loop since each call generates a new collection
https://github.com/apache/fluss/blob/84b06ac6ef18ea629106e77755bee4b1963edd55/fluss-common/src/main/java/org/apache/fluss/types/RowType.java#L66-L68
--
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]