Class TableDataTypeUtils
- java.lang.Object
-
- org.apache.flink.streaming.connectors.kafka.table.TableDataTypeUtils
-
public class TableDataTypeUtils extends Object
Utility class for manipulatingDataTypeobjects, particularly for table schemas. This class provides methods that were removed from the Flink API in version 2.1.0. See Flink PR 26784.
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringRENAME_ROW_LENGTH_MISMATCH_ERROR_MSGprotected static StringSTRIP_ROW_NO_ROW_ERROR_MSG
-
Constructor Summary
Constructors Constructor Description TableDataTypeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.flink.table.types.logical.RowTyperenameRowFields(org.apache.flink.table.types.logical.RowType rowType, List<String> newFieldNames)Renames the fields of the givenRowType.static org.apache.flink.table.types.DataTypestripRowPrefix(org.apache.flink.table.types.DataType dataType, String prefix)Removes a string prefix from the fields of the given row data type.
-
-
-
Field Detail
-
STRIP_ROW_NO_ROW_ERROR_MSG
protected static final String STRIP_ROW_NO_ROW_ERROR_MSG
- See Also:
- Constant Field Values
-
RENAME_ROW_LENGTH_MISMATCH_ERROR_MSG
protected static final String RENAME_ROW_LENGTH_MISMATCH_ERROR_MSG
- See Also:
- Constant Field Values
-
-
Method Detail
-
stripRowPrefix
public static org.apache.flink.table.types.DataType stripRowPrefix(org.apache.flink.table.types.DataType dataType, String prefix)Removes a string prefix from the fields of the given row data type.- Parameters:
dataType- The row data type to modify.prefix- The prefix to remove from the field names.- Returns:
- A new DataType with the modified field names.
- Throws:
IllegalArgumentException- if the provided dataType is not of ROW type.
-
renameRowFields
public static org.apache.flink.table.types.logical.RowType renameRowFields(org.apache.flink.table.types.logical.RowType rowType, List<String> newFieldNames)Renames the fields of the givenRowType.- Parameters:
rowType- The original RowType.newFieldNames- The new field names to apply.- Returns:
- A new RowType with the updated field names.
- Throws:
IllegalArgumentException- if the number of new field names does not match the number of fields in the original RowType.
-
-