You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/01/12 12:24:07 UTC

[GitHub] [flink] twalthr opened a new pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

twalthr opened a new pull request #14619:
URL: https://github.com/apache/flink/pull/14619


   ## What is the purpose of the change
   
   This ensures a smooth mapping between `TypeInformation` and `DataType`. A user can decide whether `TypeInformation` should be treated as an entire RAW type or if instances should be converted to logical types on a best effort basis. In any case, a user will not get an exception during conversion anymore because every `TypeInformation` can be mapped to a non-legacy type in the Blink planner.
   
   ## Brief change log
   
   - Add a new TypeInformation to DataType converter that is backed by `DataTypeFactory`
   - Add API methods for creating a `DataType` either via `DataTypes.of(TypeInformation)` or `DataTypes.RAW(TypeInformation)`
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   - `DataTypesTest`
   - `TypeInfoDataTypeConverterTest`
   - `TypeInfoDataTypeConverterScalaTest`
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): yes
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: yes
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? yes
     - If yes, how is the feature documented? JavaDocs
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14619:
URL: https://github.com/apache/flink/pull/14619#issuecomment-758635914


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11934",
       "triggerID" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * bf7a6ff4b9608d651332cce78581e9146660c62f Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11934) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14619:
URL: https://github.com/apache/flink/pull/14619#issuecomment-758635914


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11934",
       "triggerID" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "421fbf52f2ec18801b430ddeec0be5332a56788f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12129",
       "triggerID" : "421fbf52f2ec18801b430ddeec0be5332a56788f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 421fbf52f2ec18801b430ddeec0be5332a56788f Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12129) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14619:
URL: https://github.com/apache/flink/pull/14619#issuecomment-758635914


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11934",
       "triggerID" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * bf7a6ff4b9608d651332cce78581e9146660c62f Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11934) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14619:
URL: https://github.com/apache/flink/pull/14619#issuecomment-758624117


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 2e8b6eab19df6e53b6031dc4535988b3254e19dc (Fri May 28 07:10:08 UTC 2021)
   
   **Warnings:**
    * **1 pom.xml files were touched**: Check for build and licensing issues.
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] twalthr commented on pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

Posted by GitBox <gi...@apache.org>.
twalthr commented on pull request #14619:
URL: https://github.com/apache/flink/pull/14619#issuecomment-761052302


   Thanks for the feedback @dawidwys. I have updated the PR.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14619:
URL: https://github.com/apache/flink/pull/14619#issuecomment-758635914


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11934",
       "triggerID" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "421fbf52f2ec18801b430ddeec0be5332a56788f",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "421fbf52f2ec18801b430ddeec0be5332a56788f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * bf7a6ff4b9608d651332cce78581e9146660c62f Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11934) 
   * 421fbf52f2ec18801b430ddeec0be5332a56788f UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14619:
URL: https://github.com/apache/flink/pull/14619#issuecomment-758635914


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11934",
       "triggerID" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "421fbf52f2ec18801b430ddeec0be5332a56788f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12129",
       "triggerID" : "421fbf52f2ec18801b430ddeec0be5332a56788f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2e8b6eab19df6e53b6031dc4535988b3254e19dc",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2e8b6eab19df6e53b6031dc4535988b3254e19dc",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 421fbf52f2ec18801b430ddeec0be5332a56788f Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12129) 
   * 2e8b6eab19df6e53b6031dc4535988b3254e19dc UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] dawidwys commented on a change in pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

Posted by GitBox <gi...@apache.org>.
dawidwys commented on a change in pull request #14619:
URL: https://github.com/apache/flink/pull/14619#discussion_r559383036



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/utils/TypeInfoDataTypeConverter.java
##########
@@ -260,35 +261,70 @@ private static DataType convertToStructuredType(
                                         fieldNames[pos],
                                         toDataType(dataTypeFactory, compositeType.getTypeAt(pos))));
 
