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 2019/12/26 03:56:27 UTC

[GitHub] [flink] leonardBang opened a new pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

leonardBang opened a new pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693
 
 
   Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
   <!--
   *Thank you very much for contributing to Apache Flink - we are happy that you want to help us improve Flink. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   *Please understand that we do not do this to make contributions to Flink a hassle. In order to uphold a high standard of quality for code contributions, while at the same time managing a large number of contributions, we need contributors to prepare the contributions well, and give reviewers enough contextual information for the review. Please also understand that contributions that do not follow this guide will take longer to review and thus typically be picked up with lower priority by the community.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [JIRA issue](https://issues.apache.org/jira/projects/FLINK/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no JIRA issue.
   
     - Name the pull request in the form "[FLINK-XXXX] [component] Title of the pull request", where *FLINK-XXXX* should be replaced by the actual issue number. Skip *component* if you are unsure about which is the best component.
     Typo fixes that have no associated JIRA issue should be named following this pattern: `[hotfix] [docs] Fix typo in event time introduction` or `[hotfix] [javadocs] Expand JavaDoc for PuncuatedWatermarkGenerator`.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
   
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes. You can set up Travis CI to do that following [this guide](https://flink.apache.org/contributing/contribute-code.html#open-a-pull-request).
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
   
     - Each commit in the pull request has a meaningful commit message (including the JIRA id)
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   ## What is the purpose of the change
   
   *This pull request Fix physical schema mapping in schemaValidator which used in TableSoure and tableSourceFactory, we can support  define orderless computed column after fix it.*
   
   
   ## Brief change log
   
     - *fix mapping in org/apache/flink/table/factories/TableFormatFactoryBase.java*
     - *Add unit test in  file org/apache/flink/table/descriptors/SchemaValidatorTest.scala*
     - *Add IT case org/apache/flink/streaming/connectors/kafka/KafkaTableTestBase.java*
   
   ## Verifying this change
   
     - *Add unit test cover path that define table by DescriptorProperties*
     - *Add IT case cover path that define table by DDL*
   
   ## 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)`: (no)
     - The serializers: (no)
     - The runtime per-record code paths (performance sensitive): ( no)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, 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? (not applicable / docs / JavaDocs / not documented)
   

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


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#issuecomment-568967236
 
 
   <!--
   Meta data
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:FAILURE URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:PENDING URL:https://travis-ci.com/flink-ci/flink/builds/142348347 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   -->
   ## CI report:
   
   * a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Travis: [PENDING](https://travis-ci.com/flink-ci/flink/builds/142348347) Azure: [FAILURE](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923) 
   
   <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


With regards,
Apache Git Services

[GitHub] [flink] leonardBang commented on a change in pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
leonardBang commented on a change in pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#discussion_r362160144
 
 

 ##########
 File path: flink-table/flink-table-api-java-bridge/src/main/java/org/apache/flink/table/descriptors/SchemaValidator.java
 ##########
 @@ -212,12 +212,16 @@ else if (proctimeFound) {
 	@Deprecated
 	public static TableSchema deriveTableSinkSchema(DescriptorProperties properties) {
 		TableSchema.Builder builder = TableSchema.builder();
-
-		TableSchema schema = TableSchemaUtils.getPhysicalSchema(properties.getTableSchema(SCHEMA));
-
-		for (int i = 0; i < schema.getFieldCount(); i++) {
-			TypeInformation t = schema.getFieldTypes()[i];
-			String n = schema.getFieldNames()[i];
+		TableSchema tableSchema = properties.getTableSchema(SCHEMA);
+		for (int i = 0; i < tableSchema.getFieldCount(); i++) {
+			TypeInformation t = tableSchema.getFieldTypes()[i];
+			String n = tableSchema.getFieldNames()[i];
+			Optional<TableColumn> tableColumn = tableSchema.getTableColumn(n);
+			boolean isGeneratedColumn = tableColumn.isPresent() && tableColumn.get().isGenerated();
 
 Review comment:
   That's better, thanks for your kindly tips

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


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#issuecomment-568967236
 
 
   <!--
   Meta data
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:FAILURE URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142348347 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142717407 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:SUCCESS URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   Hash:a54c016397d009edebed862f421d56c1b3a5d8d1 Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142727374 TriggerType:PUSH TriggerID:a54c016397d009edebed862f421d56c1b3a5d8d1
   Hash:a54c016397d009edebed862f421d56c1b3a5d8d1 Status:PENDING URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4005 TriggerType:PUSH TriggerID:a54c016397d009edebed862f421d56c1b3a5d8d1
   Hash:23f62a6735d0b3091dadfa39e103525c3cb7518a Status:UNKNOWN URL:TBD TriggerType:PUSH TriggerID:23f62a6735d0b3091dadfa39e103525c3cb7518a
   -->
   ## CI report:
   
   * a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142348347) Azure: [FAILURE](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923) 
   * 57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142717407) Azure: [SUCCESS](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997) 
   * a54c016397d009edebed862f421d56c1b3a5d8d1 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142727374) Azure: [PENDING](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4005) 
   * 23f62a6735d0b3091dadfa39e103525c3cb7518a 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


With regards,
Apache Git Services

[GitHub] [flink] leonardBang commented on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
leonardBang commented on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#issuecomment-570195219
 
 
   @wuchong thanks!

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


With regards,
Apache Git Services

[GitHub] [flink] wuchong commented on a change in pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
wuchong commented on a change in pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#discussion_r361945201
 
 

 ##########
 File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFormatFactoryBase.java
 ##########
 @@ -154,31 +156,37 @@ public static TableSchema deriveSchema(Map<String, String> properties) {
 
 		final TableSchema.Builder builder = TableSchema.builder();
 
-		final TableSchema baseSchema = TableSchemaUtils.getPhysicalSchema(
-			descriptorProperties.getTableSchema(SCHEMA));
-		for (int i = 0; i < baseSchema.getFieldCount(); i++) {
-			final String fieldName = baseSchema.getFieldNames()[i];
-			final DataType fieldType = baseSchema.getFieldDataTypes()[i];
+		final TableSchema tableSchema = descriptorProperties.getTableSchema(SCHEMA);
+		final TableSchema physicalSchema = TableSchemaUtils.getPhysicalSchema(tableSchema);
+
+		final Map<Integer, Integer> physicalIndices2Indices = Arrays.stream(physicalSchema.getFieldNames())
 
 Review comment:
   A simper way to fix is add the field only when it is not generated. We already have `isGeneratedColumn `. So we don't need the complex mapping. 

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


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#issuecomment-568967236
 
 
   <!--
   Meta data
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:FAILURE URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142348347 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142717407 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:SUCCESS URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   -->
   ## CI report:
   
   * a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142348347) Azure: [FAILURE](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923) 
   * 57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142717407) Azure: [SUCCESS](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997) 
   
   <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


With regards,
Apache Git Services

[GitHub] [flink] wuchong merged pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
wuchong merged pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693
 
 
   

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


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#issuecomment-568967236
 
 
   <!--
   Meta data
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:FAILURE URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142348347 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:UNKNOWN URL:TBD TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   -->
   ## CI report:
   
   * a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142348347) Azure: [FAILURE](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923) 
   * 57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae 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


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#issuecomment-568967236
 
 
   <!--
   Meta data
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:FAILURE URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142348347 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142717407 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:SUCCESS URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   Hash:a54c016397d009edebed862f421d56c1b3a5d8d1 Status:PENDING URL:https://travis-ci.com/flink-ci/flink/builds/142727374 TriggerType:PUSH TriggerID:a54c016397d009edebed862f421d56c1b3a5d8d1
   Hash:a54c016397d009edebed862f421d56c1b3a5d8d1 Status:PENDING URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4005 TriggerType:PUSH TriggerID:a54c016397d009edebed862f421d56c1b3a5d8d1
   -->
   ## CI report:
   
   * a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142348347) Azure: [FAILURE](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923) 
   * 57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142717407) Azure: [SUCCESS](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997) 
   * a54c016397d009edebed862f421d56c1b3a5d8d1 Travis: [PENDING](https://travis-ci.com/flink-ci/flink/builds/142727374) Azure: [PENDING](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4005) 
   
   <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


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#issuecomment-568967236
 
 
   <!--
   Meta data
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:FAILURE URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142348347 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   -->
   ## CI report:
   
   * a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142348347) Azure: [FAILURE](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923) 
   
   <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


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#issuecomment-568967236
 
 
   <!--
   Meta data
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:FAILURE URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142348347 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142717407 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:SUCCESS URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   Hash:a54c016397d009edebed862f421d56c1b3a5d8d1 Status:UNKNOWN URL:TBD TriggerType:PUSH TriggerID:a54c016397d009edebed862f421d56c1b3a5d8d1
   -->
   ## CI report:
   
   * a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142348347) Azure: [FAILURE](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923) 
   * 57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142717407) Azure: [SUCCESS](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997) 
   * a54c016397d009edebed862f421d56c1b3a5d8d1 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


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#issuecomment-568967236
 
 
   <!--
   Meta data
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:FAILURE URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142348347 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142717407 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:SUCCESS URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   Hash:a54c016397d009edebed862f421d56c1b3a5d8d1 Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142727374 TriggerType:PUSH TriggerID:a54c016397d009edebed862f421d56c1b3a5d8d1
   Hash:a54c016397d009edebed862f421d56c1b3a5d8d1 Status:PENDING URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4005 TriggerType:PUSH TriggerID:a54c016397d009edebed862f421d56c1b3a5d8d1
   Hash:23f62a6735d0b3091dadfa39e103525c3cb7518a Status:PENDING URL:https://travis-ci.com/flink-ci/flink/builds/142730378 TriggerType:PUSH TriggerID:23f62a6735d0b3091dadfa39e103525c3cb7518a
   Hash:23f62a6735d0b3091dadfa39e103525c3cb7518a Status:PENDING URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4010 TriggerType:PUSH TriggerID:23f62a6735d0b3091dadfa39e103525c3cb7518a
   -->
   ## CI report:
   
   * a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142348347) Azure: [FAILURE](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923) 
   * 57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142717407) Azure: [SUCCESS](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997) 
   * a54c016397d009edebed862f421d56c1b3a5d8d1 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142727374) Azure: [PENDING](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4005) 
   * 23f62a6735d0b3091dadfa39e103525c3cb7518a Travis: [PENDING](https://travis-ci.com/flink-ci/flink/builds/142730378) Azure: [PENDING](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4010) 
   
   <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


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#issuecomment-568967236
 
 
   <!--
   Meta data
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:FAILURE URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142348347 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:PENDING URL:https://travis-ci.com/flink-ci/flink/builds/142717407 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:PENDING URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   -->
   ## CI report:
   
   * a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142348347) Azure: [FAILURE](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923) 
   * 57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Travis: [PENDING](https://travis-ci.com/flink-ci/flink/builds/142717407) Azure: [PENDING](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997) 
   
   <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


With regards,
Apache Git Services

[GitHub] [flink] leonardBang commented on a change in pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
leonardBang commented on a change in pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#discussion_r362167104
 
 

 ##########
 File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFormatFactoryBase.java
 ##########
 @@ -157,36 +156,33 @@ public static TableSchema deriveSchema(Map<String, String> properties) {
 		final TableSchema.Builder builder = TableSchema.builder();
 
 		final TableSchema tableSchema = descriptorProperties.getTableSchema(SCHEMA);
-		final TableSchema physicalSchema = TableSchemaUtils.getPhysicalSchema(tableSchema);
-
-		final Map<Integer, Integer> physicalIndices2Indices = Arrays.stream(physicalSchema.getFieldNames())
-			.collect(Collectors.toMap(
-				Arrays.asList(physicalSchema.getFieldNames())::indexOf,
-				Arrays.asList(tableSchema.getFieldNames())::indexOf));
-
-		for (int i = 0; i < physicalSchema.getFieldCount(); i++) {
-			final String fieldName = physicalSchema.getFieldNames()[i];
-			final DataType fieldType = physicalSchema.getFieldDataTypes()[i];
-
+		for (int i = 0; i < tableSchema.getFieldCount(); i++) {
+			final String fieldName = tableSchema.getFieldNames()[i];
+			final DataType fieldType = tableSchema.getFieldDataTypes()[i];
+
+			final Optional<TableColumn> tableColumn = tableSchema.getTableColumn(fieldName);
+			final boolean isGeneratedColumn = tableColumn.isPresent() && tableColumn.get().isGenerated();
 
 Review comment:
   fixed

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


With regards,
Apache Git Services

[GitHub] [flink] flinkbot commented on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
flinkbot commented on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#issuecomment-568967236
 
 
   <!--
   Meta data
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:UNKNOWN URL:TBD TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   -->
   ## CI report:
   
   * a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 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


With regards,
Apache Git Services

[GitHub] [flink] wuchong commented on a change in pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
wuchong commented on a change in pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#discussion_r362164397
 
 

 ##########
 File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFormatFactoryBase.java
 ##########
 @@ -157,36 +156,33 @@ public static TableSchema deriveSchema(Map<String, String> properties) {
 		final TableSchema.Builder builder = TableSchema.builder();
 
 		final TableSchema tableSchema = descriptorProperties.getTableSchema(SCHEMA);
-		final TableSchema physicalSchema = TableSchemaUtils.getPhysicalSchema(tableSchema);
-
-		final Map<Integer, Integer> physicalIndices2Indices = Arrays.stream(physicalSchema.getFieldNames())
-			.collect(Collectors.toMap(
-				Arrays.asList(physicalSchema.getFieldNames())::indexOf,
-				Arrays.asList(tableSchema.getFieldNames())::indexOf));
-
-		for (int i = 0; i < physicalSchema.getFieldCount(); i++) {
-			final String fieldName = physicalSchema.getFieldNames()[i];
-			final DataType fieldType = physicalSchema.getFieldDataTypes()[i];
-
+		for (int i = 0; i < tableSchema.getFieldCount(); i++) {
+			final String fieldName = tableSchema.getFieldNames()[i];
+			final DataType fieldType = tableSchema.getFieldDataTypes()[i];
+
+			final Optional<TableColumn> tableColumn = tableSchema.getTableColumn(fieldName);
+			final boolean isGeneratedColumn = tableColumn.isPresent() && tableColumn.get().isGenerated();
 
 Review comment:
   Please update here as above.

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


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#issuecomment-568967236
 
 
   <!--
   Meta data
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:FAILURE URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142348347 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142717407 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:SUCCESS URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   Hash:a54c016397d009edebed862f421d56c1b3a5d8d1 Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142727374 TriggerType:PUSH TriggerID:a54c016397d009edebed862f421d56c1b3a5d8d1
   Hash:a54c016397d009edebed862f421d56c1b3a5d8d1 Status:SUCCESS URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4005 TriggerType:PUSH TriggerID:a54c016397d009edebed862f421d56c1b3a5d8d1
   Hash:23f62a6735d0b3091dadfa39e103525c3cb7518a Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142730378 TriggerType:PUSH TriggerID:23f62a6735d0b3091dadfa39e103525c3cb7518a
   Hash:23f62a6735d0b3091dadfa39e103525c3cb7518a Status:PENDING URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4010 TriggerType:PUSH TriggerID:23f62a6735d0b3091dadfa39e103525c3cb7518a
   -->
   ## CI report:
   
   * a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142348347) Azure: [FAILURE](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923) 
   * 57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142717407) Azure: [SUCCESS](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997) 
   * a54c016397d009edebed862f421d56c1b3a5d8d1 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142727374) Azure: [SUCCESS](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4005) 
   * 23f62a6735d0b3091dadfa39e103525c3cb7518a Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142730378) Azure: [PENDING](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4010) 
   
   <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


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#issuecomment-568967236
 
 
   <!--
   Meta data
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:FAILURE URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142348347 TriggerType:PUSH TriggerID:a6b006a4d5fd8d8398d65f170d89e3fcda2f2105
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142717407 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   Hash:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Status:SUCCESS URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997 TriggerType:PUSH TriggerID:57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae
   Hash:a54c016397d009edebed862f421d56c1b3a5d8d1 Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142727374 TriggerType:PUSH TriggerID:a54c016397d009edebed862f421d56c1b3a5d8d1
   Hash:a54c016397d009edebed862f421d56c1b3a5d8d1 Status:SUCCESS URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4005 TriggerType:PUSH TriggerID:a54c016397d009edebed862f421d56c1b3a5d8d1
   Hash:23f62a6735d0b3091dadfa39e103525c3cb7518a Status:SUCCESS URL:https://travis-ci.com/flink-ci/flink/builds/142730378 TriggerType:PUSH TriggerID:23f62a6735d0b3091dadfa39e103525c3cb7518a
   Hash:23f62a6735d0b3091dadfa39e103525c3cb7518a Status:SUCCESS URL:https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4010 TriggerType:PUSH TriggerID:23f62a6735d0b3091dadfa39e103525c3cb7518a
   -->
   ## CI report:
   
   * a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142348347) Azure: [FAILURE](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3923) 
   * 57edd55c4b44f33ebdda3082ed36d1fd62c2d2ae Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142717407) Azure: [SUCCESS](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=3997) 
   * a54c016397d009edebed862f421d56c1b3a5d8d1 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142727374) Azure: [SUCCESS](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4005) 
   * 23f62a6735d0b3091dadfa39e103525c3cb7518a Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/142730378) Azure: [SUCCESS](https://dev.azure.com/rmetzger/5bd3ef0a-4359-41af-abca-811b04098d2e/_build/results?buildId=4010) 
   
   <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


With regards,
Apache Git Services

[GitHub] [flink] wuchong commented on a change in pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
wuchong commented on a change in pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#discussion_r361946074
 
 

 ##########
 File path: flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/descriptors/SchemaValidatorTest.scala
 ##########
 @@ -168,25 +168,28 @@ class SchemaValidatorTest {
 
   @Test
   def testSchemaWithGeneratedColumnAndWatermark(): Unit = {
-    val descriptor = new Schema()
-      .field("f1", DataTypes.STRING)
-      .field("f2", DataTypes.INT)
-      .field("f3", DataTypes.TIMESTAMP(3))
-
     val properties = new DescriptorProperties()
-    properties.putProperties(descriptor.toProperties)
-    properties.putString("schema.3.name", "generated-column")
-    properties.putString("schema.3.data-type", DataTypes.INT.toString)
-    properties.putString("schema.3.expr", "f2 + 1")
+    properties.putString("schema.0.name", "f1")
+    properties.putString("schema.0.data-type", DataTypes.STRING().toString)
+    properties.putString("schema.1.name", "computed-column")
+    properties.putString("schema.1.data-type", DataTypes.INT().toString)
+    properties.putString("schema.1.expr", "f4 + 1")
+    properties.putString("schema.2.name", "f2")
+    properties.putString("schema.2.data-type", DataTypes.INT().toString)
+    properties.putString("schema.3.name", "f3")
+    properties.putString("schema.3.data-type", DataTypes.TIMESTAMP(3).toString)
+    properties.putString("schema.4.name", "f4")
+    properties.putString("schema.4.data-type", DataTypes.INT().toString)
 
 Review comment:
   Please also add `Rowtime` properties in it to verify the logic of `SchemaValidator#deriveTableSinkSchema`. 
   I think `SchemaValidator#deriveTableSinkSchema` still has bug. 

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


With regards,
Apache Git Services

[GitHub] [flink] wuchong commented on a change in pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
wuchong commented on a change in pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#discussion_r362146236
 
 

 ##########
 File path: flink-table/flink-table-api-java-bridge/src/main/java/org/apache/flink/table/descriptors/SchemaValidator.java
 ##########
 @@ -212,12 +212,16 @@ else if (proctimeFound) {
 	@Deprecated
 	public static TableSchema deriveTableSinkSchema(DescriptorProperties properties) {
 		TableSchema.Builder builder = TableSchema.builder();
-
-		TableSchema schema = TableSchemaUtils.getPhysicalSchema(properties.getTableSchema(SCHEMA));
-
-		for (int i = 0; i < schema.getFieldCount(); i++) {
-			TypeInformation t = schema.getFieldTypes()[i];
-			String n = schema.getFieldNames()[i];
+		TableSchema tableSchema = properties.getTableSchema(SCHEMA);
+		for (int i = 0; i < tableSchema.getFieldCount(); i++) {
+			TypeInformation t = tableSchema.getFieldTypes()[i];
+			String n = tableSchema.getFieldNames()[i];
+			Optional<TableColumn> tableColumn = tableSchema.getTableColumn(n);
+			boolean isGeneratedColumn = tableColumn.isPresent() && tableColumn.get().isGenerated();
 
 Review comment:
   Improve the code a bit:
   
   ```java
   final TableColumn tableColumn = tableSchema.getTableColumns().get(i);
   final String fieldName = tableColumn.getName();
   final DataType fieldType = tableColumn.getType();
   final boolean isGeneratedColumn = tableColumn.isGenerated();
   ```
   We do know it's safe to call `tableSchema.getTableColumns().get(i)`.

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


With regards,
Apache Git Services

[GitHub] [flink] flinkbot commented on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

Posted by GitBox <gi...@apache.org>.
flinkbot commented on issue #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#issuecomment-568962486
 
 
   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 a6b006a4d5fd8d8398d65f170d89e3fcda2f2105 (Thu Dec 26 03:58:20 UTC 2019)
   
   **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


With regards,
Apache Git Services