{"action":"created","comment":{"url":"https://api.github.com/repos/lincoln-lil/flink/pulls/comments/114926045","pull_request_review_id":36428832,"id":114926045,"diff_hunk":"@@ -464,21 +477,52 @@ abstract class TableEnvironment(val config: TableConfig) {\n     *   tEnv.sql(s\"SELECT * FROM $table\")\n     * }}}\n     *\n-    * @param query The SQL query to evaluate.\n-    * @return The result of the query as Table.\n+    * @param sql The SQL string to evaluate.\n+    * @return The result of the query as Table or null of the DML insert operation.\n     */\n-  def sql(query: String): Table = {\n+  def sql(sql: String): Table = {\n     val planner = new FlinkPlannerImpl(getFrameworkConfig, getPlanner, getTypeFactory)\n     // parse the sql query\n-    val parsed = planner.parse(query)\n+    val parsed = planner.parse(sql)\n     // validate the sql query\n     val validated = planner.validate(parsed)\n-    // transform to a relational tree\n-    val relational = planner.rel(validated)\n \n-    new Table(this, LogicalRelNode(relational.rel))\n+    // separate source translation if DML insert, considering sink operation has no output but all\n+    // RelNodes' translation should return a DataSet/DataStream, and Calcite's TableModify\n+    // defines output for DML(INSERT,DELETE,UPDATE) is a RowCount column of BigInt type. This a\n+    // work around since we have no conclusion for the output type definition of sink operation\n+    // (compare to traditional SQL insert).\n+    if (parsed.isInstanceOf[SqlInsert]) {\n+      val insert = parsed.asInstanceOf[SqlInsert]\n+      // validate sink table\n+      val targetName = insert.getTargetTable.asInstanceOf[SqlIdentifier].names.get(0)\n+      val targetTable = getTable(targetName)\n+      if (null == targetTable || !targetTable.isInstanceOf[TableSinkTable[_]]) {\n+        throw new TableException(\"SQL DML INSERT operation need a registered TableSink Table!\")\n+      }\n+      // validate unsupported partial insertion to sink table\n+      val sinkTable = targetTable.asInstanceOf[TableSinkTable[_]]\n+      if (null != insert.getTargetColumnList && insert.getTargetColumnList.size() !=","path":"flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/TableEnvironment.scala","position":95,"original_position":95,"commit_id":"a215273b01e204085f0948648df593afb7aec753","original_commit_id":"a215273b01e204085f0948648df593afb7aec753","user":{"login":"hequn8128","id":4971479,"avatar_url":"https://avatars1.githubusercontent.com/u/4971479?v=3","gravatar_id":"","url":"https://api.github.com/users/hequn8128","html_url":"https://github.com/hequn8128","followers_url":"https://api.github.com/users/hequn8128/followers","following_url":"https://api.github.com/users/hequn8128/following{/other_user}","gists_url":"https://api.github.com/users/hequn8128/gists{/gist_id}","starred_url":"https://api.github.com/users/hequn8128/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hequn8128/subscriptions","organizations_url":"https://api.github.com/users/hequn8128/orgs","repos_url":"https://api.github.com/users/hequn8128/repos","events_url":"https://api.github.com/users/hequn8128/events{/privacy}","received_events_url":"https://api.github.com/users/hequn8128/received_events","type":"User","site_admin":false},"body":"rowType是不是也要一样","created_at":"2017-05-05T03:06:06Z","updated_at":"2017-05-05T03:06:25Z","html_url":"https://github.com/lincoln-lil/flink/pull/2#discussion_r114926045","pull_request_url":"https://api.github.com/repos/lincoln-lil/flink/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/lincoln-lil/flink/pulls/comments/114926045"},"html":{"href":"https://github.com/lincoln-lil/flink/pull/2#discussion_r114926045"},"pull_request":{"href":"https://api.github.com/repos/lincoln-lil/flink/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/lincoln-lil/flink/pulls/2","id":118938194,"html_url":"https://github.com/lincoln-lil/flink/pull/2","diff_url":"https://github.com/lincoln-lil/flink/pull/2.diff","patch_url":"https://github.com/lincoln-lil/flink/pull/2.patch","issue_url":"https://api.github.com/repos/lincoln-lil/flink/issues/2","number":2,"state":"open","locked":false,"title":"[FLINK-6442] [table] Extend TableAPI Support Sink Table Registration …","user":{"login":"lincoln-lil","id":3712895,"avatar_url":"https://avatars1.githubusercontent.com/u/3712895?v=3","gravatar_id":"","url":"https://api.github.com/users/lincoln-lil","html_url":"https://github.com/lincoln-lil","followers_url":"https://api.github.com/users/lincoln-lil/followers","following_url":"https://api.github.com/users/lincoln-lil/following{/other_user}","gists_url":"https://api.github.com/users/lincoln-lil/gists{/gist_id}","starred_url":"https://api.github.com/users/lincoln-lil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lincoln-lil/subscriptions","organizations_url":"https://api.github.com/users/lincoln-lil/orgs","repos_url":"https://api.github.com/users/lincoln-lil/repos","events_url":"https://api.github.com/users/lincoln-lil/events{/privacy}","received_events_url":"https://api.github.com/users/lincoln-lil/received_events","type":"User","site_admin":false},"body":"…and ‘insert into’ Clause in SQL\r\n\r\nThanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.\r\nIf 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).\r\nIn addition to going through the list, please provide a meaningful description of your changes.\r\n\r\n- [ ] General\r\n  - The pull request references the related JIRA issue (\"[FLINK-XXX] Jira title text\")\r\n  - The pull request addresses only one issue\r\n  - Each commit in the PR has a meaningful commit message (including the JIRA id)\r\n\r\n- [ ] Documentation\r\n  - Documentation has been added for new functionality\r\n  - Old documentation affected by the pull request has been updated\r\n  - JavaDoc for public methods has been added\r\n\r\n- [ ] Tests & Build\r\n  - Functionality added by the pull request is covered by tests\r\n  - `mvn clean verify` has been executed successfully locally or a Travis build has passed\r\n","created_at":"2017-05-04T10:08:46Z","updated_at":"2017-05-05T03:06:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a523daea49804d417b3b54ffb94bac9caaa61fbc","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/lincoln-lil/flink/pulls/2/commits","review_comments_url":"https://api.github.com/repos/lincoln-lil/flink/pulls/2/comments","review_comment_url":"https://api.github.com/repos/lincoln-lil/flink/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lincoln-lil/flink/issues/2/comments","statuses_url":"https://api.github.com/repos/lincoln-lil/flink/statuses/a215273b01e204085f0948648df593afb7aec753","head":{"label":"lincoln-lil:FLINK-6442","ref":"FLINK-6442","sha":"a215273b01e204085f0948648df593afb7aec753","user":{"login":"lincoln-lil","id":3712895,"avatar_url":"https://avatars1.githubusercontent.com/u/3712895?v=3","gravatar_id":"","url":"https://api.github.com/users/lincoln-lil","html_url":"https://github.com/lincoln-lil","followers_url":"https://api.github.com/users/lincoln-lil/followers","following_url":"https://api.github.com/users/lincoln-lil/following{/other_user}","gists_url":"https://api.github.com/users/lincoln-lil/gists{/gist_id}","starred_url":"https://api.github.com/users/lincoln-lil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lincoln-lil/subscriptions","organizations_url":"https://api.github.com/users/lincoln-lil/orgs","repos_url":"https://api.github.com/users/lincoln-lil/repos","events_url":"https://api.github.com/users/lincoln-lil/events{/privacy}","received_events_url":"https://api.github.com/users/lincoln-lil/received_events","type":"User","site_admin":false},"repo":{"id":70389338,"name":"flink","full_name":"lincoln-lil/flink","owner":{"login":"lincoln-lil","id":3712895,"avatar_url":"https://avatars1.githubusercontent.com/u/3712895?v=3","gravatar_id":"","url":"https://api.github.com/users/lincoln-lil","html_url":"https://github.com/lincoln-lil","followers_url":"https://api.github.com/users/lincoln-lil/followers","following_url":"https://api.github.com/users/lincoln-lil/following{/other_user}","gists_url":"https://api.github.com/users/lincoln-lil/gists{/gist_id}","starred_url":"https://api.github.com/users/lincoln-lil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lincoln-lil/subscriptions","organizations_url":"https://api.github.com/users/lincoln-lil/orgs","repos_url":"https://api.github.com/users/lincoln-lil/repos","events_url":"https://api.github.com/users/lincoln-lil/events{/privacy}","received_events_url":"https://api.github.com/users/lincoln-lil/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lincoln-lil/flink","description":"Mirror of Apache Flink","fork":true,"url":"https://api.github.com/repos/lincoln-lil/flink","forks_url":"https://api.github.com/repos/lincoln-lil/flink/forks","keys_url":"https://api.github.com/repos/lincoln-lil/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lincoln-lil/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lincoln-lil/flink/teams","hooks_url":"https://api.github.com/repos/lincoln-lil/flink/hooks","issue_events_url":"https://api.github.com/repos/lincoln-lil/flink/issues/events{/number}","events_url":"https://api.github.com/repos/lincoln-lil/flink/events","assignees_url":"https://api.github.com/repos/lincoln-lil/flink/assignees{/user}","branches_url":"https://api.github.com/repos/lincoln-lil/flink/branches{/branch}","tags_url":"https://api.github.com/repos/lincoln-lil/flink/tags","blobs_url":"https://api.github.com/repos/lincoln-lil/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lincoln-lil/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lincoln-lil/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/lincoln-lil/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lincoln-lil/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/lincoln-lil/flink/languages","stargazers_url":"https://api.github.com/repos/lincoln-lil/flink/stargazers","contributors_url":"https://api.github.com/repos/lincoln-lil/flink/contributors","subscribers_url":"https://api.github.com/repos/lincoln-lil/flink/subscribers","subscription_url":"https://api.github.com/repos/lincoln-lil/flink/subscription","commits_url":"https://api.github.com/repos/lincoln-lil/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/lincoln-lil/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/lincoln-lil/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/lincoln-lil/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/lincoln-lil/flink/contents/{+path}","compare_url":"https://api.github.com/repos/lincoln-lil/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lincoln-lil/flink/merges","archive_url":"https://api.github.com/repos/lincoln-lil/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lincoln-lil/flink/downloads","issues_url":"https://api.github.com/repos/lincoln-lil/flink/issues{/number}","pulls_url":"https://api.github.com/repos/lincoln-lil/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/lincoln-lil/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/lincoln-lil/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lincoln-lil/flink/labels{/name}","releases_url":"https://api.github.com/repos/lincoln-lil/flink/releases{/id}","deployments_url":"https://api.github.com/repos/lincoln-lil/flink/deployments","created_at":"2016-10-09T08:34:47Z","updated_at":"2016-10-09T08:35:10Z","pushed_at":"2017-05-05T02:00:15Z","git_url":"git://github.com/lincoln-lil/flink.git","ssh_url":"git@github.com:lincoln-lil/flink.git","clone_url":"https://github.com/lincoln-lil/flink.git","svn_url":"https://github.com/lincoln-lil/flink","homepage":null,"size":117796,"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,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"lincoln-lil:master","ref":"master","sha":"c969237fce4fe5394e1cfdbb1186db63333d73d0","user":{"login":"lincoln-lil","id":3712895,"avatar_url":"https://avatars1.githubusercontent.com/u/3712895?v=3","gravatar_id":"","url":"https://api.github.com/users/lincoln-lil","html_url":"https://github.com/lincoln-lil","followers_url":"https://api.github.com/users/lincoln-lil/followers","following_url":"https://api.github.com/users/lincoln-lil/following{/other_user}","gists_url":"https://api.github.com/users/lincoln-lil/gists{/gist_id}","starred_url":"https://api.github.com/users/lincoln-lil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lincoln-lil/subscriptions","organizations_url":"https://api.github.com/users/lincoln-lil/orgs","repos_url":"https://api.github.com/users/lincoln-lil/repos","events_url":"https://api.github.com/users/lincoln-lil/events{/privacy}","received_events_url":"https://api.github.com/users/lincoln-lil/received_events","type":"User","site_admin":false},"repo":{"id":70389338,"name":"flink","full_name":"lincoln-lil/flink","owner":{"login":"lincoln-lil","id":3712895,"avatar_url":"https://avatars1.githubusercontent.com/u/3712895?v=3","gravatar_id":"","url":"https://api.github.com/users/lincoln-lil","html_url":"https://github.com/lincoln-lil","followers_url":"https://api.github.com/users/lincoln-lil/followers","following_url":"https://api.github.com/users/lincoln-lil/following{/other_user}","gists_url":"https://api.github.com/users/lincoln-lil/gists{/gist_id}","starred_url":"https://api.github.com/users/lincoln-lil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lincoln-lil/subscriptions","organizations_url":"https://api.github.com/users/lincoln-lil/orgs","repos_url":"https://api.github.com/users/lincoln-lil/repos","events_url":"https://api.github.com/users/lincoln-lil/events{/privacy}","received_events_url":"https://api.github.com/users/lincoln-lil/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lincoln-lil/flink","description":"Mirror of Apache Flink","fork":true,"url":"https://api.github.com/repos/lincoln-lil/flink","forks_url":"https://api.github.com/repos/lincoln-lil/flink/forks","keys_url":"https://api.github.com/repos/lincoln-lil/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lincoln-lil/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lincoln-lil/flink/teams","hooks_url":"https://api.github.com/repos/lincoln-lil/flink/hooks","issue_events_url":"https://api.github.com/repos/lincoln-lil/flink/issues/events{/number}","events_url":"https://api.github.com/repos/lincoln-lil/flink/events","assignees_url":"https://api.github.com/repos/lincoln-lil/flink/assignees{/user}","branches_url":"https://api.github.com/repos/lincoln-lil/flink/branches{/branch}","tags_url":"https://api.github.com/repos/lincoln-lil/flink/tags","blobs_url":"https://api.github.com/repos/lincoln-lil/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lincoln-lil/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lincoln-lil/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/lincoln-lil/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lincoln-lil/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/lincoln-lil/flink/languages","stargazers_url":"https://api.github.com/repos/lincoln-lil/flink/stargazers","contributors_url":"https://api.github.com/repos/lincoln-lil/flink/contributors","subscribers_url":"https://api.github.com/repos/lincoln-lil/flink/subscribers","subscription_url":"https://api.github.com/repos/lincoln-lil/flink/subscription","commits_url":"https://api.github.com/repos/lincoln-lil/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/lincoln-lil/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/lincoln-lil/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/lincoln-lil/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/lincoln-lil/flink/contents/{+path}","compare_url":"https://api.github.com/repos/lincoln-lil/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lincoln-lil/flink/merges","archive_url":"https://api.github.com/repos/lincoln-lil/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lincoln-lil/flink/downloads","issues_url":"https://api.github.com/repos/lincoln-lil/flink/issues{/number}","pulls_url":"https://api.github.com/repos/lincoln-lil/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/lincoln-lil/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/lincoln-lil/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lincoln-lil/flink/labels{/name}","releases_url":"https://api.github.com/repos/lincoln-lil/flink/releases{/id}","deployments_url":"https://api.github.com/repos/lincoln-lil/flink/deployments","created_at":"2016-10-09T08:34:47Z","updated_at":"2016-10-09T08:35:10Z","pushed_at":"2017-05-05T02:00:15Z","git_url":"git://github.com/lincoln-lil/flink.git","ssh_url":"git@github.com:lincoln-lil/flink.git","clone_url":"https://github.com/lincoln-lil/flink.git","svn_url":"https://github.com/lincoln-lil/flink","homepage":null,"size":117796,"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,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lincoln-lil/flink/pulls/2"},"html":{"href":"https://github.com/lincoln-lil/flink/pull/2"},"issue":{"href":"https://api.github.com/repos/lincoln-lil/flink/issues/2"},"comments":{"href":"https://api.github.com/repos/lincoln-lil/flink/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/lincoln-lil/flink/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/lincoln-lil/flink/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lincoln-lil/flink/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/lincoln-lil/flink/statuses/a215273b01e204085f0948648df593afb7aec753"}}}}
{"actor":{"display_login":"hequn8128"}}