Mrart commented on code in PR #4081:
URL: https://github.com/apache/flink-cdc/pull/4081#discussion_r2284234851
##########
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-paimon/src/main/java/org/apache/flink/cdc/connectors/paimon/sink/v2/PaimonWriterHelper.java:
##########
@@ -61,6 +73,33 @@ public static List<RecordData.FieldGetter>
createFieldGetters(Schema schema, Zon
return fieldGetters;
}
+ /**
+ * Check if the columns of upstream schema is the same as the physical
schema.
+ *
+ * <p>Note: Default value of column was ignored as it has no influence in
{@link
+ * #createFieldGetter(DataType, int, ZoneId)}.
+ */
+ public static Boolean sameColumnsIgnoreCommentAndDefaultValue(
+ Schema upstreamSchema, Schema physicalSchema) {
+ List<Column> upstreamColumns = upstreamSchema.getColumns();
+ List<Column> physicalColumns = physicalSchema.getColumns();
+ if (upstreamColumns.size() != physicalColumns.size()) {
+ return false;
+ }
+ for (int i = 0; i < physicalColumns.size(); i++) {
+ Column upstreamColumn = upstreamColumns.get(i);
+ Column physicalColumn = physicalColumns.get(i);
+ // Case sensitive.
+ if (!upstreamColumn.getName().equals(physicalColumn.getName())) {
+ return false;
Review Comment:
The two if can merge.
--
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]