JingsongLi commented on code in PR #1041:
URL: https://github.com/apache/incubator-paimon/pull/1041#discussion_r1178682880
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/FlinkCatalog.java:
##########
@@ -330,17 +330,18 @@ private CatalogTableImpl toCatalogTable(Table table) {
TableSchema.Builder builder = TableSchema.builder();
// add columns
- List<RowType.RowField> rowFields =
toLogicalType(table.rowType()).getFields();
- int count = nonPhysicalColumnsCount(newOptions,
table.rowType().getFieldNames());
+ List<RowType.RowField> physicalRowFields =
toLogicalType(table.rowType()).getFields();
+ List<String> physicalColumns = table.rowType().getFieldNames();
+ int columnCount =
+ physicalRowFields.size() + nonPhysicalColumnsCount(newOptions,
physicalColumns);
int physicalColumnIndex = 0;
- for (int i = 0; i < rowFields.size() + count; i++) {
+ for (int i = 0; i < columnCount; i++) {
String optionalName = newOptions.get(compoundKey(SCHEMA, i, NAME));
// to check old style physical column option
- RowType.RowField field = rowFields.get(physicalColumnIndex);
- if (optionalName == null || optionalName.equals(field.getName())) {
- // build physical column from table row
+ if (optionalName == null ||
physicalColumns.contains(optionalName)) {
Review Comment:
Add case to non-physical column is the last field
--
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]