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/03/10 09:12:28 UTC

[GitHub] [flink] twalthr opened a new pull request #15137: [FLINK-21396][table] Resolve tables when calling Catalog.createTable/alterTable

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


   ## What is the purpose of the change
   
   This ensures that the framework always resolves CatalogTable or CatalogView before calling `Catalog.createTable/alterTable`.  It is still possible to pass unresolved tables when calling the catalog directly but this depends on the catalog implementation. 
   
   Note: The PR is still incomplete because we should also only work with resolved objects on the planner side.
   
   ## Brief change log
   
   - Update `CatalogManager` to resolve tables and views
   - Forward calls in `TableEnvironment` to `CatalogManager`
   - Enable the interface introduced in #15098 
   
   ## Verifying this change
   
   This change is already covered by existing tests, such as `CatalogTest` and many more.
   
   ## 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? (yes / 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



[GitHub] [flink] flinkbot commented on pull request #15137: [FLINK-21396][table] Resolve tables when calling Catalog.createTable/alterTable

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608 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 #15137: [FLINK-21396][table] Resolve tables when calling Catalog.createTable/alterTable

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


   


----------------------------------------------------------------
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] Airblader commented on a change in pull request #15137: [FLINK-21396][table] Resolve tables when calling Catalog.createTable/alterTable

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



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CatalogBaseTable.java
##########
@@ -18,18 +18,32 @@
 
 package org.apache.flink.table.catalog;
 
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.table.api.Schema;
 import org.apache.flink.table.api.TableSchema;
 import org.apache.flink.table.factories.DynamicTableFactory;
 
 import java.util.Map;
 import java.util.Optional;
 
 /**
- * CatalogBaseTable is the common parent of table and view. It has a map of key-value pairs defining
- * the properties of the table.
+ * A common parent that describes the <i>unresolved</i> metadata of a table or view in a catalog.
+ *
+ * @see CatalogTable
+ * @see CatalogView
  */
