hadoop-hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r980611 [1/4] - in /hadoop/hive/trunk: ./ jdbc/src/java/org/apache/hadoop/hive/jdbc/ jdbc/src/test/org/apache/hadoop/hive/jdbc/
Date Fri, 30 Jul 2010 00:10:51 GMT
Author: jvs
Date: Fri Jul 30 00:10:50 2010
New Revision: 980611

URL: http://svn.apache.org/viewvc?rev=980611&view=rev
Log:
HIVE-1126. Missiong some Jdbc functionality like getTables
getColumns and HiveResultSet.get* methods based on column name.
(Bennie Schut via jvs)


Added:
    hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveBaseResultSet.java
    hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveMetaDataResultSet.java
    hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveQueryResultSet.java
    hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/JdbcColumn.java
    hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/JdbcTable.java
Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveCallableStatement.java
    hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveConnection.java
    hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveDatabaseMetaData.java
    hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HivePreparedStatement.java
    hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveResultSet.java
    hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveResultSetMetaData.java
    hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveStatement.java
    hadoop/hive/trunk/jdbc/src/test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=980611&r1=980610&r2=980611&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Fri Jul 30 00:10:50 2010
@@ -19,10 +19,14 @@ Trunk -  Unreleased
     HIVE-1481. ngrams() UDAF for estimating top-k n-gram frequencies
     (Mayank Lahiri via jvs)
 
-    HIVE-1408. add option to let hive automatically run in local mode based on 
+    HIVE-1408. add option to let hive automatically run in local mode based on
     tunable heuristics
     (Joydeep Sen Sarma via Ning Zhang)
 
+    HIVE-1126. Missiong some Jdbc functionality like getTables
+    getColumns and HiveResultSet.get* methods based on column name.
+    (Bennie Schut via jvs)
+
   IMPROVEMENTS
 
     HIVE-1394. Do not update transient_lastDdlTime if the partition is modified by a housekeeping

