{"action":"created","comment":{"url":"https://api.github.com/repos/apache/kafka/pulls/comments/184535730","pull_request_review_id":115699800,"id":184535730,"diff_hunk":"@@ -0,0 +1,133 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one or more\n+ * contributor license agreements. See the NOTICE file distributed with\n+ * this work for additional information regarding copyright ownership.\n+ * The ASF licenses this file to You under the Apache License, Version 2.0\n+ * (the \"License\"); you may not use this file except in compliance with\n+ * 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+\n+package org.apache.kafka.streams.kstream.internals;\n+\n+import org.apache.kafka.streams.processor.ProcessorSupplier;\n+import org.apache.kafka.streams.processor.StateStoreSupplier;\n+import org.apache.kafka.streams.processor.internals.InternalTopologyBuilder;\n+import org.apache.kafka.streams.state.KeyValueStore;\n+import org.apache.kafka.streams.state.StoreBuilder;\n+\n+import java.util.Arrays;\n+\n+class StatefulProcessorNode<K, V> extends StatelessProcessorNode<K, V> {\n+\n+    private final String[] storeNames;\n+    private final org.apache.kafka.streams.processor.StateStoreSupplier<KeyValueStore> storeSupplier;","path":"streams/src/main/java/org/apache/kafka/streams/kstream/internals/StatefulProcessorNode.java","position":31,"original_position":31,"commit_id":"a67bb5d79f272f154e5b8ff15140b4d09e40889e","original_commit_id":"76c9af78241017d22b2358ff3ce6b504e309897f","user":{"login":"guozhangwang","id":10729597,"avatar_url":"https://avatars0.githubusercontent.com/u/10729597?v=4","gravatar_id":"","url":"https://api.github.com/users/guozhangwang","html_url":"https://github.com/guozhangwang","followers_url":"https://api.github.com/users/guozhangwang/followers","following_url":"https://api.github.com/users/guozhangwang/following{/other_user}","gists_url":"https://api.github.com/users/guozhangwang/gists{/gist_id}","starred_url":"https://api.github.com/users/guozhangwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guozhangwang/subscriptions","organizations_url":"https://api.github.com/users/guozhangwang/orgs","repos_url":"https://api.github.com/users/guozhangwang/repos","events_url":"https://api.github.com/users/guozhangwang/events{/privacy}","received_events_url":"https://api.github.com/users/guozhangwang/received_events","type":"User","site_admin":false},"body":"We are going to remove `StateStoreSupplier`, do we still need this?","created_at":"2018-04-26T21:26:56Z","updated_at":"2018-04-26T21:53:05Z","html_url":"https://github.com/apache/kafka/pull/4923#discussion_r184535730","pull_request_url":"https://api.github.com/repos/apache/kafka/pulls/4923","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments/184535730"},"html":{"href":"https://github.com/apache/kafka/pull/4923#discussion_r184535730"},"pull_request":{"href":"https://api.github.com/repos/apache/kafka/pulls/4923"}}},"pull_request":{"url":"https://api.github.com/repos/apache/kafka/pulls/4923","id":183871160,"html_url":"https://github.com/apache/kafka/pull/4923","diff_url":"https://github.com/apache/kafka/pull/4923.diff","patch_url":"https://github.com/apache/kafka/pull/4923.patch","issue_url":"https://api.github.com/repos/apache/kafka/issues/4923","number":4923,"state":"open","locked":false,"title":"KAFKA-6761: Part 1 of 3; Graph nodes","user":{"login":"bbejeck","id":199238,"avatar_url":"https://avatars3.githubusercontent.com/u/199238?v=4","gravatar_id":"","url":"https://api.github.com/users/bbejeck","html_url":"https://github.com/bbejeck","followers_url":"https://api.github.com/users/bbejeck/followers","following_url":"https://api.github.com/users/bbejeck/following{/other_user}","gists_url":"https://api.github.com/users/bbejeck/gists{/gist_id}","starred_url":"https://api.github.com/users/bbejeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbejeck/subscriptions","organizations_url":"https://api.github.com/users/bbejeck/orgs","repos_url":"https://api.github.com/users/bbejeck/repos","events_url":"https://api.github.com/users/bbejeck/events{/privacy}","received_events_url":"https://api.github.com/users/bbejeck/received_events","type":"User","site_admin":false},"body":"This PR supersedes PR #4654 as it was growing too large. All comments in that PR should be addressed here.\r\n I will attempt to break the PRs for the topology optimization effort into 3 PRs total and will follow this general plan:\r\n\r\n1. This PR only adds the graph nodes and graph. The graph nodes will hold the information used to make calls to the `InternalTopologyBuilder` when using the DSL. Graph nodes are stored in the `StreamsTopologyGraph` until the final topology needs building then the graph is traversed and optimizations are made at that point.  There are no tests in this PR relying on the follow-up PR to use all current streams tests, which should suffice.\r\n2. PR 2 will intercept all DSL calls and build the graph.  The `InternalStreamsBuilder` uses the graph to provide the required info to the `InternalTopologyBuilder` and build a topology.  The condition of satisfaction for this PR is that all current unit, integration and system tests pass using the graph.\r\n3. PR 3 adds some optimizations mainly automatically repartitioning for operations that may modify a key and have child operations that would normally create a separate repartition topic, saving possible unnecessary repartition topics.  For example the following topology:\r\n```\r\nKStream<String, String> mappedStreamOther = inputStream.map(new KeyValueMapper<String, String, KeyValue<? extends String, ? extends String>>() {\r\n            @Override\r\n            public KeyValue<? extends String, ? extends String> apply(String key, String value) {\r\n\r\n                return KeyValue.pair(key.substring(0, 3), value);\r\n            }\r\n        });\r\n\r\n\r\n        mappedStreamOther.groupByKey().windowedBy(TimeWindows.of(5000)).count().toStream().to(\"count-one-out\");\r\n        mappedStreamOther.groupByKey().windowedBy(TimeWindows.of(10000)).count().toStream().to(\"count-two-out\");\r\n        mappedStreamOther.groupByKey().windowedBy(TimeWindows.of(15000)).count().toStream().to(\"count-three-out\");\r\n```\r\nwould create 3 repartion topics, but after applying an optimization strategy, only one is created.\r\n\r\n### Committer Checklist (excluded from commit message)\r\n- [ ] Verify design and implementation \r\n- [ ] Verify test coverage and CI build status\r\n- [ ] Verify documentation (including upgrade notes)\r\n","created_at":"2018-04-24T21:36:06Z","updated_at":"2018-04-26T21:53:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ccd1a46a1f839fe821c897e6d1bec8a41f4fc22","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/kafka/pulls/4923/commits","review_comments_url":"https://api.github.com/repos/apache/kafka/pulls/4923/comments","review_comment_url":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/kafka/issues/4923/comments","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/a67bb5d79f272f154e5b8ff15140b4d09e40889e","head":{"label":"bbejeck:KAFKA-6761_reduce_footprint_part_1","ref":"KAFKA-6761_reduce_footprint_part_1","sha":"a67bb5d79f272f154e5b8ff15140b4d09e40889e","user":{"login":"bbejeck","id":199238,"avatar_url":"https://avatars3.githubusercontent.com/u/199238?v=4","gravatar_id":"","url":"https://api.github.com/users/bbejeck","html_url":"https://github.com/bbejeck","followers_url":"https://api.github.com/users/bbejeck/followers","following_url":"https://api.github.com/users/bbejeck/following{/other_user}","gists_url":"https://api.github.com/users/bbejeck/gists{/gist_id}","starred_url":"https://api.github.com/users/bbejeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbejeck/subscriptions","organizations_url":"https://api.github.com/users/bbejeck/orgs","repos_url":"https://api.github.com/users/bbejeck/repos","events_url":"https://api.github.com/users/bbejeck/events{/privacy}","received_events_url":"https://api.github.com/users/bbejeck/received_events","type":"User","site_admin":false},"repo":{"id":42054236,"name":"kafka","full_name":"bbejeck/kafka","owner":{"login":"bbejeck","id":199238,"avatar_url":"https://avatars3.githubusercontent.com/u/199238?v=4","gravatar_id":"","url":"https://api.github.com/users/bbejeck","html_url":"https://github.com/bbejeck","followers_url":"https://api.github.com/users/bbejeck/followers","following_url":"https://api.github.com/users/bbejeck/following{/other_user}","gists_url":"https://api.github.com/users/bbejeck/gists{/gist_id}","starred_url":"https://api.github.com/users/bbejeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbejeck/subscriptions","organizations_url":"https://api.github.com/users/bbejeck/orgs","repos_url":"https://api.github.com/users/bbejeck/repos","events_url":"https://api.github.com/users/bbejeck/events{/privacy}","received_events_url":"https://api.github.com/users/bbejeck/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bbejeck/kafka","description":"Mirror of Apache Kafka","fork":true,"url":"https://api.github.com/repos/bbejeck/kafka","forks_url":"https://api.github.com/repos/bbejeck/kafka/forks","keys_url":"https://api.github.com/repos/bbejeck/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bbejeck/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bbejeck/kafka/teams","hooks_url":"https://api.github.com/repos/bbejeck/kafka/hooks","issue_events_url":"https://api.github.com/repos/bbejeck/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/bbejeck/kafka/events","assignees_url":"https://api.github.com/repos/bbejeck/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/bbejeck/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/bbejeck/kafka/tags","blobs_url":"https://api.github.com/repos/bbejeck/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bbejeck/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bbejeck/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/bbejeck/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bbejeck/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/bbejeck/kafka/languages","stargazers_url":"https://api.github.com/repos/bbejeck/kafka/stargazers","contributors_url":"https://api.github.com/repos/bbejeck/kafka/contributors","subscribers_url":"https://api.github.com/repos/bbejeck/kafka/subscribers","subscription_url":"https://api.github.com/repos/bbejeck/kafka/subscription","commits_url":"https://api.github.com/repos/bbejeck/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/bbejeck/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/bbejeck/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/bbejeck/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/bbejeck/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/bbejeck/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bbejeck/kafka/merges","archive_url":"https://api.github.com/repos/bbejeck/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bbejeck/kafka/downloads","issues_url":"https://api.github.com/repos/bbejeck/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/bbejeck/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/bbejeck/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/bbejeck/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bbejeck/kafka/labels{/name}","releases_url":"https://api.github.com/repos/bbejeck/kafka/releases{/id}","deployments_url":"https://api.github.com/repos/bbejeck/kafka/deployments","created_at":"2015-09-07T13:23:16Z","updated_at":"2018-04-25T17:14:19Z","pushed_at":"2018-04-26T21:40:03Z","git_url":"git://github.com/bbejeck/kafka.git","ssh_url":"git@github.com:bbejeck/kafka.git","clone_url":"https://github.com/bbejeck/kafka.git","svn_url":"https://github.com/bbejeck/kafka","homepage":null,"size":61968,"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":"trunk"}},"base":{"label":"apache:trunk","ref":"trunk","sha":"a05e33693b66ac38ccb21f2238c194ca59fcb6ec","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":2211243,"name":"kafka","full_name":"apache/kafka","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/kafka","description":"Mirror of Apache Kafka","fork":false,"url":"https://api.github.com/repos/apache/kafka","forks_url":"https://api.github.com/repos/apache/kafka/forks","keys_url":"https://api.github.com/repos/apache/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/kafka/teams","hooks_url":"https://api.github.com/repos/apache/kafka/hooks","issue_events_url":"https://api.github.com/repos/apache/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/apache/kafka/events","assignees_url":"https://api.github.com/repos/apache/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/apache/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/apache/kafka/tags","blobs_url":"https://api.github.com/repos/apache/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/kafka/languages","stargazers_url":"https://api.github.com/repos/apache/kafka/stargazers","contributors_url":"https://api.github.com/repos/apache/kafka/contributors","subscribers_url":"https://api.github.com/repos/apache/kafka/subscribers","subscription_url":"https://api.github.com/repos/apache/kafka/subscription","commits_url":"https://api.github.com/repos/apache/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/apache/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/kafka/merges","archive_url":"https://api.github.com/repos/apache/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/kafka/downloads","issues_url":"https://api.github.com/repos/apache/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/apache/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/kafka/labels{/name}","releases_url":"https://api.github.com/repos/apache/kafka/releases{/id}","deployments_url":"https://api.github.com/repos/apache/kafka/deployments","created_at":"2011-08-15T18:06:16Z","updated_at":"2018-04-26T21:02:49Z","pushed_at":"2018-04-26T21:40:09Z","git_url":"git://github.com/apache/kafka.git","ssh_url":"git@github.com:apache/kafka.git","clone_url":"https://github.com/apache/kafka.git","svn_url":"https://github.com/apache/kafka","homepage":null,"size":64562,"stargazers_count":8107,"watchers_count":8107,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4770,"mirror_url":null,"archived":false,"open_issues_count":456,"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":4770,"open_issues":456,"watchers":8107,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/4923"},"html":{"href":"https://github.com/apache/kafka/pull/4923"},"issue":{"href":"https://api.github.com/repos/apache/kafka/issues/4923"},"comments":{"href":"https://api.github.com/repos/apache/kafka/issues/4923/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/kafka/pulls/4923/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/kafka/pulls/4923/commits"},"statuses":{"href":"https://api.github.com/repos/apache/kafka/statuses/a67bb5d79f272f154e5b8ff15140b4d09e40889e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"guozhangwang"}}