public class PulsarTableDeserializationSchemaFactory extends Object implements Serializable
PulsarTableDeserializationSchema instance
used by runtime PulsarSource instance.
A Flink row fields has a strict order: Physical Fields (Key + value) + Format Metadata Fields Connector Metadata Fields. Physical Fields are fields come directly from Pulsar message body; Format Metadata Fields are from the extra information from the decoding format. Connector metadata fields are the ones most Pulsar messages have, such as publish time, message size and producer name.
In general, Physical fields + Format Metadata fields are contained in the RowData decoded using valueDecodingFormat. Only Connector Metadata fields needs to be appended to the decoded RowData. The tricky part is to put format metadata and connector metadata in the right location. This requires an explicit adjustment process.
For example, suppose Physical Fields (Key + value) + Format Metadata Fields + Connector Metadata Fields. has arity of 11, key projection is [0, 6], and physical value projection is [1, 2, 3, 4, 5], Then after the adjustment, key projection should be [0, 6], physical value projection should be [1, 2, 3, 4, 5] and format metadata projection should be [7], connector metadata projection should be [8, 9, 10].
| Constructor and Description |
|---|
PulsarTableDeserializationSchemaFactory(org.apache.flink.table.types.DataType physicalDataType,
org.apache.flink.table.connector.format.DecodingFormat<org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.table.data.RowData>> keyDecodingFormat,
int[] keyProjection,
org.apache.flink.table.connector.format.DecodingFormat<org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.table.data.RowData>> valueDecodingFormat,
int[] valueProjection) |
| Modifier and Type | Method and Description |
|---|---|
PulsarDeserializationSchema<org.apache.flink.table.data.RowData> |
createPulsarDeserialization(org.apache.flink.table.connector.source.ScanTableSource.ScanContext context) |
boolean |
equals(Object o) |
int |
hashCode() |
void |
setConnectorMetadataKeys(List<String> metadataKeys) |
void |
setProducedDataType(org.apache.flink.table.types.DataType producedDataType) |
public PulsarTableDeserializationSchemaFactory(org.apache.flink.table.types.DataType physicalDataType,
@Nullable
org.apache.flink.table.connector.format.DecodingFormat<org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.table.data.RowData>> keyDecodingFormat,
int[] keyProjection,
org.apache.flink.table.connector.format.DecodingFormat<org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.table.data.RowData>> valueDecodingFormat,
int[] valueProjection)
public PulsarDeserializationSchema<org.apache.flink.table.data.RowData> createPulsarDeserialization(org.apache.flink.table.connector.source.ScanTableSource.ScanContext context)
public void setProducedDataType(org.apache.flink.table.types.DataType producedDataType)
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.