GitHub PullRequestReviewCommentEvent at 2014-07-14 20:39:07
Repository: spark
Actor: marmbrus
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/14902139","id":14902139,"diff_hunk":"@@ -26,6 +26,28 @@ import org.apache.spark.sql.catalyst.trees\n abstract class LogicalPlan extends QueryPlan[LogicalPlan] {\n   self: Product =>\n \n+  // TODO: handle overflow?\n+  /**\n+   * Estimates of various statistics.  The default estimation logic simply sums up the corresponding\n+   * statistic produced by the children.  To override this behavior, override `statistics` and\n+   * assign it a overriden version of `Statistics`.\n+   */\n+  case class Statistics(\n+    /**\n+     * Number of output tuples. For leaf operators this defaults to 1, otherwise it is set to the\n+     * product of children's `numTuples`.\n+     */\n+    numTuples: Long = childrenStats.map(_.numTuples).product,\n+\n+    /**\n+     * Physical size in bytes. For leaf operators this defaults to 1, otherwise it is set to the\n+     * product of children's `sizeInBytes`.\n+     */\n+    sizeInBytes: Long = childrenStats.map(_.sizeInBytes).product\n+  )\n+  lazy val statistics: Statistics = new Statistics\n+  lazy val childrenStats = children.map(_.statistics)","path":"sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/LogicalPlan.scala","position":24,"original_position":24,"commit_id":"29690b992daebdea9f34957a3c9339cd8c36d7eb","original_commit_id":"29690b992daebdea9f34957a3c9339cd8c36d7eb","user":{"login":"marmbrus","id":527,"avatar_url":"https://avatars.githubusercontent.com/u/527?","gravatar_id":"6b296d9deae02902b9ab42d444a12d94","url":"https://api.github.com/users/marmbrus","html_url":"https://github.com/marmbrus","followers_url":"https://api.github.com/users/marmbrus/followers","following_url":"https://api.github.com/users/marmbrus/following{/other_user}","gists_url":"https://api.github.com/users/marmbrus/gists{/gist_id}","starred_url":"https://api.github.com/users/marmbrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marmbrus/subscriptions","organizations_url":"https://api.github.com/users/marmbrus/orgs","repos_url":"https://api.github.com/users/marmbrus/repos","events_url":"https://api.github.com/users/marmbrus/events{/privacy}","received_events_url":"https://api.github.com/users/marmbrus/received_events","type":"User","site_admin":false},"body":"We are already memoizing the statistics in the child, so we probably don't need to do it again here.","created_at":"2014-07-14T20:39:07Z","updated_at":"2014-07-14T20:39:07Z","html_url":"https://github.com/apache/spark/pull/1238#discussion_r14902139","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/1238","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/14902139"},"html":{"href":"https://github.com/apache/spark/pull/1238#discussion_r14902139"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/1238"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/1238","id":17678825,"html_url":"https://github.com/apache/spark/pull/1238","diff_url":"https://github.com/apache/spark/pull/1238.diff","patch_url":"https://github.com/apache/spark/pull/1238.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/1238","number":1238,"state":"open","title":"[SPARK-2393][SQL] Cost estimation optimization framework for Catalyst logical plans & sample usage.","user":{"login":"concretevitamin","id":592670,"avatar_url":"https://avatars.githubusercontent.com/u/592670?","gravatar_id":"0f603447fed77ab37c823caf84d5e781","url":"https://api.github.com/users/concretevitamin","html_url":"https://github.com/concretevitamin","followers_url":"https://api.github.com/users/concretevitamin/followers","following_url":"https://api.github.com/users/concretevitamin/following{/other_user}","gists_url":"https://api.github.com/users/concretevitamin/gists{/gist_id}","starred_url":"https://api.github.com/users/concretevitamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/concretevitamin/subscriptions","organizations_url":"https://api.github.com/users/concretevitamin/orgs","repos_url":"https://api.github.com/users/concretevitamin/repos","events_url":"https://api.github.com/users/concretevitamin/events{/privacy}","received_events_url":"https://api.github.com/users/concretevitamin/received_events","type":"User","site_admin":false},"body":"The idea is that every Catalyst logical plan gets hold of an Estimates class, the usage of which provides useful estimations on various statistics. See the implementations of `ParquetRelation` and `MetastoreRelation`.\r\n\r\nThis patch also includes one usage of the estimation interface -- namely, use physical table sizes from the estimate interface to convert an equi-join to a broadcast join (when doing so is beneficial, as determined by a size threshold). \r\n\r\nThis PR still needs some cleanups, but just want to put it out here first to gather feedback on the interface & high-level approach.\r\n\r\nTODOs:  \r\n- [x] Add a separate test suite & improve test coverage.\r\n- [x] Support `ParquetRelation` in the aforementioned BHJ optimization.","created_at":"2014-06-26T23:14:33Z","updated_at":"2014-07-14T20:39:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d8e581bb512669b2f66620f97b810c2602115e2d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/1238/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/1238/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments/{number}","comments_url":"https://api.github.com/repos/apache/spark/issues/1238/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/29690b992daebdea9f34957a3c9339cd8c36d7eb","head":{"label":"concretevitamin:estimates","ref":"estimates","sha":"29690b992daebdea9f34957a3c9339cd8c36d7eb","user":{"login":"concretevitamin","id":592670,"avatar_url":"https://avatars.githubusercontent.com/u/592670?","gravatar_id":"0f603447fed77ab37c823caf84d5e781","url":"https://api.github.com/users/concretevitamin","html_url":"https://github.com/concretevitamin","followers_url":"https://api.github.com/users/concretevitamin/followers","following_url":"https://api.github.com/users/concretevitamin/following{/other_user}","gists_url":"https://api.github.com/users/concretevitamin/gists{/gist_id}","starred_url":"https://api.github.com/users/concretevitamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/concretevitamin/subscriptions","organizations_url":"https://api.github.com/users/concretevitamin/orgs","repos_url":"https://api.github.com/users/concretevitamin/repos","events_url":"https://api.github.com/users/concretevitamin/events{/privacy}","received_events_url":"https://api.github.com/users/concretevitamin/received_events","type":"User","site_admin":false},"repo":{"id":18089954,"name":"spark","full_name":"concretevitamin/spark","owner":{"login":"concretevitamin","id":592670,"avatar_url":"https://avatars.githubusercontent.com/u/592670?","gravatar_id":"0f603447fed77ab37c823caf84d5e781","url":"https://api.github.com/users/concretevitamin","html_url":"https://github.com/concretevitamin","followers_url":"https://api.github.com/users/concretevitamin/followers","following_url":"https://api.github.com/users/concretevitamin/following{/other_user}","gists_url":"https://api.github.com/users/concretevitamin/gists{/gist_id}","starred_url":"https://api.github.com/users/concretevitamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/concretevitamin/subscriptions","organizations_url":"https://api.github.com/users/concretevitamin/orgs","repos_url":"https://api.github.com/users/concretevitamin/repos","events_url":"https://api.github.com/users/concretevitamin/events{/privacy}","received_events_url":"https://api.github.com/users/concretevitamin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/concretevitamin/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/concretevitamin/spark","forks_url":"https://api.github.com/repos/concretevitamin/spark/forks","keys_url":"https://api.github.com/repos/concretevitamin/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/concretevitamin/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/concretevitamin/spark/teams","hooks_url":"https://api.github.com/repos/concretevitamin/spark/hooks","issue_events_url":"https://api.github.com/repos/concretevitamin/spark/issues/events{/number}","events_url":"https://api.github.com/repos/concretevitamin/spark/events","assignees_url":"https://api.github.com/repos/concretevitamin/spark/assignees{/user}","branches_url":"https://api.github.com/repos/concretevitamin/spark/branches{/branch}","tags_url":"https://api.github.com/repos/concretevitamin/spark/tags","blobs_url":"https://api.github.com/repos/concretevitamin/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/concretevitamin/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/concretevitamin/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/concretevitamin/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/concretevitamin/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/concretevitamin/spark/languages","stargazers_url":"https://api.github.com/repos/concretevitamin/spark/stargazers","contributors_url":"https://api.github.com/repos/concretevitamin/spark/contributors","subscribers_url":"https://api.github.com/repos/concretevitamin/spark/subscribers","subscription_url":"https://api.github.com/repos/concretevitamin/spark/subscription","commits_url":"https://api.github.com/repos/concretevitamin/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/concretevitamin/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/concretevitamin/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/concretevitamin/spark/issues/comments/{number}","contents_url":"https://api.github.com/repos/concretevitamin/spark/contents/{+path}","compare_url":"https://api.github.com/repos/concretevitamin/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/concretevitamin/spark/merges","archive_url":"https://api.github.com/repos/concretevitamin/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/concretevitamin/spark/downloads","issues_url":"https://api.github.com/repos/concretevitamin/spark/issues{/number}","pulls_url":"https://api.github.com/repos/concretevitamin/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/concretevitamin/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/concretevitamin/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/concretevitamin/spark/labels{/name}","releases_url":"https://api.github.com/repos/concretevitamin/spark/releases{/id}","created_at":"2014-03-25T05:38:19Z","updated_at":"2014-06-24T23:45:34Z","pushed_at":"2014-07-14T18:53:01Z","git_url":"git://github.com/concretevitamin/spark.git","ssh_url":"git@github.com:concretevitamin/spark.git","clone_url":"https://github.com/concretevitamin/spark.git","svn_url":"https://github.com/concretevitamin/spark","homepage":null,"size":71194,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"553c578de1a73a605197c184fc028efcc8dff010","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?","gravatar_id":"a676c0bf448fcd49f588249ead719b4c","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":17165658,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?","gravatar_id":"a676c0bf448fcd49f588249ead719b4c","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/spark","description":"Mirror of Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments/{number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","created_at":"2014-02-25T08:00:08Z","updated_at":"2014-07-14T19:10:27Z","pushed_at":"2014-07-14T20:33:26Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":null,"size":2206481,"stargazers_count":810,"watchers_count":810,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":836,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":246,"forks":836,"open_issues":246,"watchers":810,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/1238"},"html":{"href":"https://github.com/apache/spark/pull/1238"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/1238"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/1238/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/1238/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/1238/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/29690b992daebdea9f34957a3c9339cd8c36d7eb"}}}}