tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [08/10] tajo git commit: TAJO-1313: Tajo-dump creates DDLs for information_schema tables
Date Mon, 02 Feb 2015 12:29:13 GMT
TAJO-1313: Tajo-dump creates DDLs for information_schema tables

Closes #365


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

Branch: refs/heads/index_support
Commit: 1e007595dc4ebbcab42d8e32e9d519e7cbf6f96b
Parents: fd73074
Author: Jihun Kang <jihun@apache.org>
Authored: Mon Feb 2 17:22:15 2015 +0900
Committer: Jihun Kang <jihun@apache.org>
Committed: Mon Feb 2 17:22:15 2015 +0900

----------------------------------------------------------------------
 CHANGES                                             |  3 +++
 .../org/apache/tajo/catalog/CatalogConstants.java   |  2 ++
 .../java/org/apache/tajo/cli/tools/TajoDump.java    | 16 +++++++++++++++-
 3 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/1e007595/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 8466a38..666ee9a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -174,6 +174,9 @@ Release 0.10.0 - unreleased
 
   BUG FIXES
 
+    TAJO-1313: Tajo-dump creates DDLs for information_schema tables.
+    (jihun)
+
     TAJO-1322: Invalid stored caching on StorageManager. (jinho)
 
     TAJO-1319: Tajo can't find HBase configuration file. (jaehwa)

http://git-wip-us.apache.org/repos/asf/tajo/blob/1e007595/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogConstants.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogConstants.java
b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogConstants.java
index 6ec52b9..a8c5c9b 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogConstants.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogConstants.java
@@ -53,4 +53,6 @@ public class CatalogConstants {
   public static final String COL_DATABASES_PK = "DB_ID";
   public static final String COL_TABLES_PK = "TID";
   public static final String COL_TABLES_NAME = "TABLE_NAME";
+  
+  public static final String INFORMATION_SCHEMA_DB_NAME = "information_schema";
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/1e007595/tajo-client/src/main/java/org/apache/tajo/cli/tools/TajoDump.java
----------------------------------------------------------------------
diff --git a/tajo-client/src/main/java/org/apache/tajo/cli/tools/TajoDump.java b/tajo-client/src/main/java/org/apache/tajo/cli/tools/TajoDump.java
index 750ead0..7f38a5d 100644
--- a/tajo-client/src/main/java/org/apache/tajo/cli/tools/TajoDump.java
+++ b/tajo-client/src/main/java/org/apache/tajo/cli/tools/TajoDump.java
@@ -19,11 +19,14 @@
 package org.apache.tajo.cli.tools;
 
 import com.google.protobuf.ServiceException;
+
 import org.apache.commons.cli.*;
 import org.apache.tajo.auth.UserRoleInfo;
+import org.apache.tajo.catalog.CatalogConstants;
 import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.DDLBuilder;
 import org.apache.tajo.catalog.TableDesc;
+import org.apache.tajo.catalog.proto.CatalogProtos.StoreType;
 import org.apache.tajo.client.TajoClient;
 import org.apache.tajo.client.TajoClientImpl;
 import org.apache.tajo.conf.TajoConf;
@@ -116,6 +119,10 @@ public class TajoDump {
 
     System.exit(0);
   }
+  
+  private static boolean isAcceptableDumpingDatabase(String databaseName) {
+    return (databaseName == null || !databaseName.equalsIgnoreCase(CatalogConstants.INFORMATION_SCHEMA_DB_NAME));
+  }
 
   public static void dump(TajoClient client, UserRoleInfo userInfo, String baseDatabaseName,
                    boolean isDumpingAllDatabases, boolean includeUserName, boolean includeDate,
PrintWriter out)
@@ -128,7 +135,9 @@ public class TajoDump {
       Collections.sort(sorted);
 
       for (String databaseName : sorted) {
-        dumpDatabase(client, databaseName, out);
+        if (isAcceptableDumpingDatabase(databaseName)) {
+          dumpDatabase(client, databaseName, out);
+        }
       }
     } else {
       dumpDatabase(client, baseDatabaseName, out);
@@ -166,6 +175,11 @@ public class TajoDump {
     for (String tableName : tableNames) {
       try {
         TableDesc table = client.getTableDesc(CatalogUtil.buildFQName(databaseName, tableName));
+        
+        if (table.getMeta().getStoreType() == StoreType.SYSTEM) {
+          continue;
+        }
+        
         if (table.isExternal()) {
           writer.write(DDLBuilder.buildDDLForExternalTable(table));
         } else {


Mime
View raw message