Class PaimonWriterHelper
- java.lang.Object
-
- org.apache.flink.cdc.connectors.paimon.sink.v2.PaimonWriterHelper
-
public class PaimonWriterHelper extends Object
A helper class to deduce Schema of paimon table forBucketAssignOperator, and create FieldGetter and GenericRow forPaimonWriter.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPaimonWriterHelper.BinaryFieldDataGetterA helper class forPaimonWriterto create FieldGetter and GenericRow.
-
Constructor Summary
Constructors Constructor Description PaimonWriterHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<org.apache.paimon.data.GenericRow>convertEventToFullGenericRows(DataChangeEvent dataChangeEvent, List<RecordData.FieldGetter> fieldGetters, boolean hasPrimaryKey)static org.apache.paimon.data.GenericRowconvertEventToGenericRow(DataChangeEvent dataChangeEvent, List<RecordData.FieldGetter> fieldGetters)static List<RecordData.FieldGetter>createFieldGetters(Schema schema, java.time.ZoneId zoneId)create a list ofRecordData.FieldGetterforPaimonWriter.static List<RecordData.FieldGetter>createFieldGetters(Schema schema, java.time.ZoneId zoneId, BlobWriteContext blobWriteContext)create a list ofRecordData.FieldGetterforPaimonWriterwith BLOB support.static SchemadeduceSchemaForPaimonTable(org.apache.paimon.table.Table table)DeduceSchemafor aTable.static org.apache.paimon.catalog.IdentifieridentifierFromTableId(TableId tableId)static BooleansameColumnsIgnoreCommentAndDefaultValue(Schema upstreamSchema, Schema physicalSchema)Check if the columns of upstream schema is the same as the physical schema.
-
-
-
Method Detail
-
createFieldGetters
public static List<RecordData.FieldGetter> createFieldGetters(Schema schema, java.time.ZoneId zoneId)
create a list ofRecordData.FieldGetterforPaimonWriter.
-
createFieldGetters
public static List<RecordData.FieldGetter> createFieldGetters(Schema schema, java.time.ZoneId zoneId, @Nullable BlobWriteContext blobWriteContext)
create a list ofRecordData.FieldGetterforPaimonWriterwith BLOB support.- Parameters:
schema- The CDC schema containing column definitions.zoneId- The timezone for timestamp conversion.blobWriteContext- Optional context for BLOB field handling.- Returns:
- List of FieldGetter for converting CDC data to Paimon data.
-
sameColumnsIgnoreCommentAndDefaultValue
public static Boolean sameColumnsIgnoreCommentAndDefaultValue(Schema upstreamSchema, Schema physicalSchema)
Check if the columns of upstream schema is the same as the physical schema.Note: Default value of column was ignored as it has no influence in
createFieldGetter(DataType, int, ZoneId).
-
convertEventToGenericRow
public static org.apache.paimon.data.GenericRow convertEventToGenericRow(DataChangeEvent dataChangeEvent, List<RecordData.FieldGetter> fieldGetters)
-
convertEventToFullGenericRows
public static List<org.apache.paimon.data.GenericRow> convertEventToFullGenericRows(DataChangeEvent dataChangeEvent, List<RecordData.FieldGetter> fieldGetters, boolean hasPrimaryKey)
-
deduceSchemaForPaimonTable
public static Schema deduceSchemaForPaimonTable(org.apache.paimon.table.Table table)
-
identifierFromTableId
public static org.apache.paimon.catalog.Identifier identifierFromTableId(TableId tableId)
-
-