-        final List<String> fieldNamesOrdered;
+        final List<String> fieldNamesReordered;
         final boolean isNullable;
         // for POJOs and Avro records
         if (compositeType instanceof PojoTypeInfo) {
-            // POJO serializer supports top-level nulls
-            isNullable = true;
-            // all fields are nullable
-            fieldDataTypes.replaceAll((name, dataType) -> dataType.nullable());
-
             final PojoTypeInfo<?> pojoTypeInfo = (PojoTypeInfo<?>) compositeType;
-            final List<Field> fields =
+            final List<Field> pojoFields =
                     IntStream.range(0, arity)
                             .mapToObj(pojoTypeInfo::getPojoFieldAt)
                             .map(PojoField::getField)
                             .collect(Collectors.toList());
+
+            // POJO serializer supports top-level nulls
+            isNullable = true;
+
+            // based on type information all fields are boxed classes,
+            // therefore we need to check the reflective field for more details
+            fieldDataTypes.replaceAll(
+                    (name, dataType) -> {
+                        final Class<?> fieldClass =
+                                pojoFields.stream()
+                                        .filter(f -> f.getName().equals(name))
+                                        .findFirst()
+                                        .orElseThrow(IllegalArgumentException::new)

Review comment:
       nit: I'd rather use `IllegalStateException` as it is more likely an internal Flink error that the `TypeInformation` does not reflect its class.

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/utils/TypeInfoDataTypeConverter.java
##########
@@ -260,35 +261,70 @@ private static DataType convertToStructuredType(
                                         fieldNames[pos],
                                         toDataType(dataTypeFactory, compositeType.getTypeAt(pos))));
 
-        final List<String> fieldNamesOrdered;
+        final List<String> fieldNamesReordered;
         final boolean isNullable;
         // for POJOs and Avro records
         if (compositeType instanceof PojoTypeInfo) {
-            // POJO serializer supports top-level nulls
-            isNullable = true;
-            // all fields are nullable
-            fieldDataTypes.replaceAll((name, dataType) -> dataType.nullable());
-
             final PojoTypeInfo<?> pojoTypeInfo = (PojoTypeInfo<?>) compositeType;
-            final List<Field> fields =
+            final List<Field> pojoFields =
                     IntStream.range(0, arity)
                             .mapToObj(pojoTypeInfo::getPojoFieldAt)
                             .map(PojoField::getField)
                             .collect(Collectors.toList());
+
+            // POJO serializer supports top-level nulls
+            isNullable = true;
+
+            // based on type information all fields are boxed classes,
+            // therefore we need to check the reflective field for more details
+            fieldDataTypes.replaceAll(
+                    (name, dataType) -> {
+                        final Class<?> fieldClass =
+                                pojoFields.stream()
+                                        .filter(f -> f.getName().equals(name))
+                                        .findFirst()
+                                        .orElseThrow(IllegalArgumentException::new)
+                                        .getType();
+                        if (fieldClass.isPrimitive()) {
+                            return dataType.bridgedTo(fieldClass);

Review comment:
       nit: How about we call `notNull` here, just for clarity.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #14619:
URL: https://github.com/apache/flink/pull/14619#issuecomment-758624117


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit bf7a6ff4b9608d651332cce78581e9146660c62f (Tue Jan 12 12:28:05 UTC 2021)
   
   **Warnings:**
    * **1 pom.xml files were touched**: Check for build and licensing issues.
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] twalthr closed pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

Posted by GitBox <gi...@apache.org>.
twalthr closed pull request #14619:
URL: https://github.com/apache/flink/pull/14619


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14619:
URL: https://github.com/apache/flink/pull/14619#issuecomment-758635914


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11934",
       "triggerID" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "421fbf52f2ec18801b430ddeec0be5332a56788f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12129",
       "triggerID" : "421fbf52f2ec18801b430ddeec0be5332a56788f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * bf7a6ff4b9608d651332cce78581e9146660c62f Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11934) 
   * 421fbf52f2ec18801b430ddeec0be5332a56788f Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12129) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] dawidwys commented on a change in pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

Posted by GitBox <gi...@apache.org>.
dawidwys commented on a change in pull request #14619:
URL: https://github.com/apache/flink/pull/14619#discussion_r558227865



##########
File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/TypeInfoDataTypeConverterTest.java
##########
@@ -0,0 +1,262 @@
+/*
+ * 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.table.types;
+
+import org.apache.flink.api.common.ExecutionConfig;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.api.common.typeinfo.Types;
+import org.apache.flink.api.common.typeutils.TypeSerializer;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.api.java.tuple.Tuple3;
+import org.apache.flink.table.api.DataTypes;
+import org.apache.flink.table.types.utils.DataTypeFactoryMock;
+import org.apache.flink.table.types.utils.TypeInfoDataTypeConverter;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.time.DayOfWeek;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+
+import static org.apache.flink.table.types.utils.DataTypeFactoryMock.dummyRaw;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+
+/** Tests for {@link TypeInfoDataTypeConverter}. */
+@RunWith(Parameterized.class)
+public class TypeInfoDataTypeConverterTest {
+
+    @Parameters(name = "{index}: {0}")
+    public static List<TestSpec> testData() {
+        return Arrays.asList(
+                TestSpec.forType(Types.INT).expectDataType(DataTypes.INT().notNull()),
+                TestSpec.forType(Types.BIG_DEC)
+                        .expectDataType(DataTypes.DECIMAL(38, 18).nullable()),
+                TestSpec.forType(
+                                Types.ROW_NAMED(
+                                        new String[] {"a", "b", "c"},
+                                        Types.DOUBLE,
+                                        Types.INT,
+                                        Types.STRING))
+                        .expectDataType(
+                                DataTypes.ROW(
+                                                DataTypes.FIELD("a", DataTypes.DOUBLE()),
+                                                DataTypes.FIELD("b", DataTypes.INT()),
+                                                DataTypes.FIELD("c", DataTypes.STRING()))
+                                        .notNull()),
+                TestSpec.forType(
+                                Types.TUPLE(
+                                        Types.INT,
+                                        Types.TUPLE(Types.STRING, Types.BOOLEAN),
+                                        Types.LONG))
+                        .expectDataType(
+                                DataTypes.STRUCTURED(
+                                                Tuple3.class,
+                                                DataTypes.FIELD("f0", DataTypes.INT().notNull()),
+                                                DataTypes.FIELD(
+                                                        "f1",
+                                                        DataTypes.STRUCTURED(
+                                                                        Tuple2.class,
+                                                                        DataTypes.FIELD(
+                                                                                "f0",
+                                                                                DataTypes.STRING()
+                                                                                        .nullable()),
+                                                                        DataTypes.FIELD(
+                                                                                "f1",
+                                                                                DataTypes.BOOLEAN()
+                                                                                        .notNull()))
+                                                                .notNull()),
+                                                DataTypes.FIELD("f2", DataTypes.BIGINT().notNull()))
+                                        .notNull()),
+                TestSpec.forType(Types.POJO(PojoWithFieldOrder.class))

Review comment:
       I think something is wrong with POJO types mapping. Shouldn't the primitive fields be mapped to `NOT NULL` types?
   Also from our offline chat it seems bridging classes are also not mapped correctly.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #14619:
URL: https://github.com/apache/flink/pull/14619#issuecomment-758635914


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * bf7a6ff4b9608d651332cce78581e9146660c62f UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14619: [FLINK-20862][table] Support creating DataType from TypeInformation

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14619:
URL: https://github.com/apache/flink/pull/14619#issuecomment-758635914


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11934",
       "triggerID" : "bf7a6ff4b9608d651332cce78581e9146660c62f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "421fbf52f2ec18801b430ddeec0be5332a56788f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12129",
       "triggerID" : "421fbf52f2ec18801b430ddeec0be5332a56788f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2e8b6eab19df6e53b6031dc4535988b3254e19dc",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12185",
       "triggerID" : "2e8b6eab19df6e53b6031dc4535988b3254e19dc",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 421fbf52f2ec18801b430ddeec0be5332a56788f Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12129) 
   * 2e8b6eab19df6e53b6031dc4535988b3254e19dc Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12185) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org