You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by twalthr <gi...@git.apache.org> on 2016/09/19 12:31:40 UTC

[GitHub] flink pull request #2511: [FLINK-4288] [table] Make it possible to unregiste...

GitHub user twalthr opened a pull request:

    https://github.com/apache/flink/pull/2511

    [FLINK-4288] [table] Make it possible to unregister tables

    Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.
    If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the [How To Contribute guide](http://flink.apache.org/how-to-contribute.html).
    In addition to going through the list, please provide a meaningful description of your changes.
    
    - [x] General
      - The pull request references the related JIRA issue ("[FLINK-XXX] Jira title text")
      - The pull request addresses only one issue
      - Each commit in the PR has a meaningful commit message (including the JIRA id)
    
    - [ ] Documentation
      - Documentation has been added for new functionality
      - Old documentation affected by the pull request has been updated
      - JavaDoc for public methods has been added
    
    - [x] Tests & Build
      - Functionality added by the pull request is covered by tests
      - `mvn clean verify` has been executed successfully locally or a Travis build has passed
    
    This PR adds the possibility to unregister tables. Although Calcite supports mutable schemas, deleting a table instead of replacing it was not easy to implement. I will add some documentation if you are fine with this PR.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/twalthr/flink FLINK-4288

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/2511.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2511
    
----
commit 0ecb6138680498bdacb134eff1609b21cbb07cd9
Author: twalthr <tw...@apache.org>
Date:   2016-09-19T12:09:14Z

    [FLINK-4288] [table] Make it possible to unregister tables

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2511: [FLINK-4288] [table] Make it possible to unregiste...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2511#discussion_r88737982
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/TableEnvironment.scala ---
    @@ -133,12 +134,24 @@ abstract class TableEnvironment(val config: TableConfig) {
             registerTableInternal(name, tableTable)
           case e: StreamTableEnvironment =>
             val sTableTable = new TransStreamTable(table.getRelNode, true)
    -        tables.add(name, sTableTable)
    +        schema.addTable(name, sTableTable)
         }
     
       }
     
       /**
    +    * Unregisters a [[Table]] in the TableEnvironment's catalog.
    +    * Unregistered tables cannot be referenced in SQL queries anymore.
    +    *
    +    * @param name The name under which the table is registered.
    +    */
    +  def unregisterTable(name: String): Unit = {
    --- End diff --
    
    Do we want to return a boolean success value or throw an exception if the table does not exist?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2511: [FLINK-4288] [table] Make it possible to unregiste...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2511#discussion_r88737974
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/TableEnvironment.scala ---
    @@ -133,12 +134,24 @@ abstract class TableEnvironment(val config: TableConfig) {
             registerTableInternal(name, tableTable)
           case e: StreamTableEnvironment =>
             val sTableTable = new TransStreamTable(table.getRelNode, true)
    -        tables.add(name, sTableTable)
    +        schema.addTable(name, sTableTable)
         }
     
       }
     
       /**
    +    * Unregisters a [[Table]] in the TableEnvironment's catalog.
    +    * Unregistered tables cannot be referenced in SQL queries anymore.
    +    *
    +    * @param name The name under which the table is registered.
    +    */
    +  def unregisterTable(name: String): Unit = {
    +
    +    checkValidTableName(name)
    --- End diff --
    
    Do we need to check if the name is valid? Couldn't we just try to delete it?



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2511: [FLINK-4288] [table] Make it possible to unregiste...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2511#discussion_r88737674
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/FlinkSchema.scala ---
    @@ -0,0 +1,57 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.api.table
    +
    +import java.util
    +
    +import org.apache.calcite.jdbc.CalciteSchema
    +import org.apache.calcite.jdbc.CalciteSchema.TableEntry
    +import org.apache.calcite.schema
    +import org.apache.calcite.schema.SchemaPlus
    +
    +/**
    +  * Wraps [[CalciteSchema]] and allows for deleting tables.
    +  */
    +class FlinkSchema {
    --- End diff --
    
    I think the benefit of this wrapper is rather limited.
    Couldn't we just call `schema.tableMap.remove()` in `TableEnvironment`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2511: [FLINK-4288] [table] Make it possible to unregiste...

Posted by twalthr <gi...@git.apache.org>.
GitHub user twalthr reopened a pull request:

    https://github.com/apache/flink/pull/2511

    [FLINK-4288] [table] Make it possible to unregister tables

    Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.
    If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the [How To Contribute guide](http://flink.apache.org/how-to-contribute.html).
    In addition to going through the list, please provide a meaningful description of your changes.
    - [x] General
      - The pull request references the related JIRA issue ("[FLINK-XXX] Jira title text")
      - The pull request addresses only one issue
      - Each commit in the PR has a meaningful commit message (including the JIRA id)
    - [ ] Documentation
      - Documentation has been added for new functionality
      - Old documentation affected by the pull request has been updated
      - JavaDoc for public methods has been added
    - [x] Tests & Build
      - Functionality added by the pull request is covered by tests
      - `mvn clean verify` has been executed successfully locally or a Travis build has passed
    
    This PR adds the possibility to unregister tables. Although Calcite supports mutable schemas, deleting a table instead of replacing it was not easy to implement. I will add some documentation if you are fine with this PR.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/twalthr/flink FLINK-4288

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/2511.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2511
    
----
commit 4b710ce5eee8629de691bb4cc2c7f9f7c3f76dcc
Author: twalthr <tw...@apache.org>
Date:   2017-01-05T14:13:13Z

    [FLINK-4288] [table] Make it possible to unregister tables

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2511: [FLINK-4288] [table] Make it possible to unregister table...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on the issue:

    https://github.com/apache/flink/pull/2511
  
    Thanks for the update. +1 to merge.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2511: [FLINK-4288] [table] Make it possible to unregister table...

Posted by twalthr <gi...@git.apache.org>.
Github user twalthr commented on the issue:

    https://github.com/apache/flink/pull/2511
  
    Thanks @fhueske. I will add some sentences to the documentation and merge this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2511: [FLINK-4288] [table] Make it possible to unregiste...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/flink/pull/2511


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2511: [FLINK-4288] [table] Make it possible to unregiste...

Posted by twalthr <gi...@git.apache.org>.
Github user twalthr closed the pull request at:

    https://github.com/apache/flink/pull/2511


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2511: [FLINK-4288] [table] Make it possible to unregister table...

Posted by twalthr <gi...@git.apache.org>.
Github user twalthr commented on the issue:

    https://github.com/apache/flink/pull/2511
  
    I updated this PR. I will create a followup issue to refactor all TableEnvironment registration tests to unit tests.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---