Class PaimonMetadataApplier
- java.lang.Object
-
- org.apache.flink.cdc.connectors.paimon.sink.PaimonMetadataApplier
-
- All Implemented Interfaces:
Serializable,AutoCloseable,ExistingTableSchemaExpansionSupport,MetadataApplier
public class PaimonMetadataApplier extends Object implements MetadataApplier, ExistingTableSchemaExpansionSupport
AMetadataApplierthat applies metadata changes to Paimon. Support primary key table only.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PaimonMetadataApplier(org.apache.paimon.options.Options catalogOptions)PaimonMetadataApplier(org.apache.paimon.options.Options catalogOptions, Map<String,String> tableOptions, Map<TableId,List<String>> partitionMaps)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptsSchemaEvolutionType(SchemaChangeEventType schemaChangeEventType)Checks if this metadata applier should this event type.voidapplySchemaChange(SchemaChangeEvent schemaChangeEvent)Apply the givenSchemaChangeEventto external systems.voidclose()Closes the metadata applier and its underlying resources.Optional<Schema>getExistingTableSchema(TableId tableId)Returns the current schema of the target table, orOptional.empty()if the table does not exist.Optional<ExistingTableSchemaExpansionSupport>getExistingTableSchemaExpansionSupport()Returns optional support for safely expanding an existing target table schema.Set<SchemaChangeEventType>getSupportedSchemaEvolutionTypes()Checks what kind of schema change events downstream can handle.booleanisColumnNameCaseSensitive()Returns whether target column names are matched case-sensitively.DataTypenormalizeToTargetDataType(TableId tableId, String columnName, DataType pipelineDataType, Schema existingTargetSchema)Converts a pipeline type to the canonical CDC representation of the physical type that this applier will create in the existing target table.MetadataAppliersetAcceptedSchemaEvolutionTypes(Set<SchemaChangeEventType> schemaEvolutionTypes)Sets enabled schema evolution event types of current metadata applier.
-
-
-
Method Detail
-
setAcceptedSchemaEvolutionTypes
public MetadataApplier setAcceptedSchemaEvolutionTypes(Set<SchemaChangeEventType> schemaEvolutionTypes)
Description copied from interface:MetadataApplierSets enabled schema evolution event types of current metadata applier.- Specified by:
setAcceptedSchemaEvolutionTypesin interfaceMetadataApplier
-
acceptsSchemaEvolutionType
public boolean acceptsSchemaEvolutionType(SchemaChangeEventType schemaChangeEventType)
Description copied from interface:MetadataApplierChecks if this metadata applier should this event type.- Specified by:
acceptsSchemaEvolutionTypein interfaceMetadataApplier
-
getSupportedSchemaEvolutionTypes
public Set<SchemaChangeEventType> getSupportedSchemaEvolutionTypes()
Description copied from interface:MetadataApplierChecks what kind of schema change events downstream can handle.- Specified by:
getSupportedSchemaEvolutionTypesin interfaceMetadataApplier
-
getExistingTableSchemaExpansionSupport
public Optional<ExistingTableSchemaExpansionSupport> getExistingTableSchemaExpansionSupport()
Description copied from interface:MetadataApplierReturns optional support for safely expanding an existing target table schema.- Specified by:
getExistingTableSchemaExpansionSupportin interfaceMetadataApplier
-
getExistingTableSchema
public Optional<Schema> getExistingTableSchema(TableId tableId)
Description copied from interface:ExistingTableSchemaExpansionSupportReturns the current schema of the target table, orOptional.empty()if the table does not exist. Target physical types must be converted to the same canonical CDC representation produced byExistingTableSchemaExpansionSupport.normalizeToTargetDataType(TableId, String, DataType, Schema). The returned schema should include any table options that affect physical type mapping.- Specified by:
getExistingTableSchemain interfaceExistingTableSchemaExpansionSupport
-
normalizeToTargetDataType
public DataType normalizeToTargetDataType(TableId tableId, String columnName, DataType pipelineDataType, Schema existingTargetSchema)
Description copied from interface:ExistingTableSchemaExpansionSupportConverts a pipeline type to the canonical CDC representation of the physical type that this applier will create in the existing target table. For example, if bothCHAR(n)andVARCHAR(n)map to targetVARCHAR(n), this method should return the sameVARCHAR(n)representation for both input types. The existing target schema provides table options needed by sinks whose type mapping depends on table properties.This method must not query or modify the target table.
- Specified by:
normalizeToTargetDataTypein interfaceExistingTableSchemaExpansionSupport
-
isColumnNameCaseSensitive
public boolean isColumnNameCaseSensitive()
Description copied from interface:ExistingTableSchemaExpansionSupportReturns whether target column names are matched case-sensitively.- Specified by:
isColumnNameCaseSensitivein interfaceExistingTableSchemaExpansionSupport
-
applySchemaChange
public void applySchemaChange(SchemaChangeEvent schemaChangeEvent) throws SchemaEvolveException
Description copied from interface:MetadataApplierApply the givenSchemaChangeEventto external systems.- Specified by:
applySchemaChangein interfaceMetadataApplier- Throws:
SchemaEvolveException
-
close
public void close() throws ExceptionDescription copied from interface:MetadataApplierCloses the metadata applier and its underlying resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceMetadataApplier- Throws:
Exception
-
-