hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nzh...@apache.org
Subject svn commit: r1084653 - in /hive/trunk/jdbc/src: java/org/apache/hadoop/hive/jdbc/HiveMetaDataResultSet.java test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java
Date Wed, 23 Mar 2011 17:56:38 GMT
Author: nzhang
Date: Wed Mar 23 17:56:38 2011
New Revision: 1084653

URL: http://svn.apache.org/viewvc?rev=1084653&view=rev
Log:
HIVE-2069. NullPointerException on getSchemas (Bennie Schut via Ning Zhang)

Modified:
    hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveMetaDataResultSet.java
    hive/trunk/jdbc/src/test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java

Modified: hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveMetaDataResultSet.java
URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveMetaDataResultSet.java?rev=1084653&r1=1084652&r2=1084653&view=diff
==============================================================================
--- hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveMetaDataResultSet.java (original)
+++ hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveMetaDataResultSet.java Wed Mar
23 17:56:38 2011
@@ -29,9 +29,21 @@ public abstract class HiveMetaDataResult
   public HiveMetaDataResultSet(final List<String> columnNames
           , final List<String> columnTypes
           , final List<M> data) throws SQLException {
-    this.data = new ArrayList<M>(data);
-    this.columnNames = new ArrayList<String>(columnNames);
-    this.columnTypes = new ArrayList<String>(columnTypes);
+    if (data!=null) {
+      this.data = new ArrayList<M>(data);
+    } else {
+      this.data =  new ArrayList<M>();
+    }
+    if (columnNames!=null) {
+      this.columnNames = new ArrayList<String>(columnNames);
+    } else {
+      this.columnNames =  new ArrayList<String>();
+    }
+    if (columnTypes!=null) {
+      this.columnTypes = new ArrayList<String>(columnTypes);
+    } else {
+      this.columnTypes =  new ArrayList<String>();
+    }
   }
 
   @Override

Modified: hive/trunk/jdbc/src/test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java
URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java?rev=1084653&r1=1084652&r2=1084653&view=diff
==============================================================================
--- hive/trunk/jdbc/src/test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java (original)
+++ hive/trunk/jdbc/src/test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java Wed Mar 23 17:56:38
2011
@@ -481,7 +481,17 @@ public class TestJdbcDriver extends Test
       cnt++;
     }
     rs.close();
-    assertEquals("Incorrect schema count", 1, cnt);
+    assertEquals("Incorrect catalog count", 1, cnt);
+  }
+
+  public void testMetaDataGetSchemas() throws SQLException {
+    ResultSet rs = (ResultSet)con.getMetaData().getSchemas();
+    int cnt = 0;
+    while (rs.next()) {
+      cnt++;
+    }
+    rs.close();
+    assertEquals("Incorrect schema count", 0, cnt);
   }
 
   public void testMetaDataGetTableTypes() throws SQLException {



Mime
View raw message