{"action":"created","comment":{"url":"https://api.github.com/repos/apache/tajo/pulls/comments/35738078","id":35738078,"diff_hunk":"@@ -0,0 +1,184 @@\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+\n+package org.apache.tajo.engine.planner;\n+\n+import org.apache.hadoop.fs.FileSystem;\n+import org.apache.hadoop.fs.Path;\n+import org.apache.tajo.LocalTajoTestingUtility;\n+import org.apache.tajo.TajoConstants;\n+import org.apache.tajo.TajoTestingCluster;\n+import org.apache.tajo.algebra.Expr;\n+import org.apache.tajo.catalog.*;\n+import org.apache.tajo.catalog.proto.CatalogProtos.StoreType;\n+import org.apache.tajo.catalog.statistics.TableStats;\n+import org.apache.tajo.common.TajoDataTypes.Type;\n+import org.apache.tajo.engine.function.FunctionLoader;\n+import org.apache.tajo.engine.parser.SQLAnalyzer;\n+import org.apache.tajo.engine.query.QueryContext;\n+import org.apache.tajo.plan.LogicalOptimizer;\n+import org.apache.tajo.plan.LogicalPlan;\n+import org.apache.tajo.plan.LogicalPlanner;\n+import org.apache.tajo.plan.logical.*;\n+import org.apache.tajo.plan.util.PlannerUtil;\n+import org.apache.tajo.storage.TablespaceManager;\n+import org.apache.tajo.util.CommonTestingUtil;\n+import org.apache.tajo.util.KeyValueSet;\n+import org.junit.AfterClass;\n+import org.junit.BeforeClass;\n+import org.junit.Test;\n+\n+import static org.apache.tajo.TajoConstants.DEFAULT_DATABASE_NAME;\n+import static org.apache.tajo.TajoConstants.DEFAULT_TABLESPACE_NAME;\n+import static org.junit.Assert.*;\n+\n+public class TestJoinOrderAlgorithm {\n+\n+  private static TajoTestingCluster util;\n+  private static CatalogService catalog;\n+  private static SQLAnalyzer sqlAnalyzer;\n+  private static LogicalPlanner planner;\n+  private static LogicalOptimizer optimizer;\n+  private static QueryContext defaultContext;\n+\n+  @BeforeClass\n+  public static void setUp() throws Exception {\n+    util = new TajoTestingCluster();\n+    util.startCatalogCluster();\n+    catalog = util.getMiniCatalogCluster().getCatalog();\n+    catalog.createTablespace(DEFAULT_TABLESPACE_NAME, \"hdfs://localhost:1234/warehouse\");\n+    catalog.createDatabase(DEFAULT_DATABASE_NAME, DEFAULT_TABLESPACE_NAME);\n+    for (FunctionDesc funcDesc : FunctionLoader.findLegacyFunctions()) {\n+      catalog.createFunction(funcDesc);\n+    }\n+\n+    Schema schema = new Schema();\n+    schema.addColumn(\"name\", Type.TEXT);\n+    schema.addColumn(\"empid\", Type.INT4);\n+    schema.addColumn(\"deptname\", Type.TEXT);\n+\n+    Schema schema2 = new Schema();\n+    schema2.addColumn(\"deptname\", Type.TEXT);\n+    schema2.addColumn(\"manager\", Type.TEXT);\n+\n+    Schema schema3 = new Schema();\n+    schema3.addColumn(\"deptname\", Type.TEXT);\n+    schema3.addColumn(\"score\", Type.INT4);\n+    schema3.addColumn(\"phone\", Type.INT4);\n+\n+    TableMeta meta = CatalogUtil.newTableMeta(\"TEXT\");\n+    TableDesc people = new TableDesc(\n+        CatalogUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, \"employee\"), schema, meta,\n+        CommonTestingUtil.getTestDir().toUri());\n+    catalog.createTable(people);\n+\n+    TableDesc student =\n+        new TableDesc(\n+            CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, \"dept\"), schema2, \"TEXT\", new KeyValueSet(),\n+            CommonTestingUtil.getTestDir().toUri());\n+    catalog.createTable(student);\n+\n+    TableDesc score =\n+        new TableDesc(\n+            CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, \"score\"), schema3, \"TEXT\", new KeyValueSet(),\n+            CommonTestingUtil.getTestDir().toUri());\n+    catalog.createTable(score);\n+\n+    ///////////////////////////////////////////////////////////////////////////\n+    // creating table for overflow in JoinOrderOptimizer.\n+    Schema schema4 = new Schema();\n+    schema4.addColumn(\"deptname\", Type.TEXT);\n+    schema4.addColumn(\"manager\", Type.TEXT);\n+    // Set store type as FAKEFILE to prevent auto update of physical information in LogicalPlanner.updatePhysicalInfo()\n+    TableMeta largeTableMeta = CatalogUtil.newTableMeta(\"FAKEFILE\");\n+    TableDesc largeDept;\n+    TableStats largeTableStats;\n+    FileSystem fs = FileSystem.getLocal(util.getConfiguration());\n+    for (int i = 0; i < 6; i++) {\n+      Path tablePath = new Path(CommonTestingUtil.getTestDir(), \"\" + (i+1));\n+      fs.create(tablePath);\n+      largeDept =\n+          new TableDesc(\n+              CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, \"large_dept\"+(i+1)), schema4, largeTableMeta,\n+              tablePath.toUri());\n+      largeTableStats = new TableStats();\n+      largeTableStats.setNumBytes(1024L * 1024L * 1024L * 1024L *  1024L * (i+1));  //1 PB * i","path":"tajo-core/src/test/java/org/apache/tajo/engine/planner/TestJoinOrderAlgorithm.java","position":120,"original_position":120,"commit_id":"9c1c58d6dab2a83e24a820fb491e5596b0fa68d6","original_commit_id":"9c1c58d6dab2a83e24a820fb491e5596b0fa68d6","user":{"login":"hyunsik","id":225941,"avatar_url":"https://avatars.githubusercontent.com/u/225941?v=3","gravatar_id":"","url":"https://api.github.com/users/hyunsik","html_url":"https://github.com/hyunsik","followers_url":"https://api.github.com/users/hyunsik/followers","following_url":"https://api.github.com/users/hyunsik/following{/other_user}","gists_url":"https://api.github.com/users/hyunsik/gists{/gist_id}","starred_url":"https://api.github.com/users/hyunsik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyunsik/subscriptions","organizations_url":"https://api.github.com/users/hyunsik/orgs","repos_url":"https://api.github.com/users/hyunsik/repos","events_url":"https://api.github.com/users/hyunsik/events{/privacy}","received_events_url":"https://api.github.com/users/hyunsik/received_events","type":"User","site_admin":false},"body":"You may use StorageUnit.PB?","created_at":"2015-07-29T08:37:11Z","updated_at":"2015-07-29T08:37:11Z","html_url":"https://github.com/apache/tajo/pull/655#discussion_r35738078","pull_request_url":"https://api.github.com/repos/apache/tajo/pulls/655","_links":{"self":{"href":"https://api.github.com/repos/apache/tajo/pulls/comments/35738078"},"html":{"href":"https://github.com/apache/tajo/pull/655#discussion_r35738078"},"pull_request":{"href":"https://api.github.com/repos/apache/tajo/pulls/655"}}},"pull_request":{"url":"https://api.github.com/repos/apache/tajo/pulls/655","id":40868765,"html_url":"https://github.com/apache/tajo/pull/655","diff_url":"https://github.com/apache/tajo/pull/655.diff","patch_url":"https://github.com/apache/tajo/pull/655.patch","issue_url":"https://api.github.com/repos/apache/tajo/issues/655","number":655,"state":"open","locked":false,"title":"TAJO-1552: NPE occurs when GreedyHeuristicJoinOrderAlgorithm.getCost() returns infinity","user":{"login":"jihoonson","id":2322288,"avatar_url":"https://avatars.githubusercontent.com/u/2322288?v=3","gravatar_id":"","url":"https://api.github.com/users/jihoonson","html_url":"https://github.com/jihoonson","followers_url":"https://api.github.com/users/jihoonson/followers","following_url":"https://api.github.com/users/jihoonson/following{/other_user}","gists_url":"https://api.github.com/users/jihoonson/gists{/gist_id}","starred_url":"https://api.github.com/users/jihoonson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jihoonson/subscriptions","organizations_url":"https://api.github.com/users/jihoonson/orgs","repos_url":"https://api.github.com/users/jihoonson/repos","events_url":"https://api.github.com/users/jihoonson/events{/privacy}","received_events_url":"https://api.github.com/users/jihoonson/received_events","type":"User","site_admin":false},"body":"This patch is based on #547.\r\nChanges are:\r\n* Rebasing the work of  #547\r\n* Removed an unnecessary test\r\n* Added a ```FAKEFILE``` store type for test\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.png\" height=40 alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/apache/tajo/655)\n<!-- Reviewable:end -->\n","created_at":"2015-07-27T03:59:15Z","updated_at":"2015-07-29T08:37:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"23de6d8592144fdecb332f4f6731c828b2a26158","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/tajo/pulls/655/commits","review_comments_url":"https://api.github.com/repos/apache/tajo/pulls/655/comments","review_comment_url":"https://api.github.com/repos/apache/tajo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/tajo/issues/655/comments","statuses_url":"https://api.github.com/repos/apache/tajo/statuses/9c1c58d6dab2a83e24a820fb491e5596b0fa68d6","head":{"label":"jihoonson:TAJO-1552","ref":"TAJO-1552","sha":"9c1c58d6dab2a83e24a820fb491e5596b0fa68d6","user":{"login":"jihoonson","id":2322288,"avatar_url":"https://avatars.githubusercontent.com/u/2322288?v=3","gravatar_id":"","url":"https://api.github.com/users/jihoonson","html_url":"https://github.com/jihoonson","followers_url":"https://api.github.com/users/jihoonson/followers","following_url":"https://api.github.com/users/jihoonson/following{/other_user}","gists_url":"https://api.github.com/users/jihoonson/gists{/gist_id}","starred_url":"https://api.github.com/users/jihoonson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jihoonson/subscriptions","organizations_url":"https://api.github.com/users/jihoonson/orgs","repos_url":"https://api.github.com/users/jihoonson/repos","events_url":"https://api.github.com/users/jihoonson/events{/privacy}","received_events_url":"https://api.github.com/users/jihoonson/received_events","type":"User","site_admin":false},"repo":{"id":19723915,"name":"tajo-2","full_name":"jihoonson/tajo-2","owner":{"login":"jihoonson","id":2322288,"avatar_url":"https://avatars.githubusercontent.com/u/2322288?v=3","gravatar_id":"","url":"https://api.github.com/users/jihoonson","html_url":"https://github.com/jihoonson","followers_url":"https://api.github.com/users/jihoonson/followers","following_url":"https://api.github.com/users/jihoonson/following{/other_user}","gists_url":"https://api.github.com/users/jihoonson/gists{/gist_id}","starred_url":"https://api.github.com/users/jihoonson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jihoonson/subscriptions","organizations_url":"https://api.github.com/users/jihoonson/orgs","repos_url":"https://api.github.com/users/jihoonson/repos","events_url":"https://api.github.com/users/jihoonson/events{/privacy}","received_events_url":"https://api.github.com/users/jihoonson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jihoonson/tajo-2","description":"Mirror of Apache Tajo","fork":true,"url":"https://api.github.com/repos/jihoonson/tajo-2","forks_url":"https://api.github.com/repos/jihoonson/tajo-2/forks","keys_url":"https://api.github.com/repos/jihoonson/tajo-2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jihoonson/tajo-2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jihoonson/tajo-2/teams","hooks_url":"https://api.github.com/repos/jihoonson/tajo-2/hooks","issue_events_url":"https://api.github.com/repos/jihoonson/tajo-2/issues/events{/number}","events_url":"https://api.github.com/repos/jihoonson/tajo-2/events","assignees_url":"https://api.github.com/repos/jihoonson/tajo-2/assignees{/user}","branches_url":"https://api.github.com/repos/jihoonson/tajo-2/branches{/branch}","tags_url":"https://api.github.com/repos/jihoonson/tajo-2/tags","blobs_url":"https://api.github.com/repos/jihoonson/tajo-2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jihoonson/tajo-2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jihoonson/tajo-2/git/refs{/sha}","trees_url":"https://api.github.com/repos/jihoonson/tajo-2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jihoonson/tajo-2/statuses/{sha}","languages_url":"https://api.github.com/repos/jihoonson/tajo-2/languages","stargazers_url":"https://api.github.com/repos/jihoonson/tajo-2/stargazers","contributors_url":"https://api.github.com/repos/jihoonson/tajo-2/contributors","subscribers_url":"https://api.github.com/repos/jihoonson/tajo-2/subscribers","subscription_url":"https://api.github.com/repos/jihoonson/tajo-2/subscription","commits_url":"https://api.github.com/repos/jihoonson/tajo-2/commits{/sha}","git_commits_url":"https://api.github.com/repos/jihoonson/tajo-2/git/commits{/sha}","comments_url":"https://api.github.com/repos/jihoonson/tajo-2/comments{/number}","issue_comment_url":"https://api.github.com/repos/jihoonson/tajo-2/issues/comments{/number}","contents_url":"https://api.github.com/repos/jihoonson/tajo-2/contents/{+path}","compare_url":"https://api.github.com/repos/jihoonson/tajo-2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jihoonson/tajo-2/merges","archive_url":"https://api.github.com/repos/jihoonson/tajo-2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jihoonson/tajo-2/downloads","issues_url":"https://api.github.com/repos/jihoonson/tajo-2/issues{/number}","pulls_url":"https://api.github.com/repos/jihoonson/tajo-2/pulls{/number}","milestones_url":"https://api.github.com/repos/jihoonson/tajo-2/milestones{/number}","notifications_url":"https://api.github.com/repos/jihoonson/tajo-2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jihoonson/tajo-2/labels{/name}","releases_url":"https://api.github.com/repos/jihoonson/tajo-2/releases{/id}","created_at":"2014-05-13T02:59:45Z","updated_at":"2014-06-24T11:47:13Z","pushed_at":"2015-07-29T07:51:40Z","git_url":"git://github.com/jihoonson/tajo-2.git","ssh_url":"git@github.com:jihoonson/tajo-2.git","clone_url":"https://github.com/jihoonson/tajo-2.git","svn_url":"https://github.com/jihoonson/tajo-2","homepage":null,"size":24173,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":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":"59cb66fc40b78d1f884f008796b85312d6ae8c72","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":17971138,"name":"tajo","full_name":"apache/tajo","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/tajo","description":"Mirror of Apache Tajo","fork":false,"url":"https://api.github.com/repos/apache/tajo","forks_url":"https://api.github.com/repos/apache/tajo/forks","keys_url":"https://api.github.com/repos/apache/tajo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/tajo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/tajo/teams","hooks_url":"https://api.github.com/repos/apache/tajo/hooks","issue_events_url":"https://api.github.com/repos/apache/tajo/issues/events{/number}","events_url":"https://api.github.com/repos/apache/tajo/events","assignees_url":"https://api.github.com/repos/apache/tajo/assignees{/user}","branches_url":"https://api.github.com/repos/apache/tajo/branches{/branch}","tags_url":"https://api.github.com/repos/apache/tajo/tags","blobs_url":"https://api.github.com/repos/apache/tajo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/tajo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/tajo/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/tajo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/tajo/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/tajo/languages","stargazers_url":"https://api.github.com/repos/apache/tajo/stargazers","contributors_url":"https://api.github.com/repos/apache/tajo/contributors","subscribers_url":"https://api.github.com/repos/apache/tajo/subscribers","subscription_url":"https://api.github.com/repos/apache/tajo/subscription","commits_url":"https://api.github.com/repos/apache/tajo/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/tajo/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/tajo/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/tajo/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/tajo/contents/{+path}","compare_url":"https://api.github.com/repos/apache/tajo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/tajo/merges","archive_url":"https://api.github.com/repos/apache/tajo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/tajo/downloads","issues_url":"https://api.github.com/repos/apache/tajo/issues{/number}","pulls_url":"https://api.github.com/repos/apache/tajo/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/tajo/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/tajo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/tajo/labels{/name}","releases_url":"https://api.github.com/repos/apache/tajo/releases{/id}","created_at":"2014-03-21T07:00:07Z","updated_at":"2015-07-27T14:32:55Z","pushed_at":"2015-07-29T07:54:07Z","git_url":"git://github.com/apache/tajo.git","ssh_url":"git@github.com:apache/tajo.git","clone_url":"https://github.com/apache/tajo.git","svn_url":"https://github.com/apache/tajo","homepage":null,"size":42111,"stargazers_count":57,"watchers_count":57,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":67,"mirror_url":"git://git.apache.org/tajo.git","open_issues_count":56,"forks":67,"open_issues":56,"watchers":57,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/tajo/pulls/655"},"html":{"href":"https://github.com/apache/tajo/pull/655"},"issue":{"href":"https://api.github.com/repos/apache/tajo/issues/655"},"comments":{"href":"https://api.github.com/repos/apache/tajo/issues/655/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/tajo/pulls/655/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/tajo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/tajo/pulls/655/commits"},"statuses":{"href":"https://api.github.com/repos/apache/tajo/statuses/9c1c58d6dab2a83e24a820fb491e5596b0fa68d6"}}}}