calcite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject [3/3] incubator-calcite git commit: [CALCITE-789] MetaImpl.MetaCatalog should expose TABLE_CAT instead of TABLE_CATALOG
Date Thu, 09 Jul 2015 18:10:20 GMT
[CALCITE-789] MetaImpl.MetaCatalog should expose TABLE_CAT instead of TABLE_CATALOG


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

Branch: refs/heads/master
Commit: 464fd364a4ed0563645dee3cefdf2cc5195533fa
Parents: fcb6ba5
Author: Julian Hyde <jhyde@apache.org>
Authored: Tue Jul 7 12:00:10 2015 -0700
Committer: Julian Hyde <jhyde@apache.org>
Committed: Thu Jul 9 10:47:18 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/calcite/avatica/Meta.java   | 26 ++++++++++++++++++++
 .../org/apache/calcite/avatica/MetaImpl.java    |  7 +++---
 .../apache/calcite/jdbc/CalciteMetaImpl.java    |  3 ++-
 .../calcite/jdbc/CalciteRemoteDriverTest.java   |  4 +--
 .../java/org/apache/calcite/test/JdbcTest.java  | 12 ++++-----
 5 files changed, 40 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/464fd364/avatica/src/main/java/org/apache/calcite/avatica/Meta.java
----------------------------------------------------------------------
diff --git a/avatica/src/main/java/org/apache/calcite/avatica/Meta.java b/avatica/src/main/java/org/apache/calcite/avatica/Meta.java
index 5dd59f0..a15a769 100644
--- a/avatica/src/main/java/org/apache/calcite/avatica/Meta.java
+++ b/avatica/src/main/java/org/apache/calcite/avatica/Meta.java
@@ -52,11 +52,13 @@ public interface Meta {
    */
   Map<DatabaseProperty, Object> getDatabaseProperties();
 
+  /** Per {@link DatabaseMetaData#getTables(String, String, String, String[])}. */
   MetaResultSet getTables(String catalog,
       Pat schemaPattern,
       Pat tableNamePattern,
       List<String> typeList);
 
+  /** Per {@link DatabaseMetaData#getColumns(String, String, String, String)}. */
   MetaResultSet getColumns(String catalog,
       Pat schemaPattern,
       Pat tableNamePattern,
@@ -64,42 +66,56 @@ public interface Meta {
 
   MetaResultSet getSchemas(String catalog, Pat schemaPattern);
 
+  /** Per {@link DatabaseMetaData#getCatalogs()}. */
   MetaResultSet getCatalogs();
 
+  /** Per {@link DatabaseMetaData#getTableTypes()}. */
   MetaResultSet getTableTypes();
 
+  /** Per {@link DatabaseMetaData#getProcedures(String, String, String)}. */
   MetaResultSet getProcedures(String catalog,
       Pat schemaPattern,
       Pat procedureNamePattern);
 
+  /** Per {@link DatabaseMetaData#getProcedureColumns(String, String, String, String)}. */
   MetaResultSet getProcedureColumns(String catalog,
       Pat schemaPattern,
       Pat procedureNamePattern,
       Pat columnNamePattern);
 
+  /** Per {@link DatabaseMetaData#getColumnPrivileges(String, String, String, String)}. */
   MetaResultSet getColumnPrivileges(String catalog,
       String schema,
       String table,
       Pat columnNamePattern);
 
+  /** Per {@link DatabaseMetaData#getTablePrivileges(String, String, String)}. */
   MetaResultSet getTablePrivileges(String catalog,
       Pat schemaPattern,
       Pat tableNamePattern);
 
+  /** Per
+   * {@link DatabaseMetaData#getBestRowIdentifier(String, String, String, int, boolean)}.
*/
   MetaResultSet getBestRowIdentifier(String catalog,
       String schema,
       String table,
       int scope,
       boolean nullable);
 
+  /** Per {@link DatabaseMetaData#getVersionColumns(String, String, String)}. */
   MetaResultSet getVersionColumns(String catalog, String schema, String table);
 
+  /** Per {@link DatabaseMetaData#getPrimaryKeys(String, String, String)}. */
   MetaResultSet getPrimaryKeys(String catalog, String schema, String table);
 
+  /** Per {@link DatabaseMetaData#getImportedKeys(String, String, String)}. */
   MetaResultSet getImportedKeys(String catalog, String schema, String table);
 
+  /** Per {@link DatabaseMetaData#getExportedKeys(String, String, String)}. */
   MetaResultSet getExportedKeys(String catalog, String schema, String table);
 
+  /** Per
+   * {@link DatabaseMetaData#getCrossReference(String, String, String, String, String, String)}.
*/
   MetaResultSet getCrossReference(String parentCatalog,
       String parentSchema,
       String parentTable,
@@ -107,43 +123,53 @@ public interface Meta {
       String foreignSchema,
       String foreignTable);
 
+  /** Per {@link DatabaseMetaData#getTypeInfo()}. */
   MetaResultSet getTypeInfo();
 
+  /** Per {@link DatabaseMetaData#getIndexInfo(String, String, String, boolean, boolean)}.
*/
   MetaResultSet getIndexInfo(String catalog,
       String schema,
       String table,
       boolean unique,
       boolean approximate);
 
+  /** Per {@link DatabaseMetaData#getUDTs(String, String, String, int[])}. */
   MetaResultSet getUDTs(String catalog,
       Pat schemaPattern,
       Pat typeNamePattern,
       int[] types);
 
+  /** Per {@link DatabaseMetaData#getSuperTypes(String, String, String)}. */
   MetaResultSet getSuperTypes(String catalog,
       Pat schemaPattern,
       Pat typeNamePattern);
 
+  /** Per {@link DatabaseMetaData#getSuperTables(String, String, String)}. */
   MetaResultSet getSuperTables(String catalog,
       Pat schemaPattern,
       Pat tableNamePattern);
 
+  /** Per {@link DatabaseMetaData#getAttributes(String, String, String, String)}. */
   MetaResultSet getAttributes(String catalog,
       Pat schemaPattern,
       Pat typeNamePattern,
       Pat attributeNamePattern);
 
+  /** Per {@link DatabaseMetaData#getClientInfoProperties()}. */
   MetaResultSet getClientInfoProperties();
 
+  /** Per {@link DatabaseMetaData#getFunctions(String, String, String)}. */
   MetaResultSet getFunctions(String catalog,
       Pat schemaPattern,
       Pat functionNamePattern);
 
+  /** Per {@link DatabaseMetaData#getFunctionColumns(String, String, String, String)}. */
   MetaResultSet getFunctionColumns(String catalog,
       Pat schemaPattern,
       Pat functionNamePattern,
       Pat columnNamePattern);
 
+  /** Per {@link DatabaseMetaData#getPseudoColumns(String, String, String, String)}. */
   MetaResultSet getPseudoColumns(String catalog,
       Pat schemaPattern,
       Pat tableNamePattern,

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/464fd364/avatica/src/main/java/org/apache/calcite/avatica/MetaImpl.java
----------------------------------------------------------------------
diff --git a/avatica/src/main/java/org/apache/calcite/avatica/MetaImpl.java b/avatica/src/main/java/org/apache/calcite/avatica/MetaImpl.java
index 223830d..504c929 100644
--- a/avatica/src/main/java/org/apache/calcite/avatica/MetaImpl.java
+++ b/avatica/src/main/java/org/apache/calcite/avatica/MetaImpl.java
@@ -286,6 +286,7 @@ public abstract class MetaImpl implements Meta {
     public final int ordinalPosition;
     public final String isNullable;
     public final String scopeCatalog = null;
+    public final String scopeSchema = null;
     public final String scopeTable = null;
     public final String sourceDataType = null;
     public final String isAutoincrement = null;
@@ -374,15 +375,15 @@ public abstract class MetaImpl implements Meta {
 
   /** Metadata describing a catalog. */
   public static class MetaCatalog implements Named {
-    public final String tableCatalog;
+    public final String tableCat;
 
     public MetaCatalog(
         String tableCatalog) {
-      this.tableCatalog = tableCatalog;
+      this.tableCat = tableCatalog;
     }
 
     public String getName() {
-      return tableCatalog;
+      return tableCat;
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/464fd364/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java b/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
index d087f9b..cd3df50 100644
--- a/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
+++ b/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
@@ -344,6 +344,7 @@ public class CalciteMetaImpl extends MetaImpl {
         "ORDINAL_POSITION",
         "IS_NULLABLE",
         "SCOPE_CATALOG",
+        "SCOPE_SCHEMA",
         "SCOPE_TABLE",
         "SOURCE_DATA_TYPE",
         "IS_AUTOINCREMENT",
@@ -514,7 +515,7 @@ public class CalciteMetaImpl extends MetaImpl {
   public MetaResultSet getCatalogs() {
     return createResultSet(catalogs(),
         MetaCatalog.class,
-        "TABLE_CATALOG");
+        "TABLE_CAT");
   }
 
   public MetaResultSet getTableTypes() {

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/464fd364/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java b/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java
index f7aba8c..9491645 100644
--- a/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java
+++ b/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java
@@ -174,7 +174,7 @@ public class CalciteRemoteDriverTest {
     final ResultSet resultSet = connection.getMetaData().getCatalogs();
     final ResultSetMetaData metaData = resultSet.getMetaData();
     assertEquals(1, metaData.getColumnCount());
-    assertEquals("TABLE_CATALOG", metaData.getColumnName(1));
+    assertEquals("TABLE_CAT", metaData.getColumnName(1));
     assertTrue(resultSet.next());
     assertFalse(resultSet.next());
     resultSet.close();
@@ -241,7 +241,7 @@ public class CalciteRemoteDriverTest {
   @Test public void testRemoteCatalogs() throws Exception {
     CalciteAssert.hr().with(REMOTE_CONNECTION_FACTORY)
         .metaData(GET_CATALOGS)
-        .returns("TABLE_CATALOG=null\n");
+        .returns("TABLE_CAT=null\n");
   }
 
   @Test public void testRemoteSchemas() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/464fd364/core/src/test/java/org/apache/calcite/test/JdbcTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/JdbcTest.java b/core/src/test/java/org/apache/calcite/test/JdbcTest.java
index 658619d..941b88a 100644
--- a/core/src/test/java/org/apache/calcite/test/JdbcTest.java
+++ b/core/src/test/java/org/apache/calcite/test/JdbcTest.java
@@ -5071,18 +5071,18 @@ public class JdbcTest {
 
               // columns
               assertEquals(
-                  "TABLE_CAT=null; TABLE_SCHEM=adhoc; TABLE_NAME=V; COLUMN_NAME=empid; DATA_TYPE=4;
TYPE_NAME=JavaType(int) NOT NULL; COLUMN_SIZE=-1; BUFFER_LENGTH=null; DECIMAL_DIGITS=null;
NUM_PREC_RADIX=10; NULLABLE=0; REMARKS=null; COLUMN_DEF=null; SQL_DATA_TYPE=null; SQL_DATETIME_SUB=null;
CHAR_OCTET_LENGTH=-1; ORDINAL_POSITION=1; IS_NULLABLE=NO; SCOPE_CATALOG=null; SCOPE_TABLE=null;
SOURCE_DATA_TYPE=null; IS_AUTOINCREMENT=null; IS_GENERATEDCOLUMN=null\n"
-                      + "TABLE_CAT=null; TABLE_SCHEM=adhoc; TABLE_NAME=V; COLUMN_NAME=deptno;
DATA_TYPE=4; TYPE_NAME=JavaType(int) NOT NULL; COLUMN_SIZE=-1; BUFFER_LENGTH=null; DECIMAL_DIGITS=null;
NUM_PREC_RADIX=10; NULLABLE=0; REMARKS=null; COLUMN_DEF=null; SQL_DATA_TYPE=null; SQL_DATETIME_SUB=null;
CHAR_OCTET_LENGTH=-1; ORDINAL_POSITION=2; IS_NULLABLE=NO; SCOPE_CATALOG=null; SCOPE_TABLE=null;
SOURCE_DATA_TYPE=null; IS_AUTOINCREMENT=null; IS_GENERATEDCOLUMN=null\n"
-                      + "TABLE_CAT=null; TABLE_SCHEM=adhoc; TABLE_NAME=V; COLUMN_NAME=name;
DATA_TYPE=12; TYPE_NAME=JavaType(class java.lang.String); COLUMN_SIZE=-1; BUFFER_LENGTH=null;
DECIMAL_DIGITS=null; NUM_PREC_RADIX=10; NULLABLE=1; REMARKS=null; COLUMN_DEF=null; SQL_DATA_TYPE=null;
SQL_DATETIME_SUB=null; CHAR_OCTET_LENGTH=-1; ORDINAL_POSITION=3; IS_NULLABLE=YES; SCOPE_CATALOG=null;
SCOPE_TABLE=null; SOURCE_DATA_TYPE=null; IS_AUTOINCREMENT=null; IS_GENERATEDCOLUMN=null\n"
-                      + "TABLE_CAT=null; TABLE_SCHEM=adhoc; TABLE_NAME=V; COLUMN_NAME=salary;
DATA_TYPE=7; TYPE_NAME=JavaType(float) NOT NULL; COLUMN_SIZE=-1; BUFFER_LENGTH=null; DECIMAL_DIGITS=null;
NUM_PREC_RADIX=10; NULLABLE=0; REMARKS=null; COLUMN_DEF=null; SQL_DATA_TYPE=null; SQL_DATETIME_SUB=null;
CHAR_OCTET_LENGTH=-1; ORDINAL_POSITION=4; IS_NULLABLE=NO; SCOPE_CATALOG=null; SCOPE_TABLE=null;
SOURCE_DATA_TYPE=null; IS_AUTOINCREMENT=null; IS_GENERATEDCOLUMN=null\n"
-                      + "TABLE_CAT=null; TABLE_SCHEM=adhoc; TABLE_NAME=V; COLUMN_NAME=commission;
DATA_TYPE=4; TYPE_NAME=JavaType(class java.lang.Integer); COLUMN_SIZE=-1; BUFFER_LENGTH=null;
DECIMAL_DIGITS=null; NUM_PREC_RADIX=10; NULLABLE=1; REMARKS=null; COLUMN_DEF=null; SQL_DATA_TYPE=null;
SQL_DATETIME_SUB=null; CHAR_OCTET_LENGTH=-1; ORDINAL_POSITION=5; IS_NULLABLE=YES; SCOPE_CATALOG=null;
SCOPE_TABLE=null; SOURCE_DATA_TYPE=null; IS_AUTOINCREMENT=null; IS_GENERATEDCOLUMN=null\n",
+                  "TABLE_CAT=null; TABLE_SCHEM=adhoc; TABLE_NAME=V; COLUMN_NAME=empid; DATA_TYPE=4;
TYPE_NAME=JavaType(int) NOT NULL; COLUMN_SIZE=-1; BUFFER_LENGTH=null; DECIMAL_DIGITS=null;
NUM_PREC_RADIX=10; NULLABLE=0; REMARKS=null; COLUMN_DEF=null; SQL_DATA_TYPE=null; SQL_DATETIME_SUB=null;
CHAR_OCTET_LENGTH=-1; ORDINAL_POSITION=1; IS_NULLABLE=NO; SCOPE_CATALOG=null; SCOPE_SCHEMA=null;
SCOPE_TABLE=null; SOURCE_DATA_TYPE=null; IS_AUTOINCREMENT=null; IS_GENERATEDCOLUMN=null\n"
+                      + "TABLE_CAT=null; TABLE_SCHEM=adhoc; TABLE_NAME=V; COLUMN_NAME=deptno;
DATA_TYPE=4; TYPE_NAME=JavaType(int) NOT NULL; COLUMN_SIZE=-1; BUFFER_LENGTH=null; DECIMAL_DIGITS=null;
NUM_PREC_RADIX=10; NULLABLE=0; REMARKS=null; COLUMN_DEF=null; SQL_DATA_TYPE=null; SQL_DATETIME_SUB=null;
CHAR_OCTET_LENGTH=-1; ORDINAL_POSITION=2; IS_NULLABLE=NO; SCOPE_CATALOG=null; SCOPE_SCHEMA=null;
SCOPE_TABLE=null; SOURCE_DATA_TYPE=null; IS_AUTOINCREMENT=null; IS_GENERATEDCOLUMN=null\n"
+                      + "TABLE_CAT=null; TABLE_SCHEM=adhoc; TABLE_NAME=V; COLUMN_NAME=name;
DATA_TYPE=12; TYPE_NAME=JavaType(class java.lang.String); COLUMN_SIZE=-1; BUFFER_LENGTH=null;
DECIMAL_DIGITS=null; NUM_PREC_RADIX=10; NULLABLE=1; REMARKS=null; COLUMN_DEF=null; SQL_DATA_TYPE=null;
SQL_DATETIME_SUB=null; CHAR_OCTET_LENGTH=-1; ORDINAL_POSITION=3; IS_NULLABLE=YES; SCOPE_CATALOG=null;
SCOPE_SCHEMA=null; SCOPE_TABLE=null; SOURCE_DATA_TYPE=null; IS_AUTOINCREMENT=null; IS_GENERATEDCOLUMN=null\n"
+                      + "TABLE_CAT=null; TABLE_SCHEM=adhoc; TABLE_NAME=V; COLUMN_NAME=salary;
DATA_TYPE=7; TYPE_NAME=JavaType(float) NOT NULL; COLUMN_SIZE=-1; BUFFER_LENGTH=null; DECIMAL_DIGITS=null;
NUM_PREC_RADIX=10; NULLABLE=0; REMARKS=null; COLUMN_DEF=null; SQL_DATA_TYPE=null; SQL_DATETIME_SUB=null;
CHAR_OCTET_LENGTH=-1; ORDINAL_POSITION=4; IS_NULLABLE=NO; SCOPE_CATALOG=null; SCOPE_SCHEMA=null;
SCOPE_TABLE=null; SOURCE_DATA_TYPE=null; IS_AUTOINCREMENT=null; IS_GENERATEDCOLUMN=null\n"
+                      + "TABLE_CAT=null; TABLE_SCHEM=adhoc; TABLE_NAME=V; COLUMN_NAME=commission;
DATA_TYPE=4; TYPE_NAME=JavaType(class java.lang.Integer); COLUMN_SIZE=-1; BUFFER_LENGTH=null;
DECIMAL_DIGITS=null; NUM_PREC_RADIX=10; NULLABLE=1; REMARKS=null; COLUMN_DEF=null; SQL_DATA_TYPE=null;
SQL_DATETIME_SUB=null; CHAR_OCTET_LENGTH=-1; ORDINAL_POSITION=5; IS_NULLABLE=YES; SCOPE_CATALOG=null;
SCOPE_SCHEMA=null; SCOPE_TABLE=null; SOURCE_DATA_TYPE=null; IS_AUTOINCREMENT=null; IS_GENERATEDCOLUMN=null\n",
                   CalciteAssert.toString(
                       metaData.getColumns(
                           null, "adhoc", "V", null)));
 
               // catalog
               assertEquals(
-                  "TABLE_CATALOG=null\n",
+                  "TABLE_CAT=null\n",
                   CalciteAssert.toString(
                       metaData.getCatalogs()));
 


Mime
View raw message