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 2020/07/13 13:58:43 UTC

[GitHub] [flink] twalthr opened a new pull request #12887: [FLINK-18586][table-common] Simplify the creation of explicit structured types

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


   ## What is the purpose of the change
   
   Contains preparations for FLINK-15803 regarding structured types.
   
   ## Brief change log
   
   See commit messages.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   - `DataTypesTest`
   - `TypeTransformationsTest`
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - 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? no
     - 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] dawidwys commented on a change in pull request #12887: [FLINK-18586][table-common] Simplify the creation of explicit structured types

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



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/utils/DataTypeUtils.java
##########
@@ -217,29 +221,52 @@ public DataType visit(CollectionDataType collectionDataType) {
 
 		@Override
 		public DataType visit(FieldsDataType fieldsDataType) {
-			final List<DataType> newFields = fieldsDataType.getChildren().stream()
+			final List<DataType> newDataTypes = fieldsDataType.getChildren().stream()
 				.map(dt -> dt.accept(this))
 				.collect(Collectors.toList());
 
 			final LogicalType logicalType = fieldsDataType.getLogicalType();
 			final LogicalType newLogicalType;
 			if (logicalType instanceof RowType) {
-				final List<RowType.RowField> oldFields = ((RowType) logicalType).getFields();
-				final List<RowType.RowField> newRowFields = IntStream.range(0, oldFields.size())
+				final List<RowField> oldFields = ((RowType) logicalType).getFields();
+				final List<RowField> newFields = IntStream.range(0, oldFields.size())
 					.mapToObj(i ->
-						new RowType.RowField(
+						new RowField(
 							oldFields.get(i).getName(),
-							newFields.get(i).getLogicalType(),
+							newDataTypes.get(i).getLogicalType(),
 							oldFields.get(i).getDescription().orElse(null)))
 					.collect(Collectors.toList());
 
 				newLogicalType = new RowType(
 					logicalType.isNullable(),
-					newRowFields);
+					newFields);
+			} else if (logicalType instanceof StructuredType) {

Review comment:
       nit and unrelated comment: I find the logic of `DataTypeTransformer` not the most straightforward. Not sure why it applies the transformation transitively. It probably is needed for the places where we use it, but it is not obvious from the method/class itself.




----------------------------------------------------------------
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 #12887: [FLINK-18586][table-common] Simplify the creation of explicit structured types

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "aae0215c06e48ac4725b6c5eabe40f77ffb81589",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "aae0215c06e48ac4725b6c5eabe40f77ffb81589",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * aae0215c06e48ac4725b6c5eabe40f77ffb81589 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] twalthr closed pull request #12887: [FLINK-18586][table-common] Simplify the creation of explicit structured types

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


   


----------------------------------------------------------------
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 #12887: [FLINK-18586][table-common] Simplify the creation of explicit structured types

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "aae0215c06e48ac4725b6c5eabe40f77ffb81589",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4452",
       "triggerID" : "aae0215c06e48ac4725b6c5eabe40f77ffb81589",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * aae0215c06e48ac4725b6c5eabe40f77ffb81589 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4452) 
   
   <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 #12887: [FLINK-18586][table-common] Simplify the creation of explicit structured types

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "aae0215c06e48ac4725b6c5eabe40f77ffb81589",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4452",
       "triggerID" : "aae0215c06e48ac4725b6c5eabe40f77ffb81589",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * aae0215c06e48ac4725b6c5eabe40f77ffb81589 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4452) 
   
   <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 commented on pull request #12887: [FLINK-18586][table-common] Simplify the creation of explicit structured types

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


   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 aae0215c06e48ac4725b6c5eabe40f77ffb81589 (Mon Jul 13 14:06:02 UTC 2020)
   
   **Warnings:**
    * 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 a change in pull request #12887: [FLINK-18586][table-common] Simplify the creation of explicit structured types

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



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/utils/DataTypeUtils.java
##########
@@ -217,29 +221,52 @@ public DataType visit(CollectionDataType collectionDataType) {
 
 		@Override
 		public DataType visit(FieldsDataType fieldsDataType) {
-			final List<DataType> newFields = fieldsDataType.getChildren().stream()
+			final List<DataType> newDataTypes = fieldsDataType.getChildren().stream()
 				.map(dt -> dt.accept(this))
 				.collect(Collectors.toList());
 
 			final LogicalType logicalType = fieldsDataType.getLogicalType();
 			final LogicalType newLogicalType;
 			if (logicalType instanceof RowType) {
-				final List<RowType.RowField> oldFields = ((RowType) logicalType).getFields();
-				final List<RowType.RowField> newRowFields = IntStream.range(0, oldFields.size())
+				final List<RowField> oldFields = ((RowType) logicalType).getFields();
+				final List<RowField> newFields = IntStream.range(0, oldFields.size())
 					.mapToObj(i ->
-						new RowType.RowField(
+						new RowField(
 							oldFields.get(i).getName(),
-							newFields.get(i).getLogicalType(),
+							newDataTypes.get(i).getLogicalType(),
 							oldFields.get(i).getDescription().orElse(null)))
 					.collect(Collectors.toList());
 
 				newLogicalType = new RowType(
 					logicalType.isNullable(),
-					newRowFields);
+					newFields);
+			} else if (logicalType instanceof StructuredType) {

Review comment:
       I will try to improve the documentation for this a little bit. The transformation needs to be applied transitively to adapt e.g. conversion classes or precision throughout a data type and its fields.




----------------------------------------------------------------
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