drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jacq...@apache.org
Subject [17/17] git commit: DRILL-990: Add schema mutability property to InfoSchema.SCHEMATA table.
Date Mon, 21 Jul 2014 02:46:39 GMT
DRILL-990: Add schema mutability property to InfoSchema.SCHEMATA table.


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

Branch: refs/heads/master
Commit: d39986188d17af92fc8c91b61a0f086a65f95d1a
Parents: 111c1a8
Author: vkorukanti <venki.korukanti@gmail.com>
Authored: Mon Jul 14 18:32:57 2014 -0700
Committer: Jacques Nadeau <jacques@apache.org>
Committed: Sun Jul 20 16:49:19 2014 -0700

----------------------------------------------------------------------
 .../exec/store/ischema/InfoSchemaTable.java      |  3 ++-
 .../exec/store/ischema/RecordGenerator.java      |  2 +-
 .../apache/drill/exec/store/ischema/Records.java |  4 +++-
 .../apache/drill/jdbc/test/TestMetadataDDL.java  | 19 +++++++++++++++++++
 4 files changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d3998618/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaTable.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaTable.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaTable.java
index e6d39ed..0cf0481 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaTable.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaTable.java
@@ -101,7 +101,8 @@ public abstract class InfoSchemaTable{
         Field.create("CATALOG_NAME", VARCHAR),
         Field.create("SCHEMA_NAME", VARCHAR),
         Field.create("SCHEMA_OWNER", VARCHAR),
-        Field.create("TYPE", VARCHAR));
+        Field.create("TYPE", VARCHAR),
+        Field.create("IS_MUTABLE", VARCHAR));
 
     public Schemata() {
       super("SCHEMATA", fields);

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d3998618/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/RecordGenerator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/RecordGenerator.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/RecordGenerator.java
index df67da1..00ab0a0 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/RecordGenerator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/RecordGenerator.java
@@ -116,7 +116,7 @@ public abstract class RecordGenerator {
     public boolean visitSchema(String schemaName, SchemaPlus schema) {
       if (shouldVisitSchema(schema) && schemaName != null && !schemaName.isEmpty())
{
         AbstractSchema as = schema.unwrap(AbstractSchema.class);
-        records.add(new Records.Schema("DRILL", schemaName, "<owner>", as.getTypeName()));
+        records.add(new Records.Schema("DRILL", schemaName, "<owner>", as.getTypeName(),
as.isMutable()));
       }
       return false;
     }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d3998618/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/Records.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/Records.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/Records.java
index 9bb182f..ec8ee2b 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/Records.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/Records.java
@@ -124,12 +124,14 @@ public class Records {
     public final String SCHEMA_NAME;
     public final String SCHEMA_OWNER;
     public final String TYPE;
+    public final String IS_MUTABLE;
 
-    public Schema(String catalog, String name, String owner, String type) {
+    public Schema(String catalog, String name, String owner, String type, boolean isMutable)
{
       this.CATALOG_NAME = catalog;
       this.SCHEMA_NAME = name;
       this.SCHEMA_OWNER = owner;
       this.TYPE = type;
+      this.IS_MUTABLE = isMutable ? "YES" : "NO";
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d3998618/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestMetadataDDL.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestMetadataDDL.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestMetadataDDL.java
index 6d09976..b1fc193 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestMetadataDDL.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestMetadataDDL.java
@@ -54,6 +54,25 @@ public class TestMetadataDDL extends JdbcTestQueryBase {
   }
 
   @Test
+  public void testSchemata() throws Exception{
+    JdbcAssert.withNoDefaultSchema()
+        .sql("SELECT * FROM INFORMATION_SCHEMA.SCHEMATA")
+        .returns(
+            "CATALOG_NAME=DRILL; SCHEMA_NAME=dfs.default; SCHEMA_OWNER=<owner>; TYPE=file;
IS_MUTABLE=NO\n" +
+            "CATALOG_NAME=DRILL; SCHEMA_NAME=dfs.root; SCHEMA_OWNER=<owner>; TYPE=file;
IS_MUTABLE=NO\n" +
+            "CATALOG_NAME=DRILL; SCHEMA_NAME=dfs.tmp; SCHEMA_OWNER=<owner>; TYPE=file;
IS_MUTABLE=YES\n" +
+            "CATALOG_NAME=DRILL; SCHEMA_NAME=sys; SCHEMA_OWNER=<owner>; TYPE=system-tables;
IS_MUTABLE=NO\n" +
+            "CATALOG_NAME=DRILL; SCHEMA_NAME=dfs_test.home; SCHEMA_OWNER=<owner>; TYPE=file;
IS_MUTABLE=NO\n" +
+            "CATALOG_NAME=DRILL; SCHEMA_NAME=dfs_test.default; SCHEMA_OWNER=<owner>;
TYPE=file; IS_MUTABLE=NO\n" +
+            "CATALOG_NAME=DRILL; SCHEMA_NAME=dfs_test.tmp; SCHEMA_OWNER=<owner>; TYPE=file;
IS_MUTABLE=YES\n" +
+            "CATALOG_NAME=DRILL; SCHEMA_NAME=cp.default; SCHEMA_OWNER=<owner>; TYPE=file;
IS_MUTABLE=NO\n" +
+            "CATALOG_NAME=DRILL; SCHEMA_NAME=hive_test.default; SCHEMA_OWNER=<owner>;
TYPE=hive; IS_MUTABLE=NO\n" +
+            "CATALOG_NAME=DRILL; SCHEMA_NAME=hive_test.db1; SCHEMA_OWNER=<owner>; TYPE=hive;
IS_MUTABLE=NO\n" +
+            "CATALOG_NAME=DRILL; SCHEMA_NAME=INFORMATION_SCHEMA; SCHEMA_OWNER=<owner>;
TYPE=ischema; IS_MUTABLE=NO\n"
+        );
+  }
+
+  @Test
   public void testShowTables() throws Exception{
     JdbcAssert.withFull("hive_test.default")
         .sql("SHOW TABLES")


Mime
View raw message