amoro-format-mixed/amoro-mixed-flink/v1.15/amoro-mixed-flink-1.15/src/main/java/org/apache/amoro/flink/table/MixedFormatDynamicSource.java [325:356]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  protected Schema getProjectedSchema() {
    Schema mixedFormatTableSchema = mixedTable.schema();
    Schema projectedSchema;
    if (projectFields == null) {
      LOG.info("The projected fields is null.");
      projectedSchema = mixedTable.schema();
    } else {
      if (mixedTable.isUnkeyedTable()) {
        throw new UnsupportedOperationException("Unkeyed table doesn't support lookup join.");
      }
      List<String> primaryKeys = mixedTable.asKeyedTable().primaryKeySpec().fieldNames();
      List<Integer> projectFieldList =
          Arrays.stream(projectFields).boxed().collect(Collectors.toList());
      List<Types.NestedField> columns = mixedFormatTableSchema.columns();
      for (int i = 0; i < mixedFormatTableSchema.columns().size(); i++) {
        if (primaryKeys.contains(columns.get(i).name()) && !projectFieldList.contains(i)) {
          projectFieldList.add(i);
          LOG.info(
              "Add identifier field {} to projected schema, due to this field is mismatched.",
              columns.get(i).name());
        }
      }

      List<String> projectedFieldNames =
          projectFieldList.stream()
              .map(index -> columns.get(index).name())
              .collect(Collectors.toList());
      projectedSchema = SchemaUtil.selectInOrder(mixedFormatTableSchema, projectedFieldNames);
      LOG.info("The projected schema {}.\n table schema {}.", projectedSchema, mixedTable.schema());
    }
    return projectedSchema;
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/main/java/org/apache/amoro/flink/table/MixedFormatDynamicSource.java [325:356]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  protected Schema getProjectedSchema() {
    Schema mixedFormatTableSchema = mixedTable.schema();
    Schema projectedSchema;
    if (projectFields == null) {
      LOG.info("The projected fields is null.");
      projectedSchema = mixedTable.schema();
    } else {
      if (mixedTable.isUnkeyedTable()) {
        throw new UnsupportedOperationException("Unkeyed table doesn't support lookup join.");
      }
      List<String> primaryKeys = mixedTable.asKeyedTable().primaryKeySpec().fieldNames();
      List<Integer> projectFieldList =
          Arrays.stream(projectFields).boxed().collect(Collectors.toList());
      List<Types.NestedField> columns = mixedFormatTableSchema.columns();
      for (int i = 0; i < mixedFormatTableSchema.columns().size(); i++) {
        if (primaryKeys.contains(columns.get(i).name()) && !projectFieldList.contains(i)) {
          projectFieldList.add(i);
          LOG.info(
              "Add identifier field {} to projected schema, due to this field is mismatched.",
              columns.get(i).name());
        }
      }

      List<String> projectedFieldNames =
          projectFieldList.stream()
              .map(index -> columns.get(index).name())
              .collect(Collectors.toList());
      projectedSchema = SchemaUtil.selectInOrder(mixedFormatTableSchema, projectedFieldNames);
      LOG.info("The projected schema {}.\n table schema {}.", projectedSchema, mixedTable.schema());
    }
    return projectedSchema;
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



