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 826b10f935585641afba9b9273bbdb31a6b04ce9 Author: slinkydeveloper <[email protected]> AuthorDate: Wed Sep 29 17:44:14 2021 +0200 [FLINK-24399][table-common] Add DataTypes#of(LogicalType) Signed-off-by: slinkydeveloper <[email protected]> --- .../src/main/java/org/apache/flink/table/api/DataTypes.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/DataTypes.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/DataTypes.java index a2d3224..2b6b247 100644 --- a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/DataTypes.java +++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/DataTypes.java @@ -62,6 +62,7 @@ import org.apache.flink.table.types.logical.VarCharType; import org.apache.flink.table.types.logical.YearMonthIntervalType; import org.apache.flink.table.types.logical.YearMonthIntervalType.YearMonthResolution; import org.apache.flink.table.types.logical.ZonedTimestampType; +import org.apache.flink.table.types.utils.TypeConversions; import org.apache.flink.table.types.utils.TypeInfoDataTypeConverter; import org.apache.flink.util.Preconditions; @@ -97,6 +98,16 @@ import static org.apache.flink.table.types.extraction.ExtractionUtils.validateSt public final class DataTypes { /** + * Creates a {@link DataType} from a {@link LogicalType} with default conversion class. + * + * @return the {@link LogicalType} converted to a {@link DataType}. + * @see LogicalType#getDefaultConversion() + */ + public static DataType of(LogicalType logicalType) { + return TypeConversions.fromLogicalToDataType(logicalType); + } + + /** * Creates an unresolved type that will be resolved to a {@link DataType} by analyzing the given * class later. *
