Skip to content

Commit 69d03e1

Browse files
authored
[client][hotfix] Invoke RowType#getFieldNames only once in ConverterCommons (#1920)
1 parent dfc274c commit 69d03e1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fluss-client/src/main/java/org/apache/fluss/client/converter/ConverterCommons.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.Arrays;
2727
import java.util.EnumMap;
2828
import java.util.HashSet;
29+
import java.util.List;
2930
import java.util.Map;
3031
import java.util.Set;
3132

@@ -67,15 +68,15 @@ private static Map<DataTypeRoot, Set<Class<?>>> createSupportedTypes() {
6768

6869
static void validatePojoMatchesTable(PojoType<?> pojoType, RowType tableSchema) {
6970
Set<String> pojoNames = pojoType.getProperties().keySet();
70-
Set<String> tableNames = new HashSet<>(tableSchema.getFieldNames());
71-
if (!pojoNames.equals(tableNames)) {
71+
List<String> fieldNames = tableSchema.getFieldNames();
72+
if (!pojoNames.containsAll(fieldNames)) {
7273
throw new IllegalArgumentException(
7374
String.format(
7475
"POJO fields %s must exactly match table schema fields %s.",
75-
pojoNames, tableNames));
76+
pojoNames, fieldNames));
7677
}
7778
for (int i = 0; i < tableSchema.getFieldCount(); i++) {
78-
String name = tableSchema.getFieldNames().get(i);
79+
String name = fieldNames.get(i);
7980
DataType dt = tableSchema.getTypeAt(i);
8081
PojoType.Property prop = pojoType.getProperty(name);
8182
validateCompatibility(dt, prop);

0 commit comments

Comments
 (0)