Added: hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveBaseResultSet.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveBaseResultSet.java?rev=980611&view=auto
==============================================================================
--- hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveBaseResultSet.java (added)
+++ hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveBaseResultSet.java Fri
Jul 30 00:10:50 2010
@@ -0,0 +1,935 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.jdbc;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Data independed base class which implements the common part of
+ * all hive resultsets.
+ */
+public abstract class HiveBaseResultSet implements ResultSet{
+  protected SQLWarning warningChain = null;
+  protected boolean wasNull = false;
+  protected List<?> row;
+  protected List<String> columnNames;
+  protected List<String> columnTypes;
+
+  public boolean absolute(int row) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void afterLast() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void beforeFirst() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void cancelRowUpdates() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void deleteRow() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public int findColumn(String columnName) throws SQLException {
+    int columnIndex = columnNames.indexOf(columnName);
+    if (columnIndex==-1) {
+      throw new SQLException();
+    } else {
+      return ++columnIndex;
+    }
+  }
+
+  public boolean first() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Array getArray(int i) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Array getArray(String colName) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public InputStream getAsciiStream(int columnIndex) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public InputStream getAsciiStream(String columnName) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public BigDecimal getBigDecimal(String columnName) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public InputStream getBinaryStream(int columnIndex) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public InputStream getBinaryStream(String columnName) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Blob getBlob(int i) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Blob getBlob(String colName) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean getBoolean(int columnIndex) throws SQLException {
+    Object obj = getObject(columnIndex);
+    if (Number.class.isInstance(obj)) {
+      return ((Number) obj).intValue() != 0;
+    }
+    throw new SQLException("Cannot convert column " + columnIndex + " to boolean");
+  }
+
+  public boolean getBoolean(String columnName) throws SQLException {
+    return getBoolean(findColumn(columnName));
+  }
+
+  public byte getByte(int columnIndex) throws SQLException {
+    Object obj = getObject(columnIndex);
+    if (Number.class.isInstance(obj)) {
+      return ((Number) obj).byteValue();
+    }
+    throw new SQLException("Cannot convert column " + columnIndex + " to byte");
+  }
+
+  public byte getByte(String columnName) throws SQLException {
+    return getByte(findColumn(columnName));
+  }
+
+  public byte[] getBytes(int columnIndex) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public byte[] getBytes(String columnName) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Reader getCharacterStream(int columnIndex) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Reader getCharacterStream(String columnName) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Clob getClob(int i) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Clob getClob(String colName) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public int getConcurrency() throws SQLException {
+    return ResultSet.CONCUR_READ_ONLY;
+  }
+
+  public String getCursorName() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Date getDate(int columnIndex) throws SQLException {
+    Object obj = getObject(columnIndex);
+    if (obj == null) {
+      return null;
+    }
+
+    try {
+      return Date.valueOf((String) obj);
+    } catch (Exception e) {
+      throw new SQLException("Cannot convert column " + columnIndex
+              + " to date: " + e.toString());
+    }
+  }
+
+  public Date getDate(String columnName) throws SQLException {
+    return getDate(findColumn(columnName));
+  }
+
+  public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Date getDate(String columnName, Calendar cal) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public double getDouble(int columnIndex) throws SQLException {
+    try {
+      Object obj = getObject(columnIndex);
+      if (Number.class.isInstance(obj)) {
+        return ((Number) obj).doubleValue();
+      } else if (obj == null) {
+        return 0;
+      } else if (String.class.isInstance(obj)) {
+        return Double.valueOf((String)obj);
+      }
+      throw new Exception("Illegal conversion");
+    } catch (Exception e) {
+      throw new SQLException("Cannot convert column " + columnIndex
+              + " to double: " + e.toString());
+    }
+  }
+
+  public double getDouble(String columnName) throws SQLException {
+    return getDouble(findColumn(columnName));
+  }
+
+  public int getFetchDirection() throws SQLException {
+    return ResultSet.FETCH_FORWARD;
+  }
+
+  public int getFetchSize() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public float getFloat(int columnIndex) throws SQLException {
+    try {
+      Object obj = getObject(columnIndex);
+      if (Number.class.isInstance(obj)) {
+        return ((Number) obj).floatValue();
+      } else if (obj == null) {
+        return 0;
+      } else if (String.class.isInstance(obj)) {
+        return Float.valueOf((String)obj);
+      }
+      throw new Exception("Illegal conversion");
+    } catch (Exception e) {
+      throw new SQLException("Cannot convert column " + columnIndex
+              + " to float: " + e.toString());
+    }
+  }
+
+  public float getFloat(String columnName) throws SQLException {
+    return getFloat(findColumn(columnName));
+  }
+
+  public int getHoldability() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public int getInt(int columnIndex) throws SQLException {
+    try {
+      Object obj = getObject(columnIndex);
+      if (Number.class.isInstance(obj)) {
+        return ((Number) obj).intValue();
+      } else if (obj == null) {
+        return 0;
+      } else if (String.class.isInstance(obj)) {
+        return Integer.valueOf((String)obj);
+      }
+      throw new Exception("Illegal conversion");
+    } catch (Exception e) {
+      throw new SQLException("Cannot convert column " + columnIndex + " to integer" + e.toString());
+    }
+  }
+
+  public int getInt(String columnName) throws SQLException {
+    return getInt(findColumn(columnName));
+  }
+
+  public long getLong(int columnIndex) throws SQLException {
+    try {
+      Object obj = getObject(columnIndex);
+      if (Number.class.isInstance(obj)) {
+        return ((Number) obj).longValue();
+      } else if (obj == null) {
+        return 0;
+      } else if (String.class.isInstance(obj)) {
+        return Long.valueOf((String)obj);
+      }
+      throw new Exception("Illegal conversion");
+    } catch (Exception e) {
+      throw new SQLException("Cannot convert column " + columnIndex + " to long: " + e.toString());
+    }
+  }
+
+  public long getLong(String columnName) throws SQLException {
+    return getLong(findColumn(columnName));
+  }
+
+  public ResultSetMetaData getMetaData() throws SQLException {
+    return new HiveResultSetMetaData(columnNames, columnTypes);
+  }
+
+  public Reader getNCharacterStream(int arg0) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Reader getNCharacterStream(String arg0) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public NClob getNClob(int arg0) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public NClob getNClob(String columnLabel) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public String getNString(int columnIndex) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public String getNString(String columnLabel) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Object getObject(int columnIndex) throws SQLException {
+    if (row == null) {
+      throw new SQLException("No row found.");
+    }
+
+    if (columnIndex > row.size()) {
+      throw new SQLException("Invalid columnIndex: " + columnIndex);
+    }
+
+    try {
+      wasNull = false;
+      if (row.get(columnIndex - 1) == null) {
+        wasNull = true;
+      }
+
+      return row.get(columnIndex - 1);
+    } catch (Exception e) {
+      throw new SQLException(e.toString());
+    }
+  }
+
+  public Object getObject(String columnName) throws SQLException {
+    return getObject(findColumn(columnName));
+  }
+
+  public Object getObject(int i, Map<String, Class<?>> map) throws SQLException
{
+    throw new SQLException("Method not supported");
+  }
+
+  public Object getObject(String colName, Map<String, Class<?>> map) throws SQLException
{
+    throw new SQLException("Method not supported");
+  }
+
+  public Ref getRef(int i) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Ref getRef(String colName) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public int getRow() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public RowId getRowId(int columnIndex) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public RowId getRowId(String columnLabel) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public SQLXML getSQLXML(int columnIndex) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public SQLXML getSQLXML(String columnLabel) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public short getShort(int columnIndex) throws SQLException {
+    try {
+      Object obj = getObject(columnIndex);
+      if (Number.class.isInstance(obj)) {
+        return ((Number) obj).shortValue();
+      } else if (obj == null) {
+        return 0;
+      } else if (String.class.isInstance(obj)) {
+        return Short.valueOf((String)obj);
+      }
+      throw new Exception("Illegal conversion");
+    } catch (Exception e) {
+      throw new SQLException("Cannot convert column " + columnIndex
+              + " to short: " + e.toString());
+    }
+  }
+
+  public short getShort(String columnName) throws SQLException {
+    return getShort(findColumn(columnName));
+  }
+
+  public Statement getStatement() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  /**
+   * @param columnIndex - the first column is 1, the second is 2, ...
+   * @see java.sql.ResultSet#getString(int)
+   */
+
+  public String getString(int columnIndex) throws SQLException {
+    // Column index starts from 1, not 0.
+    Object obj = getObject(columnIndex);
+    if (obj == null) {
+      return null;
+    }
+
+    return obj.toString();
+  }
+
+  public String getString(String columnName) throws SQLException {
+    return getString(findColumn(columnName));
+  }
+
+  public Time getTime(int columnIndex) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Time getTime(String columnName) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Time getTime(String columnName, Calendar cal) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Timestamp getTimestamp(int columnIndex) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Timestamp getTimestamp(String columnName) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public int getType() throws SQLException {
+    return ResultSet.TYPE_FORWARD_ONLY;
+  }
+
+  public URL getURL(int columnIndex) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public URL getURL(String columnName) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public InputStream getUnicodeStream(int columnIndex) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public InputStream getUnicodeStream(String columnName) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void insertRow() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean isAfterLast() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean isBeforeFirst() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean isClosed() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean isFirst() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean isLast() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean last() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void moveToCurrentRow() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void moveToInsertRow() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean previous() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void refreshRow() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean relative(int rows) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean rowDeleted() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean rowInserted() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean rowUpdated() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void setFetchDirection(int direction) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void setFetchSize(int rows) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateArray(int columnIndex, Array x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateArray(String columnName, Array x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateAsciiStream(int columnIndex, InputStream x, int length)
+          throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateAsciiStream(String columnName, InputStream x, int length)
+          throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateAsciiStream(int columnIndex, InputStream x, long length)
+          throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateAsciiStream(String columnLabel, InputStream x, long length)
+          throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBinaryStream(int columnIndex, InputStream x, int length)
+          throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBinaryStream(String columnName, InputStream x, int length)
+          throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBinaryStream(int columnIndex, InputStream x, long length)
+          throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBinaryStream(String columnLabel, InputStream x, long length)
+          throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBlob(int columnIndex, Blob x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBlob(String columnName, Blob x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException
{
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBlob(int columnIndex, InputStream inputStream, long length)
+          throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBlob(String columnLabel, InputStream inputStream,
+                         long length) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBoolean(int columnIndex, boolean x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBoolean(String columnName, boolean x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateByte(int columnIndex, byte x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateByte(String columnName, byte x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBytes(int columnIndex, byte[] x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateBytes(String columnName, byte[] x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateCharacterStream(int columnIndex, Reader x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException
{
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateCharacterStream(int columnIndex, Reader x, int length)
+          throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateCharacterStream(String columnName, Reader reader, int length)
+          throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateCharacterStream(int columnIndex, Reader x, long length)
+          throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateCharacterStream(String columnLabel, Reader reader,
+                                    long length) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateClob(int columnIndex, Clob x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateClob(String columnName, Clob x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateClob(int columnIndex, Reader reader) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateClob(String columnLabel, Reader reader) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateClob(int columnIndex, Reader reader, long length) throws SQLException
{
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateClob(String columnLabel, Reader reader, long length) throws SQLException
{
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateDate(int columnIndex, Date x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateDate(String columnName, Date x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateDouble(int columnIndex, double x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateDouble(String columnName, double x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateFloat(int columnIndex, float x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateFloat(String columnName, float x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateInt(int columnIndex, int x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateInt(String columnName, int x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateLong(int columnIndex, long x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateLong(String columnName, long x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException
{
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException
{
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateNCharacterStream(String columnLabel, Reader reader,
+                                     long length) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateNClob(int columnIndex, NClob clob) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateNClob(String columnLabel, NClob clob) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateNClob(int columnIndex, Reader reader) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateNClob(String columnLabel, Reader reader) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException
{
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException
{
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateNString(int columnIndex, String string) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateNString(String columnLabel, String string) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateNull(int columnIndex) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateNull(String columnName) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateObject(int columnIndex, Object x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateObject(String columnName, Object x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateObject(int columnIndex, Object x, int scale) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateObject(String columnName, Object x, int scale) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateRef(int columnIndex, Ref x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateRef(String columnName, Ref x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateRow() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateRowId(int columnIndex, RowId x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateRowId(String columnLabel, RowId x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateShort(int columnIndex, short x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateShort(String columnName, short x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateString(int columnIndex, String x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateString(String columnName, String x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateTime(int columnIndex, Time x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateTime(String columnName, Time x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public void updateTimestamp(String columnName, Timestamp x) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public SQLWarning getWarnings() throws SQLException {
+    return warningChain;
+  }
+
+  public void clearWarnings() throws SQLException {
+    warningChain = null;
+  }
+
+  public void close() throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean wasNull() throws SQLException {
+    return wasNull;
+  }
+
+  public boolean isWrapperFor(Class<?> iface) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+
+  public <T> T unwrap(Class<T> iface) throws SQLException {
+    throw new SQLException("Method not supported");
+  }
+}

Modified: hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveCallableStatement.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveCallableStatement.java?rev=980611&r1=980610&r2=980611&view=diff
==============================================================================
--- hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveCallableStatement.java
(original)
+++ hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveCallableStatement.java
Fri Jul 30 00:10:50 2010
@@ -1378,7 +1378,7 @@ public class HiveCallableStatement imple
 
   public ResultSet executeQuery() throws SQLException {
     // TODO Auto-generated method stub
-    return new HiveResultSet(null);
+    return new HiveQueryResultSet(null);
   }
 
   /*

Modified: hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveConnection.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveConnection.java?rev=980611&r1=980610&r2=980611&view=diff
==============================================================================
--- hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveConnection.java (original)
+++ hadoop/hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveConnection.java Fri Jul
30 00:10:50 2010
@@ -18,10 +18,23 @@
 
 package org.apache.hadoop.hive.jdbc;
 
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.api.MetaException;
+import org.apache.hadoop.hive.ql.session.SessionState;
+import org.apache.hadoop.hive.service.HiveClient;
+import org.apache.hadoop.hive.service.HiveInterface;
+import org.apache.hadoop.hive.service.HiveServer;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.transport.TSocket;
+import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.transport.TTransportException;
+
 import java.sql.Array;
 import java.sql.Blob;
 import java.sql.CallableStatement;
 import java.sql.Clob;
+import java.sql.Connection;
 import java.sql.DatabaseMetaData;
 import java.sql.NClob;
 import java.sql.PreparedStatement;
@@ -35,29 +48,17 @@ import java.sql.Struct;
 import java.util.Map;
 import java.util.Properties;
 
-import org.apache.hadoop.hive.conf.HiveConf;
-import org.apache.hadoop.hive.metastore.api.MetaException;
-import org.apache.hadoop.hive.ql.session.SessionState;
-import org.apache.hadoop.hive.service.HiveClient;
-import org.apache.hadoop.hive.service.HiveInterface;
-import org.apache.hadoop.hive.service.HiveServer;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.thrift.transport.TSocket;
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TTransportException;
-
 /**
  * HiveConnection.
  *
  */
 public class HiveConnection implements java.sql.Connection {
-  JdbcSessionState session;
-
+  private final JdbcSessionState session;
   private TTransport transport;
   private HiveInterface client;
-  boolean isClosed = true;
-  SQLWarning warningChain = null;
+  private boolean isClosed = true;
+  private SQLWarning warningChain = null;
+  private String uri;
 
   private static final String URI_PREFIX = "jdbc:hive://";
 
@@ -65,12 +66,12 @@ public class HiveConnection implements j
    * TODO: - parse uri (use java.net.URI?).
    */
   public HiveConnection(String uri, Properties info) throws SQLException {
+    this.uri = uri;
     session = new JdbcSessionState(new HiveConf(SessionState.class));
     session.in = null;
     session.out = null;
     session.err = null;
     SessionState.start(session);
-    String originalUri = uri;
 
     if (!uri.startsWith(URI_PREFIX)) {
       throw new SQLException("Invalid URL: " + uri, "08S01");
@@ -105,7 +106,7 @@ public class HiveConnection implements j
         transport.open();
       } catch (TTransportException e) {
         throw new SQLException("Could not establish connecton to "
-            + originalUri + ": " + e.getMessage(), "08S01");
+            + uri + ": " + e.getMessage(), "08S01");
       }
     }
     isClosed = false;
@@ -272,8 +273,7 @@ public class HiveConnection implements j
    */
 
   public String getCatalog() throws SQLException {
-    // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    return "";
   }
 
   /*
@@ -316,7 +316,7 @@ public class HiveConnection implements j
    */
 
   public DatabaseMetaData getMetaData() throws SQLException {
-    return new HiveDatabaseMetaData();
+    return new HiveDatabaseMetaData(client);
   }
 
   /*
@@ -326,8 +326,7 @@ public class HiveConnection implements j
    */
 
   public int getTransactionIsolation() throws SQLException {
-    // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    return Connection.TRANSACTION_NONE;
   }
 
   /*
@@ -368,8 +367,7 @@ public class HiveConnection implements j
    */
 
   public boolean isReadOnly() throws SQLException {
-    // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    return false;
   }
 
   /*



Mime
View raw message