[jira] [Commented] (FLINK-4288) Make it possible to unregister tables

2017-01-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/FLINK-4288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15801580#comment-15801580
 ] 

ASF GitHub Bot commented on FLINK-4288:
---

Github user asfgit closed the pull request at:

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


> Make it possible to unregister tables
> -
>
> Key: FLINK-4288
> URL: https://issues.apache.org/jira/browse/FLINK-4288
> Project: Flink
>  Issue Type: Improvement
>  Components: Table API & SQL
>Reporter: Timo Walther
>Assignee: Timo Walther
>
> Table names can not be changed yet. After registration you can not modify the 
> table behind a table name. Maybe this behavior is too restrictive.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (FLINK-4288) Make it possible to unregister tables

2017-01-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/FLINK-4288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15801519#comment-15801519
 ] 

ASF GitHub Bot commented on FLINK-4288:
---

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.


> Make it possible to unregister tables
> -
>
> Key: FLINK-4288
> URL: https://issues.apache.org/jira/browse/FLINK-4288
> Project: Flink
>  Issue Type: Improvement
>  Components: Table API & SQL
>Reporter: Timo Walther
>Assignee: Timo Walther
>
> Table names can not be changed yet. After registration you can not modify the 
> table behind a table name. Maybe this behavior is too restrictive.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (FLINK-4288) Make it possible to unregister tables

2017-01-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/FLINK-4288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15801452#comment-15801452
 ] 

ASF GitHub Bot commented on FLINK-4288:
---

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.


> Make it possible to unregister tables
> -
>
> Key: FLINK-4288
> URL: https://issues.apache.org/jira/browse/FLINK-4288
> Project: Flink
>  Issue Type: Improvement
>  Components: Table API & SQL
>Reporter: Timo Walther
>Assignee: Timo Walther
>
> Table names can not be changed yet. After registration you can not modify the 
> table behind a table name. Maybe this behavior is too restrictive.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (FLINK-4288) Make it possible to unregister tables

2017-01-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/FLINK-4288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15801453#comment-15801453
 ] 

ASF GitHub Bot commented on FLINK-4288:
---

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 
Date:   2017-01-05T14:13:13Z

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




> Make it possible to unregister tables
> -
>
> Key: FLINK-4288
> URL: https://issues.apache.org/jira/browse/FLINK-4288
> Project: Flink
>  Issue Type: Improvement
>  Components: Table API & SQL
>Reporter: Timo Walther
>Assignee: Timo Walther
>
> Table names can not be changed yet. After registration you can not modify the 
> table behind a table name. Maybe this behavior is too restrictive.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (FLINK-4288) Make it possible to unregister tables

2017-01-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/FLINK-4288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15801439#comment-15801439
 ] 

ASF GitHub Bot commented on FLINK-4288:
---

Github user twalthr closed the pull request at:

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


> Make it possible to unregister tables
> -
>
> Key: FLINK-4288
> URL: https://issues.apache.org/jira/browse/FLINK-4288
> Project: Flink
>  Issue Type: Improvement
>  Components: Table API & SQL
>Reporter: Timo Walther
>Assignee: Timo Walther
>
> Table names can not be changed yet. After registration you can not modify the 
> table behind a table name. Maybe this behavior is too restrictive.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (FLINK-4288) Make it possible to unregister tables

2016-11-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/FLINK-4288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15677737#comment-15677737
 ] 

ASF GitHub Bot commented on FLINK-4288:
---

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?



> Make it possible to unregister tables
> -
>
> Key: FLINK-4288
> URL: https://issues.apache.org/jira/browse/FLINK-4288
> Project: Flink
>  Issue Type: Improvement
>  Components: Table API & SQL
>Reporter: Timo Walther
>Assignee: Timo Walther
>
> Table names can not be changed yet. After registration you can not modify the 
> table behind a table name. Maybe this behavior is too restrictive.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (FLINK-4288) Make it possible to unregister tables

2016-11-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/FLINK-4288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15677735#comment-15677735
 ] 

ASF GitHub Bot commented on FLINK-4288:
---

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?


> Make it possible to unregister tables
> -
>
> Key: FLINK-4288
> URL: https://issues.apache.org/jira/browse/FLINK-4288
> Project: Flink
>  Issue Type: Improvement
>  Components: Table API & SQL
>Reporter: Timo Walther
>Assignee: Timo Walther
>
> Table names can not be changed yet. After registration you can not modify the 
> table behind a table name. Maybe this behavior is too restrictive.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (FLINK-4288) Make it possible to unregister tables

2016-11-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/FLINK-4288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15677736#comment-15677736
 ] 

ASF GitHub Bot commented on FLINK-4288:
---

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


> Make it possible to unregister tables
> -
>
> Key: FLINK-4288
> URL: https://issues.apache.org/jira/browse/FLINK-4288
> Project: Flink
>  Issue Type: Improvement
>  Components: Table API & SQL
>Reporter: Timo Walther
>Assignee: Timo Walther
>
> Table names can not be changed yet. After registration you can not modify the 
> table behind a table name. Maybe this behavior is too restrictive.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (FLINK-4288) Make it possible to unregister tables

2016-09-19 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/FLINK-4288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15503274#comment-15503274
 ] 

ASF GitHub Bot commented on FLINK-4288:
---

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 
Date:   2016-09-19T12:09:14Z

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




> Make it possible to unregister tables
> -
>
> Key: FLINK-4288
> URL: https://issues.apache.org/jira/browse/FLINK-4288
> Project: Flink
>  Issue Type: Improvement
>  Components: Table API & SQL
>Reporter: Timo Walther
>Assignee: Timo Walther
>
> Table names can not be changed yet. After registration you can not modify the 
> table behind a table name. Maybe this behavior is too restrictive.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (FLINK-4288) Make it possible to unregister tables

2016-08-03 Thread Jark Wu (JIRA)

[ 
https://issues.apache.org/jira/browse/FLINK-4288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15407083#comment-15407083
 ] 

Jark Wu commented on FLINK-4288:


Because {{SchemaPlus}} has no {{remove}} function, we can't unregister tables 
easily. Do you have any ideas to do this ? 

> Make it possible to unregister tables
> -
>
> Key: FLINK-4288
> URL: https://issues.apache.org/jira/browse/FLINK-4288
> Project: Flink
>  Issue Type: Improvement
>  Components: Table API & SQL
>Reporter: Timo Walther
>
> Table names can not be changed yet. After registration you can not modify the 
> table behind a table name. Maybe this behavior is too restrictive.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)