You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by ji...@apache.org on 2015/07/02 08:32:44 UTC

[1/2] tajo git commit: TAJO-1657: Tajo Rest API /database/{database-name]/tables should return table names only without invalid external table info.

Repository: tajo
Updated Branches:
  refs/heads/index_support 806469a26 -> 8effa3355


TAJO-1657: Tajo Rest API /database/{database-name]/tables should return table names only without invalid external table info.

Closes #619

Signed-off-by: Jihoon Son <ji...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/fec59618
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/fec59618
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/fec59618

Branch: refs/heads/index_support
Commit: fec596185e5471c73f77af8dbe7cc8f7a1ab1a96
Parents: 773c3eb
Author: DaeMyung Kang <ch...@naver.com>
Authored: Wed Jul 1 13:57:48 2015 +0900
Committer: Jihoon Son <ji...@apache.org>
Committed: Wed Jul 1 13:57:48 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  4 ++++
 .../tajo/ws/rs/resources/TablesResource.java    | 19 +++++++----------
 .../ws/rs/resources/TestTablesResource.java     | 22 +++++++++++---------
 3 files changed, 23 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/fec59618/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 90ef54a..63499b5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -166,6 +166,10 @@ Release 0.11.0 - unreleased
 
   BUG FIXES
 
+    TAJO-1657: Tajo Rest API /database/{database-name]/tables should return table 
+    names only without invalid external table info. 
+    (Contributed by  DaeMyung Kang, Committed by jihoon)
+
     TAJO-1644: When inserting empty data into a partitioned table,
     existing data would be removed. (jaehwa)
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/fec59618/tajo-core/src/main/java/org/apache/tajo/ws/rs/resources/TablesResource.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/ws/rs/resources/TablesResource.java b/tajo-core/src/main/java/org/apache/tajo/ws/rs/resources/TablesResource.java
index 3e638d6..f85d25f 100644
--- a/tajo-core/src/main/java/org/apache/tajo/ws/rs/resources/TablesResource.java
+++ b/tajo-core/src/main/java/org/apache/tajo/ws/rs/resources/TablesResource.java
@@ -19,9 +19,7 @@
 package org.apache.tajo.ws.rs.resources;
 
 import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
+import java.util.*;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
@@ -64,7 +62,8 @@ public class TablesResource {
   String databaseName;
   
   JerseyResourceDelegateContext context;
-  
+
+  private static final String tablesKeyName = "tables";
   private static final String databaseNameKeyName = "databaseName";
   private static final String tableNameKeyName = "tableName";
   private static final String tableDescKeyName = "tableDesc";
@@ -206,15 +205,11 @@ public class TablesResource {
       if (!catalogService.existDatabase(databaseName)) {
         return Response.status(Status.NOT_FOUND).build();
       }
-      
+
       Collection<String> tableNames = catalogService.getAllTableNames(databaseName);
-      List<TableDesc> tables = new ArrayList<TableDesc>();
-      
-      for (String tableName: tableNames) {
-        tables.add(new TableDesc(tableName, null, null, null));
-      }
-      
-      return Response.ok(tables).build();
+      Map<String, Collection<String>> tableNamesMap = new HashMap<String, Collection<String>>();
+      tableNamesMap.put(tablesKeyName, tableNames);
+      return Response.ok(tableNamesMap).build();
     }
     
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fec59618/tajo-core/src/test/java/org/apache/tajo/ws/rs/resources/TestTablesResource.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/ws/rs/resources/TestTablesResource.java b/tajo-core/src/test/java/org/apache/tajo/ws/rs/resources/TestTablesResource.java
index 8b1ca14..3f2bd50 100644
--- a/tajo-core/src/test/java/org/apache/tajo/ws/rs/resources/TestTablesResource.java
+++ b/tajo-core/src/test/java/org/apache/tajo/ws/rs/resources/TestTablesResource.java
@@ -17,7 +17,6 @@
  */
 package org.apache.tajo.ws.rs.resources;
 
-import com.google.gson.internal.StringMap;
 import org.apache.tajo.QueryTestCaseBase;
 import org.apache.tajo.catalog.*;
 import org.apache.tajo.common.TajoDataTypes;
@@ -39,7 +38,9 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status;
 import java.net.URI;
+import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
 import static org.junit.Assert.*;
 
@@ -103,16 +104,17 @@ public class TestTablesResource extends QueryTestCaseBase {
     
     assertNotNull(response);
     assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
-    
-    List<StringMap<String>> tables = restClient.target(tablesURI)
-        .request().get(new GenericType<List<StringMap<String>>>(List.class));
-    
-    assertNotNull(tables);
-    assertTrue(!tables.isEmpty());
-    
+
+    Map<String, Collection<String>> tables = restClient.target(tablesURI)
+        .request().get(new GenericType<Map<String, Collection<String>>>(Map.class));
+
+    List<String> tableNames = (List<String>)tables.get("tables");
+    assertNotNull(tableNames);
+    assertTrue(!tableNames.isEmpty());
+
     boolean tableFound = false;
-    for (StringMap<String> table: tables) {
-      if (tableName.equals(CatalogUtil.extractSimpleName(table.get("tableName")))) {
+    for (String table: tableNames) {
+      if (tableName.equals(CatalogUtil.extractSimpleName(table))) {
         tableFound = true;
         break;
       }


[2/2] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into index_support

Posted by ji...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into index_support

Conflicts:
	CHANGES


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/8effa335
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/8effa335
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/8effa335

Branch: refs/heads/index_support
Commit: 8effa3355117320faee98e6436cb12d0d9953d57
Parents: 806469a fec5961
Author: Jihoon Son <ji...@apache.org>
Authored: Thu Jul 2 15:32:31 2015 +0900
Committer: Jihoon Son <ji...@apache.org>
Committed: Thu Jul 2 15:32:31 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  4 ++++
 .../tajo/ws/rs/resources/TablesResource.java    | 19 +++++++----------
 .../ws/rs/resources/TestTablesResource.java     | 22 +++++++++++---------
 3 files changed, 23 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/8effa335/CHANGES
----------------------------------------------------------------------
diff --cc CHANGES
index 746ed92,63499b5..7bea70c
--- a/CHANGES
+++ b/CHANGES
@@@ -166,10 -166,10 +166,14 @@@ Release 0.11.0 - unrelease
  
    BUG FIXES
  
 +    TAJO-1608: Fix test failure in index_support branch. (jihoon)
 +
 +    TAJO-1594: Catalog schema is invalid for some databases. (jihoon)
 +
+     TAJO-1657: Tajo Rest API /database/{database-name]/tables should return table 
+     names only without invalid external table info. 
+     (Contributed by  DaeMyung Kang, Committed by jihoon)
+ 
      TAJO-1644: When inserting empty data into a partitioned table,
      existing data would be removed. (jaehwa)