This is an automated email from the ASF dual-hosted git repository.

twalthr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit b43e64bb71c234a815ff603c11a7cc76210e3c71
Author: slinkydeveloper <[email protected]>
AuthorDate: Wed Sep 29 17:50:23 2021 +0200

    [FLINK-24399][table-common] Add DataType#toInternal
    
    Signed-off-by: slinkydeveloper <[email protected]>
---
 .../java/org/apache/flink/table/types/DataType.java    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git 
a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/DataType.java
 
b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/DataType.java
index 61c23ef..2d41583 100644
--- 
a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/DataType.java
+++ 
b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/DataType.java
@@ -21,7 +21,10 @@ package org.apache.flink.table.types;
 import org.apache.flink.annotation.PublicEvolving;
 import org.apache.flink.table.api.DataTypes;
 import org.apache.flink.table.api.ValidationException;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.TimestampData;
 import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.utils.DataTypeUtils;
 import org.apache.flink.util.Preconditions;
 
 import javax.annotation.Nullable;
@@ -90,6 +93,21 @@ public abstract class DataType implements 
AbstractDataType<DataType>, Serializab
 
     public abstract <R> R accept(DataTypeVisitor<R> visitor);
 
+    /**
+     * Creates a copy of this {@link DataType} instance with the internal data 
type conversion
+     * classes. This method performs the transformation deeply through its 
children. For example,
+     * for a {@link DataType} instance representing a row type with a 
timestamp field, this method
+     * returns a new {@link DataType}, with the conversion class to {@link 
RowData} and the children
+     * data type with the conversion class to {@link TimestampData}.
+     *
+     * <p>For a comprehensive list of internal data types, check {@link 
RowData}.
+     *
+     * @see RowData
+     */
+    public DataType toInternal() {
+        return DataTypeUtils.toInternalDataType(this);
+    }
+
     @Override
     public String toString() {
         return logicalType.toString();

Reply via email to