+@PublicEvolving
 public interface CatalogBaseTable {
 
+    /** The kind of {@link CatalogBaseTable}. */
+    enum TableKind {

Review comment:
       Is "TableKind" the correct abstraction to use if one value is "Table"? If we e.g. enumerate types of apples, then AppleKind.GRANNY_SMITH is reasonable, but AppleKind.APPLE sounds out of place. A "table" is not a "kind of table".
   
   I sort of feel the same way here. `CatalogBaseTable` has that problem, too, but that class existed already, so we probably can't rename it easily now.

##########
File path: flink-table/flink-table-planner-blink/src/test/java/org/apache/flink/table/planner/runtime/stream/sql/FunctionITCase.java
##########
@@ -1095,7 +1095,7 @@ public void testTimestampNotNull() {
         TestCollectionTableFactory.initData(sourceData);
 
         tEnv().executeSql(
-                        "CREATE TABLE SourceTable(i INT, ts AS LOCALTIMESTAMP, WATERMARK FOR ts AS ts) "
+                        "CREATE TABLE SourceTable(i INT, ts AS CAST(LOCALTIMESTAMP AS TIMESTAMP(3)), WATERMARK FOR ts AS ts) "

Review comment:
       Is this a drive-by change? Or was this necessary?




----------------------------------------------------------------
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 #15137: [FLINK-21396][table] Resolve tables when calling Catalog.createTable/alterTable

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


   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 a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608 (Wed Mar 10 09:25:03 UTC 2021)
   
   **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] flinkbot edited a comment on pull request #15137: [FLINK-21396][table] Resolve tables when calling Catalog.createTable/alterTable

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14394",
       "triggerID" : "a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14394) 
   
   <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] Airblader commented on a change in pull request #15137: [FLINK-21396][table] Resolve tables when calling Catalog.createTable/alterTable

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



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CatalogBaseTable.java
##########
@@ -18,18 +18,32 @@
 
 package org.apache.flink.table.catalog;
 
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.table.api.Schema;
 import org.apache.flink.table.api.TableSchema;
 import org.apache.flink.table.factories.DynamicTableFactory;
 
 import java.util.Map;
 import java.util.Optional;
 
 /**
- * CatalogBaseTable is the common parent of table and view. It has a map of key-value pairs defining
- * the properties of the table.
+ * A common parent that describes the <i>unresolved</i> metadata of a table or view in a catalog.
+ *
+ * @see CatalogTable
+ * @see CatalogView
  */
+@PublicEvolving
 public interface CatalogBaseTable {
 
+    /** The kind of {@link CatalogBaseTable}. */
+    enum TableKind {

Review comment:
       Is "TableKind" the correct abstraction to use if one value is "Table"? If we e.g. enumerate types of apples, then AppleKind.GRANNY_SMITH is reasonable, but AppleKind.APPLE sounds out of place. A "table" is not a "kind of table" unless "table" has an ambiguous definition.
   
   I sort of feel the same way here. `CatalogBaseTable` has that problem, too, but that class existed already, so we probably can't rename it easily now.




----------------------------------------------------------------
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 #15137: [FLINK-21396][table] Resolve tables when calling Catalog.createTable/alterTable

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14394",
       "triggerID" : "a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14394) 
   
   <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 #15137: [FLINK-21396][table] Resolve tables when calling Catalog.createTable/alterTable

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14394",
       "triggerID" : "a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0efc54ad7cd690e5eabe96b3fd6545d9e0c321d0",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14461",
       "triggerID" : "0efc54ad7cd690e5eabe96b3fd6545d9e0c321d0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14394) 
   * 0efc54ad7cd690e5eabe96b3fd6545d9e0c321d0 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14461) 
   
   <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 #15137: [FLINK-21396][table] Resolve tables when calling Catalog.createTable/alterTable

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14394",
       "triggerID" : "a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0efc54ad7cd690e5eabe96b3fd6545d9e0c321d0",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0efc54ad7cd690e5eabe96b3fd6545d9e0c321d0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14394) 
   * 0efc54ad7cd690e5eabe96b3fd6545d9e0c321d0 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] Airblader commented on a change in pull request #15137: [FLINK-21396][table] Resolve tables when calling Catalog.createTable/alterTable

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



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CatalogBaseTable.java
##########
@@ -18,18 +18,32 @@
 
 package org.apache.flink.table.catalog;
 
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.table.api.Schema;
 import org.apache.flink.table.api.TableSchema;
 import org.apache.flink.table.factories.DynamicTableFactory;
 
 import java.util.Map;
 import java.util.Optional;
 
 /**
- * CatalogBaseTable is the common parent of table and view. It has a map of key-value pairs defining
- * the properties of the table.
+ * A common parent that describes the <i>unresolved</i> metadata of a table or view in a catalog.
+ *
+ * @see CatalogTable
+ * @see CatalogView
  */
+@PublicEvolving
 public interface CatalogBaseTable {
 
+    /** The kind of {@link CatalogBaseTable}. */
+    enum TableKind {

Review comment:
       OK. Yeah, I am also struggling to come up with something – it's certainly possible, but while maybe more "correct", TableKind definitely seems easier. Let's stick with it then.




----------------------------------------------------------------
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 #15137: [FLINK-21396][table] Resolve tables when calling Catalog.createTable/alterTable

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



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CatalogBaseTable.java
##########
@@ -18,18 +18,32 @@
 
 package org.apache.flink.table.catalog;
 
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.table.api.Schema;
 import org.apache.flink.table.api.TableSchema;
 import org.apache.flink.table.factories.DynamicTableFactory;
 
 import java.util.Map;
 import java.util.Optional;
 
 /**
- * CatalogBaseTable is the common parent of table and view. It has a map of key-value pairs defining
- * the properties of the table.
+ * A common parent that describes the <i>unresolved</i> metadata of a table or view in a catalog.
+ *
+ * @see CatalogTable
+ * @see CatalogView
  */
+@PublicEvolving
 public interface CatalogBaseTable {
 
+    /** The kind of {@link CatalogBaseTable}. */
+    enum TableKind {

Review comment:
       We were also discussing about the name in the past but couldn't come up with a better name.
   
   Some background: a view is commonly defined as a `virtual table`. See https://www.geeksforgeeks.org/sql-views/ or https://www.w3schools.com/sql/sql_ref_create_view.asp or Wikipedia. So we have to distinguish between a `real/base table` (= table) or `virtual table` (=view). The common name is still table unless you have a better idea :(




----------------------------------------------------------------
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 #15137: [FLINK-21396][table] Resolve tables when calling Catalog.createTable/alterTable

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



##########
File path: flink-table/flink-table-planner-blink/src/test/java/org/apache/flink/table/planner/runtime/stream/sql/FunctionITCase.java
##########
@@ -1095,7 +1095,7 @@ public void testTimestampNotNull() {
         TestCollectionTableFactory.initData(sourceData);
 
         tEnv().executeSql(
-                        "CREATE TABLE SourceTable(i INT, ts AS LOCALTIMESTAMP, WATERMARK FOR ts AS ts) "
+                        "CREATE TABLE SourceTable(i INT, ts AS CAST(LOCALTIMESTAMP AS TIMESTAMP(3)), WATERMARK FOR ts AS ts) "

Review comment:
       It was necessary, because the new schema validator is a bit more strict when it comes to precision. Currently, we only support time attributes of precision 3. As documented here: https://ci.apache.org/projects/flink/flink-docs-release-1.12/dev/table/sql/create.html#watermark a couple of locations violated this.




----------------------------------------------------------------
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 #15137: [FLINK-21396][table] Resolve tables when calling Catalog.createTable/alterTable

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14394",
       "triggerID" : "a66b0e7f8e7d3c8432b7b06b7d9ed92e0e991608",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0efc54ad7cd690e5eabe96b3fd6545d9e0c321d0",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14461",
       "triggerID" : "0efc54ad7cd690e5eabe96b3fd6545d9e0c321d0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0efc54ad7cd690e5eabe96b3fd6545d9e0c321d0 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14461) 
   
   <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