phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject [34/48] phoenix git commit: PHOENIX-1659 PhoenixDatabaseMetaData.getColumns does not return REMARKS column
Date Sun, 21 Feb 2016 03:43:00 GMT
PHOENIX-1659 PhoenixDatabaseMetaData.getColumns does not return REMARKS column


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 4c705228d278721c12f1d7369c990d1de12f9d13
Parents: 89ab41c
Author: Josh Mahonin <jmahonin@interset.com>
Authored: Thu Jun 25 15:52:37 2015 -0400
Committer: Josh Mahonin <jmahonin@interset.com>
Committed: Mon Jun 29 12:30:56 2015 -0400

----------------------------------------------------------------------
 .../end2end/QueryDatabaseMetaDataIT.java        | 31 ++++++++++++++++++++
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |  1 +
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4c705228/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
index 61459a5..2fdccf6 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
@@ -1118,4 +1118,35 @@ public class QueryDatabaseMetaDataIT extends BaseClientManagedTimeIT
{
         assertFalse(rs.next());
     }
 
+    @Test
+    public void testRemarkColumn() throws SQLException {
+        long ts = nextTimestamp();
+        Properties props = new Properties();
+        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 5));
+        Connection conn = DriverManager.getConnection(getUrl(), props);
+
+        // Retrieve the database metadata
+        DatabaseMetaData dbmd = conn.getMetaData();
+        ResultSet rs = dbmd.getColumns(null, null, null, null);
+        rs.next();
+
+        // Lookup column by name, this should return null but not throw an exception
+        String remarks = rs.getString("REMARKS");
+        assertNull(remarks);
+
+        // Same as above, but lookup by position
+        remarks = rs.getString(12);
+        assertNull(remarks);
+
+        // Iterate through metadata columns to find 'COLUMN_NAME' == 'REMARKS'
+        boolean foundRemarksColumn = false;
+        while(rs.next()) {
+            String colName = rs.getString("COLUMN_NAME");
+            if(PhoenixDatabaseMetaData.REMARKS.equals(colName)) {
+                foundRemarksColumn = true;
+                break;
+            }
+        }
+        assertTrue("Could not find REMARKS column", foundRemarksColumn);
+    }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4c705228/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
index 3a0b03b..a862875 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
@@ -437,6 +437,7 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho
                 DECIMAL_DIGITS + "," +
                 NUM_PREC_RADIX + "," +
                 NULLABLE + "," +
+                REMARKS + "," +
                 COLUMN_DEF + "," +
                 SQL_DATA_TYPE + "," +
                 SQL_DATETIME_SUB + "," +


Mime
View raw message