{"action":"created","comment":{"url":"https://api.github.com/repos/apache/storm/pulls/comments/75835366","id":75835366,"diff_hunk":"@@ -0,0 +1,155 @@\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+ * <p>\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ * <p>\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.storm.sql.compiler.backends.trident;\n+\n+import org.apache.calcite.rel.RelNode;\n+import org.apache.calcite.rel.core.Aggregate;\n+import org.apache.calcite.rel.core.Calc;\n+import org.apache.calcite.rel.core.Collect;\n+import org.apache.calcite.rel.core.Correlate;\n+import org.apache.calcite.rel.core.Exchange;\n+import org.apache.calcite.rel.core.Filter;\n+import org.apache.calcite.rel.core.Join;\n+import org.apache.calcite.rel.core.Project;\n+import org.apache.calcite.rel.core.Sample;\n+import org.apache.calcite.rel.core.Sort;\n+import org.apache.calcite.rel.core.TableModify;\n+import org.apache.calcite.rel.core.TableScan;\n+import org.apache.calcite.rel.core.Uncollect;\n+import org.apache.calcite.rel.core.Window;\n+import org.apache.calcite.rel.stream.Delta;\n+import org.apache.storm.trident.TridentTopology;\n+import org.apache.storm.trident.fluent.IAggregatableStream;\n+import org.apache.storm.trident.topology.TridentTopologyBuilder;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+public abstract class TridentPostOrderRelNodeVisitor {","path":"external/sql/storm-sql-core/src/jvm/org/apache/storm/sql/compiler/backends/trident/TridentPostOrderRelNodeVisitor.java","position":43,"original_position":43,"commit_id":"67b10af4371f4b8c3d9a36f7dc71fa32b1a69ff7","original_commit_id":"779fea67ca68fde2a197ec98b2524312295b4737","user":{"login":"arunmahadevan","id":6792890,"avatar_url":"https://avatars.githubusercontent.com/u/6792890?v=3","gravatar_id":"","url":"https://api.github.com/users/arunmahadevan","html_url":"https://github.com/arunmahadevan","followers_url":"https://api.github.com/users/arunmahadevan/followers","following_url":"https://api.github.com/users/arunmahadevan/following{/other_user}","gists_url":"https://api.github.com/users/arunmahadevan/gists{/gist_id}","starred_url":"https://api.github.com/users/arunmahadevan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunmahadevan/subscriptions","organizations_url":"https://api.github.com/users/arunmahadevan/orgs","repos_url":"https://api.github.com/users/arunmahadevan/repos","events_url":"https://api.github.com/users/arunmahadevan/events{/privacy}","received_events_url":"https://api.github.com/users/arunmahadevan/received_events","type":"User","site_admin":false},"body":"yes, something along this lines looks good.","created_at":"2016-08-23T09:58:24Z","updated_at":"2016-08-23T09:58:24Z","html_url":"https://github.com/apache/storm/pull/1635#discussion_r75835366","pull_request_url":"https://api.github.com/repos/apache/storm/pulls/1635","_links":{"self":{"href":"https://api.github.com/repos/apache/storm/pulls/comments/75835366"},"html":{"href":"https://github.com/apache/storm/pull/1635#discussion_r75835366"},"pull_request":{"href":"https://api.github.com/repos/apache/storm/pulls/1635"}}},"pull_request":{"url":"https://api.github.com/repos/apache/storm/pulls/1635","id":81927347,"html_url":"https://github.com/apache/storm/pull/1635","diff_url":"https://github.com/apache/storm/pull/1635.diff","patch_url":"https://github.com/apache/storm/pull/1635.patch","issue_url":"https://api.github.com/repos/apache/storm/issues/1635","number":1635,"state":"open","locked":false,"title":"STORM-1434 Support the GROUP BY clause in StormSQL","user":{"login":"HeartSaVioR","id":1317309,"avatar_url":"https://avatars.githubusercontent.com/u/1317309?v=3","gravatar_id":"","url":"https://api.github.com/users/HeartSaVioR","html_url":"https://github.com/HeartSaVioR","followers_url":"https://api.github.com/users/HeartSaVioR/followers","following_url":"https://api.github.com/users/HeartSaVioR/following{/other_user}","gists_url":"https://api.github.com/users/HeartSaVioR/gists{/gist_id}","starred_url":"https://api.github.com/users/HeartSaVioR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HeartSaVioR/subscriptions","organizations_url":"https://api.github.com/users/HeartSaVioR/orgs","repos_url":"https://api.github.com/users/HeartSaVioR/repos","events_url":"https://api.github.com/users/HeartSaVioR/events{/privacy}","received_events_url":"https://api.github.com/users/HeartSaVioR/received_events","type":"User","site_admin":false},"body":"* Support GROUP BY for Trident\r\n* Implement basic functions for aggregation\r\n* Change the way of converting Calcite logical plan to Trident logical plan\r\n  * before: creating codes and compile them\r\n  * after: use Trident features, only creating code block if evaluation is needed\r\n    * Janino comes in to help evaluating code block in runtime\r\n\r\nThis change can handle the below sql statements in runtime:\r\n\r\n```\r\nCREATE EXTERNAL TABLE ORDERS (ID INT PRIMARY KEY, UNIT_PRICE INT, QUANTITY INT) LOCATION 'kafka://localhost:2181/brokers?topic=orders' TBLPROPERTIES '{\"producer\":{\"bootstrap.servers\":\"localhost:9092\",\"acks\":\"1\",\"key.serializer\":\"org.apache.storm.kafka.IntSerializer\",\"value.serializer\":\"org.apache.storm.kafka.ByteBufferSerializer\"}}'\r\nCREATE EXTERNAL TABLE LARGE_ORDERS (ID INT PRIMARY KEY, TOTAL INT) LOCATION 'kafka://localhost:2181/brokers?topic=large_orders' TBLPROPERTIES '{\"producer\":{\"bootstrap.servers\":\"localhost:9092\",\"acks\":\"1\",\"key.serializer\":\"org.apache.storm.kafka.IntSerializer\",\"value.serializer\":\"org.apache.storm.kafka.ByteBufferSerializer\"}}'\r\nINSERT INTO LARGE_ORDERS SELECT ID, UNIT_PRICE * QUANTITY AS TOTAL FROM ORDERS WHERE UNIT_PRICE * QUANTITY > 50\r\n```\r\n\r\n```\r\nCREATE EXTERNAL TABLE ORDERS (ID INT PRIMARY KEY, UNIT_PRICE INT, QUANTITY INT) LOCATION 'kafka://localhost:2181/brokers?topic=orders' TBLPROPERTIES '{\"producer\":{\"bootstrap.servers\":\"localhost:9092\",\"acks\":\"1\",\"key.serializer\":\"org.apache.storm.kafka.IntSerializer\",\"value.serializer\":\"org.apache.storm.kafka.ByteBufferSerializer\"}}'\r\nCREATE EXTERNAL TABLE SUMMARY_ORDERS (ID INT PRIMARY KEY, UNIT_PRICE_AVG DOUBLE, SUM_OF_QUANTITY INT) LOCATION 'kafka://localhost:2181/brokers?topic=large_orders' TBLPROPERTIES '{\"producer\":{\"bootstrap.servers\":\"localhost:9092\",\"acks\":\"1\",\"key.serializer\":\"org.apache.storm.kafka.IntSerializer\",\"value.serializer\":\"org.apache.storm.kafka.ByteBufferSerializer\"}}'\r\nINSERT INTO SUMMARY_ORDERS SELECT ID, AVG(UNIT_PRICE) AS UNIT_PRICE_AVG, SUM(QUANTITY) AS SUM_OF_QUANTITY FROM ORDERS GROUP BY ID\r\n```\r\n\r\nThis can be easily backported to 1.x branch since it only touches storm-sql module.\r\n\r\nWhen reviewing, please share your idea if you find something to optimize further.\r\nI didn't play with Trident hardly so I'm not sure I'm following the best practice.\r\n\r\nI didn't touch UDF yet since coverage of STORM-1434 would be too broad if STORM-1434 contains UDF. Will file an issue to track and plan to address that.\r\n\r\nAlso STORM-2016 should be addressed soon in order to run the topology.\r\n\r\nTODO\r\n\r\n- [x] documentation update\r\n- [x] fix AVG to not changing origin type","created_at":"2016-08-19T05:12:07Z","updated_at":"2016-08-23T09:58:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b16f021f47e13f546e9f6cb4151e8d854b571979","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/storm/pulls/1635/commits","review_comments_url":"https://api.github.com/repos/apache/storm/pulls/1635/comments","review_comment_url":"https://api.github.com/repos/apache/storm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/storm/issues/1635/comments","statuses_url":"https://api.github.com/repos/apache/storm/statuses/67b10af4371f4b8c3d9a36f7dc71fa32b1a69ff7","head":{"label":"HeartSaVioR:STORM-1434","ref":"STORM-1434","sha":"67b10af4371f4b8c3d9a36f7dc71fa32b1a69ff7","user":{"login":"HeartSaVioR","id":1317309,"avatar_url":"https://avatars.githubusercontent.com/u/1317309?v=3","gravatar_id":"","url":"https://api.github.com/users/HeartSaVioR","html_url":"https://github.com/HeartSaVioR","followers_url":"https://api.github.com/users/HeartSaVioR/followers","following_url":"https://api.github.com/users/HeartSaVioR/following{/other_user}","gists_url":"https://api.github.com/users/HeartSaVioR/gists{/gist_id}","starred_url":"https://api.github.com/users/HeartSaVioR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HeartSaVioR/subscriptions","organizations_url":"https://api.github.com/users/HeartSaVioR/orgs","repos_url":"https://api.github.com/users/HeartSaVioR/repos","events_url":"https://api.github.com/users/HeartSaVioR/events{/privacy}","received_events_url":"https://api.github.com/users/HeartSaVioR/received_events","type":"User","site_admin":false},"repo":{"id":24730103,"name":"storm","full_name":"HeartSaVioR/storm","owner":{"login":"HeartSaVioR","id":1317309,"avatar_url":"https://avatars.githubusercontent.com/u/1317309?v=3","gravatar_id":"","url":"https://api.github.com/users/HeartSaVioR","html_url":"https://github.com/HeartSaVioR","followers_url":"https://api.github.com/users/HeartSaVioR/followers","following_url":"https://api.github.com/users/HeartSaVioR/following{/other_user}","gists_url":"https://api.github.com/users/HeartSaVioR/gists{/gist_id}","starred_url":"https://api.github.com/users/HeartSaVioR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HeartSaVioR/subscriptions","organizations_url":"https://api.github.com/users/HeartSaVioR/orgs","repos_url":"https://api.github.com/users/HeartSaVioR/repos","events_url":"https://api.github.com/users/HeartSaVioR/events{/privacy}","received_events_url":"https://api.github.com/users/HeartSaVioR/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/HeartSaVioR/storm","description":"Mirror of Apache Storm","fork":true,"url":"https://api.github.com/repos/HeartSaVioR/storm","forks_url":"https://api.github.com/repos/HeartSaVioR/storm/forks","keys_url":"https://api.github.com/repos/HeartSaVioR/storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HeartSaVioR/storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HeartSaVioR/storm/teams","hooks_url":"https://api.github.com/repos/HeartSaVioR/storm/hooks","issue_events_url":"https://api.github.com/repos/HeartSaVioR/storm/issues/events{/number}","events_url":"https://api.github.com/repos/HeartSaVioR/storm/events","assignees_url":"https://api.github.com/repos/HeartSaVioR/storm/assignees{/user}","branches_url":"https://api.github.com/repos/HeartSaVioR/storm/branches{/branch}","tags_url":"https://api.github.com/repos/HeartSaVioR/storm/tags","blobs_url":"https://api.github.com/repos/HeartSaVioR/storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HeartSaVioR/storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HeartSaVioR/storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/HeartSaVioR/storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HeartSaVioR/storm/statuses/{sha}","languages_url":"https://api.github.com/repos/HeartSaVioR/storm/languages","stargazers_url":"https://api.github.com/repos/HeartSaVioR/storm/stargazers","contributors_url":"https://api.github.com/repos/HeartSaVioR/storm/contributors","subscribers_url":"https://api.github.com/repos/HeartSaVioR/storm/subscribers","subscription_url":"https://api.github.com/repos/HeartSaVioR/storm/subscription","commits_url":"https://api.github.com/repos/HeartSaVioR/storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/HeartSaVioR/storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/HeartSaVioR/storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/HeartSaVioR/storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/HeartSaVioR/storm/contents/{+path}","compare_url":"https://api.github.com/repos/HeartSaVioR/storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HeartSaVioR/storm/merges","archive_url":"https://api.github.com/repos/HeartSaVioR/storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HeartSaVioR/storm/downloads","issues_url":"https://api.github.com/repos/HeartSaVioR/storm/issues{/number}","pulls_url":"https://api.github.com/repos/HeartSaVioR/storm/pulls{/number}","milestones_url":"https://api.github.com/repos/HeartSaVioR/storm/milestones{/number}","notifications_url":"https://api.github.com/repos/HeartSaVioR/storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HeartSaVioR/storm/labels{/name}","releases_url":"https://api.github.com/repos/HeartSaVioR/storm/releases{/id}","deployments_url":"https://api.github.com/repos/HeartSaVioR/storm/deployments","created_at":"2014-10-02T18:00:01Z","updated_at":"2016-01-13T23:55:58Z","pushed_at":"2016-08-23T08:45:44Z","git_url":"git://github.com/HeartSaVioR/storm.git","ssh_url":"git@github.com:HeartSaVioR/storm.git","clone_url":"https://github.com/HeartSaVioR/storm.git","svn_url":"https://github.com/HeartSaVioR/storm","homepage":null,"size":106651,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"318c9e26b32d6c3f3533c956a213df78a2c12793","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","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":14135470,"name":"storm","full_name":"apache/storm","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","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/storm","description":"Mirror of Apache Storm","fork":false,"url":"https://api.github.com/repos/apache/storm","forks_url":"https://api.github.com/repos/apache/storm/forks","keys_url":"https://api.github.com/repos/apache/storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/storm/teams","hooks_url":"https://api.github.com/repos/apache/storm/hooks","issue_events_url":"https://api.github.com/repos/apache/storm/issues/events{/number}","events_url":"https://api.github.com/repos/apache/storm/events","assignees_url":"https://api.github.com/repos/apache/storm/assignees{/user}","branches_url":"https://api.github.com/repos/apache/storm/branches{/branch}","tags_url":"https://api.github.com/repos/apache/storm/tags","blobs_url":"https://api.github.com/repos/apache/storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/storm/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/storm/languages","stargazers_url":"https://api.github.com/repos/apache/storm/stargazers","contributors_url":"https://api.github.com/repos/apache/storm/contributors","subscribers_url":"https://api.github.com/repos/apache/storm/subscribers","subscription_url":"https://api.github.com/repos/apache/storm/subscription","commits_url":"https://api.github.com/repos/apache/storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/storm/contents/{+path}","compare_url":"https://api.github.com/repos/apache/storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/storm/merges","archive_url":"https://api.github.com/repos/apache/storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/storm/downloads","issues_url":"https://api.github.com/repos/apache/storm/issues{/number}","pulls_url":"https://api.github.com/repos/apache/storm/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/storm/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/storm/labels{/name}","releases_url":"https://api.github.com/repos/apache/storm/releases{/id}","deployments_url":"https://api.github.com/repos/apache/storm/deployments","created_at":"2013-11-05T08:00:14Z","updated_at":"2016-08-23T09:05:31Z","pushed_at":"2016-08-23T08:45:44Z","git_url":"git://github.com/apache/storm.git","ssh_url":"git@github.com:apache/storm.git","clone_url":"https://github.com/apache/storm.git","svn_url":"https://github.com/apache/storm","homepage":null,"size":173305,"stargazers_count":3466,"watchers_count":3466,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2572,"mirror_url":"git://git.apache.org/storm.git","open_issues_count":139,"forks":2572,"open_issues":139,"watchers":3466,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/storm/pulls/1635"},"html":{"href":"https://github.com/apache/storm/pull/1635"},"issue":{"href":"https://api.github.com/repos/apache/storm/issues/1635"},"comments":{"href":"https://api.github.com/repos/apache/storm/issues/1635/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/storm/pulls/1635/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/storm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/storm/pulls/1635/commits"},"statuses":{"href":"https://api.github.com/repos/apache/storm/statuses/67b10af4371f4b8c3d9a36f7dc71fa32b1a69ff7"}}}}
{"actor":{"display_login":"arunmahadevan"}}