{"action":"created","comment":{"url":"https://api.github.com/repos/apache/beam/pulls/comments/186171129","pull_request_review_id":117705909,"id":186171129,"diff_hunk":"@@ -0,0 +1,100 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  The ASF licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.apache.beam.sdk.extensions.sql.impl;\n+\n+import java.util.Collection;\n+import java.util.Collections;\n+import java.util.HashSet;\n+import java.util.Set;\n+import org.apache.beam.sdk.extensions.sql.meta.Table;\n+import org.apache.beam.sdk.extensions.sql.meta.provider.TableProvider;\n+import org.apache.calcite.linq4j.tree.Expression;\n+import org.apache.calcite.schema.Function;\n+import org.apache.calcite.schema.Schema;\n+import org.apache.calcite.schema.SchemaPlus;\n+import org.apache.calcite.schema.SchemaVersion;\n+import org.apache.calcite.schema.Schemas;\n+\n+/**\n+ * Adapter from {@link TableProvider} to {@link Schema}.\n+ */\n+public class BeamCalciteSchema implements Schema {\n+  private TableProvider tableProvider;\n+\n+  public BeamCalciteSchema(TableProvider tableProvider) {\n+    this.tableProvider = tableProvider;\n+  }\n+\n+  public TableProvider getTableProvider() {\n+    return tableProvider;\n+  }\n+\n+  @Override\n+  public boolean isMutable() {\n+    return true;","path":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/BeamCalciteSchema.java","position":49,"original_position":49,"commit_id":"229fb77c4b480f00de346946d4368cd88b1277c7","original_commit_id":"229fb77c4b480f00de346946d4368cd88b1277c7","user":{"login":"kennknowles","id":575353,"avatar_url":"https://avatars0.githubusercontent.com/u/575353?v=4","gravatar_id":"","url":"https://api.github.com/users/kennknowles","html_url":"https://github.com/kennknowles","followers_url":"https://api.github.com/users/kennknowles/followers","following_url":"https://api.github.com/users/kennknowles/following{/other_user}","gists_url":"https://api.github.com/users/kennknowles/gists{/gist_id}","starred_url":"https://api.github.com/users/kennknowles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kennknowles/subscriptions","organizations_url":"https://api.github.com/users/kennknowles/orgs","repos_url":"https://api.github.com/users/kennknowles/repos","events_url":"https://api.github.com/users/kennknowles/events{/privacy}","received_events_url":"https://api.github.com/users/kennknowles/received_events","type":"User","site_admin":false},"body":"Curious - why? Is it that the underlying `TableProvider` is mutable? Or does this simply mean that the DDL is allowed to introduce new tables?","created_at":"2018-05-04T18:04:22Z","updated_at":"2018-05-04T18:14:15Z","html_url":"https://github.com/apache/beam/pull/5224#discussion_r186171129","pull_request_url":"https://api.github.com/repos/apache/beam/pulls/5224","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/apache/beam/pulls/comments/186171129"},"html":{"href":"https://github.com/apache/beam/pull/5224#discussion_r186171129"},"pull_request":{"href":"https://api.github.com/repos/apache/beam/pulls/5224"}}},"pull_request":{"url":"https://api.github.com/repos/apache/beam/pulls/5224","id":184103157,"html_url":"https://github.com/apache/beam/pull/5224","diff_url":"https://github.com/apache/beam/pull/5224.diff","patch_url":"https://github.com/apache/beam/pull/5224.patch","issue_url":"https://api.github.com/repos/apache/beam/issues/5224","number":5224,"state":"open","locked":false,"title":"[BEAM-4044] [SQL] Add tables via TableStore in Schema, execute DDL in Calcite model","user":{"login":"apilloud","id":5972627,"avatar_url":"https://avatars2.githubusercontent.com/u/5972627?v=4","gravatar_id":"","url":"https://api.github.com/users/apilloud","html_url":"https://github.com/apilloud","followers_url":"https://api.github.com/users/apilloud/followers","following_url":"https://api.github.com/users/apilloud/following{/other_user}","gists_url":"https://api.github.com/users/apilloud/gists{/gist_id}","starred_url":"https://api.github.com/users/apilloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apilloud/subscriptions","organizations_url":"https://api.github.com/users/apilloud/orgs","repos_url":"https://api.github.com/users/apilloud/repos","events_url":"https://api.github.com/users/apilloud/events{/privacy}","received_events_url":"https://api.github.com/users/apilloud/received_events","type":"User","site_admin":false},"body":"This PR moves our TableStore into the Calcite Schema as the only way to provide tables which removes the need to copy tables between the two. It also moves our DDL execution into the rel node, which allows calcite to execute the DDL directly.\r\n\r\n------------------------\r\n\r\nFollow this checklist to help us incorporate your contribution quickly and easily:\r\n\r\n - [X] Make sure there is a [JIRA issue](https://issues.apache.org/jira/projects/BEAM/issues/) filed for the change (usually before you start working on it).  Trivial changes like typos do not require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.\r\n - [X] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue.\r\n - [X] Write a pull request description that is detailed enough to understand:\r\n   - [X] What the pull request does\r\n   - [X] Why it does it\r\n   - [X] How it does it\r\n   - [X] Why this approach\r\n - [X] Each commit in the pull request should have a meaningful subject line and body.\r\n - [X] Run `./gradlew build` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.\r\n - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).\r\n\r\n","created_at":"2018-04-25T17:06:38Z","updated_at":"2018-05-04T18:14:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aa669f6ce60567ec9b10214b7e5137e573ba8f10","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/beam/pulls/5224/commits","review_comments_url":"https://api.github.com/repos/apache/beam/pulls/5224/comments","review_comment_url":"https://api.github.com/repos/apache/beam/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/beam/issues/5224/comments","statuses_url":"https://api.github.com/repos/apache/beam/statuses/229fb77c4b480f00de346946d4368cd88b1277c7","head":{"label":"apilloud:cleanup","ref":"cleanup","sha":"229fb77c4b480f00de346946d4368cd88b1277c7","user":{"login":"apilloud","id":5972627,"avatar_url":"https://avatars2.githubusercontent.com/u/5972627?v=4","gravatar_id":"","url":"https://api.github.com/users/apilloud","html_url":"https://github.com/apilloud","followers_url":"https://api.github.com/users/apilloud/followers","following_url":"https://api.github.com/users/apilloud/following{/other_user}","gists_url":"https://api.github.com/users/apilloud/gists{/gist_id}","starred_url":"https://api.github.com/users/apilloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apilloud/subscriptions","organizations_url":"https://api.github.com/users/apilloud/orgs","repos_url":"https://api.github.com/users/apilloud/repos","events_url":"https://api.github.com/users/apilloud/events{/privacy}","received_events_url":"https://api.github.com/users/apilloud/received_events","type":"User","site_admin":false},"repo":{"id":119748403,"name":"beam","full_name":"apilloud/beam","owner":{"login":"apilloud","id":5972627,"avatar_url":"https://avatars2.githubusercontent.com/u/5972627?v=4","gravatar_id":"","url":"https://api.github.com/users/apilloud","html_url":"https://github.com/apilloud","followers_url":"https://api.github.com/users/apilloud/followers","following_url":"https://api.github.com/users/apilloud/following{/other_user}","gists_url":"https://api.github.com/users/apilloud/gists{/gist_id}","starred_url":"https://api.github.com/users/apilloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apilloud/subscriptions","organizations_url":"https://api.github.com/users/apilloud/orgs","repos_url":"https://api.github.com/users/apilloud/repos","events_url":"https://api.github.com/users/apilloud/events{/privacy}","received_events_url":"https://api.github.com/users/apilloud/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/apilloud/beam","description":"Apache Beam","fork":true,"url":"https://api.github.com/repos/apilloud/beam","forks_url":"https://api.github.com/repos/apilloud/beam/forks","keys_url":"https://api.github.com/repos/apilloud/beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apilloud/beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apilloud/beam/teams","hooks_url":"https://api.github.com/repos/apilloud/beam/hooks","issue_events_url":"https://api.github.com/repos/apilloud/beam/issues/events{/number}","events_url":"https://api.github.com/repos/apilloud/beam/events","assignees_url":"https://api.github.com/repos/apilloud/beam/assignees{/user}","branches_url":"https://api.github.com/repos/apilloud/beam/branches{/branch}","tags_url":"https://api.github.com/repos/apilloud/beam/tags","blobs_url":"https://api.github.com/repos/apilloud/beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apilloud/beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apilloud/beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/apilloud/beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apilloud/beam/statuses/{sha}","languages_url":"https://api.github.com/repos/apilloud/beam/languages","stargazers_url":"https://api.github.com/repos/apilloud/beam/stargazers","contributors_url":"https://api.github.com/repos/apilloud/beam/contributors","subscribers_url":"https://api.github.com/repos/apilloud/beam/subscribers","subscription_url":"https://api.github.com/repos/apilloud/beam/subscription","commits_url":"https://api.github.com/repos/apilloud/beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/apilloud/beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/apilloud/beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/apilloud/beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/apilloud/beam/contents/{+path}","compare_url":"https://api.github.com/repos/apilloud/beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apilloud/beam/merges","archive_url":"https://api.github.com/repos/apilloud/beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apilloud/beam/downloads","issues_url":"https://api.github.com/repos/apilloud/beam/issues{/number}","pulls_url":"https://api.github.com/repos/apilloud/beam/pulls{/number}","milestones_url":"https://api.github.com/repos/apilloud/beam/milestones{/number}","notifications_url":"https://api.github.com/repos/apilloud/beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apilloud/beam/labels{/name}","releases_url":"https://api.github.com/repos/apilloud/beam/releases{/id}","deployments_url":"https://api.github.com/repos/apilloud/beam/deployments","created_at":"2018-01-31T21:54:20Z","updated_at":"2018-01-31T21:54:33Z","pushed_at":"2018-05-03T23:09:35Z","git_url":"git://github.com/apilloud/beam.git","ssh_url":"git@github.com:apilloud/beam.git","clone_url":"https://github.com/apilloud/beam.git","svn_url":"https://github.com/apilloud/beam","homepage":"","size":58016,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"797908421efa94bb1cedf2a96a435f877c27e98b","user":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":50904245,"name":"beam","full_name":"apache/beam","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/beam","description":"Apache Beam","fork":false,"url":"https://api.github.com/repos/apache/beam","forks_url":"https://api.github.com/repos/apache/beam/forks","keys_url":"https://api.github.com/repos/apache/beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/beam/teams","hooks_url":"https://api.github.com/repos/apache/beam/hooks","issue_events_url":"https://api.github.com/repos/apache/beam/issues/events{/number}","events_url":"https://api.github.com/repos/apache/beam/events","assignees_url":"https://api.github.com/repos/apache/beam/assignees{/user}","branches_url":"https://api.github.com/repos/apache/beam/branches{/branch}","tags_url":"https://api.github.com/repos/apache/beam/tags","blobs_url":"https://api.github.com/repos/apache/beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/beam/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/beam/languages","stargazers_url":"https://api.github.com/repos/apache/beam/stargazers","contributors_url":"https://api.github.com/repos/apache/beam/contributors","subscribers_url":"https://api.github.com/repos/apache/beam/subscribers","subscription_url":"https://api.github.com/repos/apache/beam/subscription","commits_url":"https://api.github.com/repos/apache/beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/beam/contents/{+path}","compare_url":"https://api.github.com/repos/apache/beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/beam/merges","archive_url":"https://api.github.com/repos/apache/beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/beam/downloads","issues_url":"https://api.github.com/repos/apache/beam/issues{/number}","pulls_url":"https://api.github.com/repos/apache/beam/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/beam/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/beam/labels{/name}","releases_url":"https://api.github.com/repos/apache/beam/releases{/id}","deployments_url":"https://api.github.com/repos/apache/beam/deployments","created_at":"2016-02-02T08:00:06Z","updated_at":"2018-05-04T17:44:49Z","pushed_at":"2018-05-04T17:46:20Z","git_url":"git://github.com/apache/beam.git","ssh_url":"git@github.com:apache/beam.git","clone_url":"https://github.com/apache/beam.git","svn_url":"https://github.com/apache/beam","homepage":"","size":58102,"stargazers_count":1849,"watchers_count":1849,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1127,"mirror_url":null,"archived":false,"open_issues_count":100,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":1127,"open_issues":100,"watchers":1849,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/beam/pulls/5224"},"html":{"href":"https://github.com/apache/beam/pull/5224"},"issue":{"href":"https://api.github.com/repos/apache/beam/issues/5224"},"comments":{"href":"https://api.github.com/repos/apache/beam/issues/5224/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/beam/pulls/5224/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/beam/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/beam/pulls/5224/commits"},"statuses":{"href":"https://api.github.com/repos/apache/beam/statuses/229fb77c4b480f00de346946d4368cd88b1277c7"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"kennknowles"}}