Class CanalJsonDecodingFormat
- java.lang.Object
-
- org.apache.flink.formats.json.canal.CanalJsonDecodingFormat
-
- All Implemented Interfaces:
DecodingFormat<DeserializationSchema<RowData>>
,Format
,ProjectableDecodingFormat<DeserializationSchema<RowData>>
public class CanalJsonDecodingFormat extends Object implements ProjectableDecodingFormat<DeserializationSchema<RowData>>
DecodingFormat
for Canal using JSON encoding.
-
-
Constructor Summary
Constructors Constructor Description CanalJsonDecodingFormat(String database, String table, boolean ignoreParseErrors, TimestampFormat timestampFormat)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyReadableMetadata(List<String> metadataKeys)
Provides a list of metadata keys that the produced row must contain as appended metadata columns.DeserializationSchema<RowData>
createRuntimeDecoder(DynamicTableSource.Context context, DataType physicalDataType, int[][] projections)
Creates runtime decoder implementation that is configured to produce data of typeProjection.of(projections).project(physicalDataType)
.ChangelogMode
getChangelogMode()
Returns the set of changes that a connector (and transitively the planner) can expect during runtime.Map<String,DataType>
listReadableMetadata()
Returns the map of metadata keys and their corresponding data types that can be produced by this format for reading.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.table.connector.format.ProjectableDecodingFormat
createRuntimeDecoder, supportsNestedProjection
-
-
-
-
Constructor Detail
-
CanalJsonDecodingFormat
public CanalJsonDecodingFormat(String database, String table, boolean ignoreParseErrors, TimestampFormat timestampFormat)
-
-
Method Detail
-
createRuntimeDecoder
public DeserializationSchema<RowData> createRuntimeDecoder(DynamicTableSource.Context context, DataType physicalDataType, int[][] projections)
Description copied from interface:ProjectableDecodingFormat
Creates runtime decoder implementation that is configured to produce data of typeProjection.of(projections).project(physicalDataType)
. For more details on the usage, checkDecodingFormat
documentation.- Specified by:
createRuntimeDecoder
in interfaceProjectableDecodingFormat<DeserializationSchema<RowData>>
- Parameters:
context
- the context provides several utilities required to instantiate the runtime decoder implementation of the formatphysicalDataType
- For more details checkDecodingFormat
projections
- the projections array. The array represents the mapping of the fields of the originalDataType
, including nested rows. For example,[[0, 2, 1], ...]
specifies to include the 2nd field of the 3rd field of the 1st field in the top-level row. It's guaranteed that this array won't contain nested projections ifProjectableDecodingFormat.supportsNestedProjection()
returnsfalse
. For more details, checkProjection
as well.- Returns:
- the runtime decoder
- See Also:
DecodingFormat
-
listReadableMetadata
public Map<String,DataType> listReadableMetadata()
Description copied from interface:DecodingFormat
Returns the map of metadata keys and their corresponding data types that can be produced by this format for reading. By default, this method returns an empty map.Metadata columns add additional columns to the table's schema. A decoding format is responsible to add requested metadata columns at the end of produced rows.
See
SupportsReadingMetadata
for more information.Note: This method is only used if the outer
DynamicTableSource
implementsSupportsReadingMetadata
and calls this method inSupportsReadingMetadata.listReadableMetadata()
.- Specified by:
listReadableMetadata
in interfaceDecodingFormat<DeserializationSchema<RowData>>
-
applyReadableMetadata
public void applyReadableMetadata(List<String> metadataKeys)
Description copied from interface:DecodingFormat
Provides a list of metadata keys that the produced row must contain as appended metadata columns. By default, this method throws an exception if metadata keys are defined.See
SupportsReadingMetadata
for more information.Note: This method is only used if the outer
DynamicTableSource
implementsSupportsReadingMetadata
and calls this method inSupportsReadingMetadata.applyReadableMetadata(List, DataType)
.- Specified by:
applyReadableMetadata
in interfaceDecodingFormat<DeserializationSchema<RowData>>
-
getChangelogMode
public ChangelogMode getChangelogMode()
Description copied from interface:Format
Returns the set of changes that a connector (and transitively the planner) can expect during runtime.- Specified by:
getChangelogMode
in interfaceFormat
-
-