[
https://issues.apache.org/jira/browse/FLINK-7452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16167880#comment-16167880
]
ASF GitHub Bot commented on FLINK-7452:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/4612#discussion_r139150559
--- Diff: flink-scala/src/main/scala/org/apache/flink/api/scala/Types.scala
---
@@ -0,0 +1,363 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.api.scala
+
+import org.apache.flink.annotation.PublicEvolving
+import org.apache.flink.api.common.functions.InvalidTypesException
+import org.apache.flink.api.common.typeinfo.{TypeInformation, Types =>
JTypes}
+import org.apache.flink.api.scala.typeutils._
+
+import _root_.scala.collection.JavaConverters._
+import _root_.scala.util.Either
+import _root_.scala.util.Try
+
+/**
+ * This class gives access to the type information of the most common
Scala types for which Flink
+ * has built-in serializers and comparators.
+ *
+ * This class contains types of
[[org.apache.flink.api.common.typeinfo.Types]] and adds
+ * types for Scala specific classes (such as [[Unit]] or case classes).
+ *
+ * In many cases, Flink tries to analyze generic signatures of functions
to determine return
+ * types automatically. This class is intended for cases where the
extraction is not possible
+ * (or inefficient) as well as cases where type information has to be
supplied manually.
+ *
+ * Depending on the API you are using (e.g. Java API or Table API), there
might be a more
+ * specialized `Types` class.
+ *
+ * Scala macros allow to determine type information of classes and type
parameters. You can
+ * use [[Types.of]] to let type information be determined automatically.
+ */
+@PublicEvolving
+object Types {
--- End diff --
extend the Java `Types` class?
> Add helper methods for all built-in Flink types to Types
> --------------------------------------------------------
>
> Key: FLINK-7452
> URL: https://issues.apache.org/jira/browse/FLINK-7452
> Project: Flink
> Issue Type: Improvement
> Components: Type Serialization System
> Reporter: Timo Walther
> Assignee: Timo Walther
>
> Sometimes it is very difficult to provide `TypeInformation` manually, in case
> some extraction fails or is not available. {{TypeHint}}s should be the
> preferred way but this methods can ensure correct types.
> I propose to add all built-in Flink types to the {{Types}}. Such as:
> {code}
> Types.POJO(MyPojo.class)
> Types.POJO(Map<String, TypeInformation>)
> Types.GENERIC(Object.class)
> Types.TUPLE(TypeInformation, ...)
> Types.MAP(TypeInformation, TypeInformation)
> {code}
> The methods should validate that the returned type is exactly the requested
> type. And especially in case of POJO should help creating {{PojoTypeInfo}}.
> Once this is in place, we can deprecate the {{TypeInfoParser}}.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)