Constructor and Description |
---|
CdcRecordUtils() |
Modifier and Type | Method and Description |
---|---|
static CdcRecord |
fromGenericRow(GenericRow row,
List<String> fieldNames) |
static GenericRow |
projectAsInsert(CdcRecord record,
List<DataField> dataFields)
Project
fields to a GenericRow . |
static Optional<GenericRow> |
toGenericRow(CdcRecord record,
List<DataField> dataFields)
Convert
fields to a GenericRow . |
public static GenericRow projectAsInsert(CdcRecord record, List<DataField> dataFields)
fields
to a GenericRow
. The fields of row are specified by the given
dataFields
and its RowKind
will always be RowKind.INSERT
.
NOTE: This method will always return a GenericRow
even if some keys of fields
are not in dataFields
. If you want to make sure all field names of dataFields
existed in keys of fields
, use toGenericRow(org.apache.paimon.flink.sink.cdc.CdcRecord, java.util.List<org.apache.paimon.types.DataField>)
instead.
dataFields
- DataField
s of the converted GenericRow
.GenericRow
.public static Optional<GenericRow> toGenericRow(CdcRecord record, List<DataField> dataFields)
fields
to a GenericRow
. The fields of row are specified by the given
dataFields
and its RowKind
is determined by kind
of this CdcRecord
.
NOTE: This method requires all field names of dataFields
existed in keys of fields
. If you only want to convert some fields
, use projectAsInsert(org.apache.paimon.flink.sink.cdc.CdcRecord, java.util.List<org.apache.paimon.types.DataField>)
instead.
dataFields
- DataField
s of the converted GenericRow
.dataFields
existed in keys of fields
and all
values of fields
can be correctly converted to the specified type, an Optional#of(GenericRow)
will be returned, otherwise an Optional#empty()
will be
returnedpublic static CdcRecord fromGenericRow(GenericRow row, List<String> fieldNames)
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.