yuxiqian commented on code in PR #4391:
URL: https://github.com/apache/flink-cdc/pull/4391#discussion_r3264272674
##########
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-paimon/src/main/java/org/apache/flink/cdc/connectors/paimon/sink/v2/PaimonRecordEventSerializer.java:
##########
@@ -52,6 +53,23 @@ public PaimonRecordEventSerializer(ZoneId zoneId) {
this.zoneId = zoneId;
}
+ /**
+ * Update the BlobWriteContext for a specific table.
+ *
+ * <p>This is called by PaimonWriter when it has access to the Paimon
table configuration. The
+ * field getters will be recreated with the new BlobWriteContext to
properly convert VARBINARY
+ * fields to BLOB type.
+ *
+ * @param tableId The table identifier.
+ * @param blobWriteContext The BlobWriteContext from the Paimon table.
Review Comment:
Some useless comments might should be simplified.
##########
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-paimon/src/main/java/org/apache/flink/cdc/connectors/paimon/sink/v2/TableSchemaInfo.java:
##########
@@ -28,16 +31,50 @@ public class TableSchemaInfo {
private final Schema schema;
- private final List<RecordData.FieldGetter> fieldGetters;
+ private List<RecordData.FieldGetter> fieldGetters;
private final boolean hasPrimaryKey;
+ @Nullable private BlobWriteContext blobWriteContext;
Review Comment:
Considering the semantic of `TableSchemaInfo`, it's odd to make it mutable.
Better re-construct it from the outside if necessary.
##########
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-paimon/src/test/java/org/apache/flink/cdc/connectors/paimon/sink/testsource/AppendOnlyTableDataSourceFactory.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.cdc.connectors.paimon.sink.testsource;
+
+import org.apache.flink.cdc.common.annotation.Internal;
+import org.apache.flink.cdc.common.configuration.ConfigOption;
+import org.apache.flink.cdc.common.factories.DataSourceFactory;
+import org.apache.flink.cdc.common.factories.Factory;
+import org.apache.flink.cdc.common.source.DataSource;
+import org.apache.flink.cdc.common.source.EventSourceProvider;
+import org.apache.flink.cdc.common.source.FlinkSourceFunctionProvider;
+import org.apache.flink.cdc.common.source.MetadataAccessor;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/** A source {@link Factory} to create {@link AppendOnlyTableDataSource}. */
+@Internal
+public class AppendOnlyTableDataSourceFactory implements DataSourceFactory {
Review Comment:
We may use values source + CUSTOM_SOURCE_EVENTS for testing.
##########
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-paimon/src/main/java/org/apache/flink/cdc/connectors/paimon/sink/v2/TableSchemaInfo.java:
##########
@@ -28,16 +31,50 @@ public class TableSchemaInfo {
private final Schema schema;
- private final List<RecordData.FieldGetter> fieldGetters;
+ private List<RecordData.FieldGetter> fieldGetters;
private final boolean hasPrimaryKey;
+ @Nullable private BlobWriteContext blobWriteContext;
+
public TableSchemaInfo(Schema schema, ZoneId zoneId) {
+ this(schema, zoneId, null);
+ }
Review Comment:
Is it possible to remove this override, and enforce `BlobWriteContext` when
constructing `TableSchemaInfo`?
--
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]