Lukas Eder created HIVE-4499: -------------------------------- Summary: Implement more versatile data type conversion in Hive JDBC ResultSet Key: HIVE-4499 URL: https://issues.apache.org/jira/browse/HIVE-4499 Project: Hive Issue Type: Improvement Components: JDBC Affects Versions: 0.10.0 Reporter: Lukas Eder
The Hive JDBC ResultSet cannot convert from Double to BigDecimal, as can be seen in this code extract here: {code} public BigDecimal getBigDecimal(int columnIndex) throws SQLException { Object obj = getObject(columnIndex); if (obj == null) { return null; } if (obj instanceof BigDecimal) { return ((BigDecimal) obj); } if (obj instanceof HiveDecimal) { return ((HiveDecimal) obj).bigDecimalValue(); } throw new SQLException("Cannot convert column " + columnIndex + " to BigDecimal. Found data of type: " + obj.getClass()+", value: " + obj.toString()); } {code} Taken from: https://github.com/apache/hive/blob/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveBaseResultSet.java#L107 This results in interoperability problems with other APIs, such as jOOQ, as can be seen in this issue here: https://github.com/jOOQ/jOOQ/issues/2442 It would be nice if Hive could implement more versatile data type conversions in its ResultSet (not just for Double/BigDecimal). Some inspiration could be taken from - Derby (http://db.apache.org/derby) - H2 (http://www.h2database.com) - HSQLDB (http://hsqldb.org) - jOOQ (http://www.jooq.org) All of the above implement ResultSets with lots of data type conversion capabilities. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira