我试图使用Hive作为基础数据存储来运行SQl查询,查询调用Big Decimal函数并引发以下错误:
方法不支持
org.apache.hadoop.hive.jdbc.HivePreparedStatement.setBigDecimal(HivePreparedStatement.java:317) code>这仅仅是因为Hive不支持如下:
public void setBigDecimal(int parameterIndex,BigDecimal x)throws SQLException { // TODO自动生成的方法存根抛出新的SQLException(Method not supported); }请提出其他解决方法或修补程序可用于解决此类问题
原文Hive JDBC驱动程序仅支持少数JDBC接口,请参阅 / jira / browse / HIVE-48rel =nofollow> HIVE-48:支持JDBC连接以实现Hive和RDBMS之间的互操作性。因此,提交会留下自动生成的不支持代码,用于像 CallableStatement 或 PreparedStatement 。使用 HIVE-2158:add基于当前HIVE支持的数据类型的HivePreparedStatement实现部分方法已经充实,请参阅提交。但是没有添加像Blob,AsciiStream,二进制流和... bigDecimal这样的类型。当HIVE-2158得到解决时( 2011-06-15 )在蜂巢中对DECIMAL的支持不在,它附带 HIVE-2693:添加DECIMAL数据类型,于2013-01-17 。在添加对DECIMAL的支持时,看起来像JDBC驱动程序接口未更新。
因此,基本上JDBC驱动程序需要使用支持的新类型进行更新。您应该为此提交 JIRA 。解决方法:不要使用DECIMAL,也不要使用PrepareStatement。
I am trying to run a SQl query using Hive as an underlying data store, the query invokes Big Decimal function and throws the following error :
Method not supported at
org.apache.hadoop.hive.jdbc.HivePreparedStatement.setBigDecimal(HivePreparedStatement.java:317)That is simply because Hive does not support as follows :
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Method not supported"); }Please suggest what can be other workarounds or fixes available to counter such an issue
解决方案The original Hive JDBC driver only supported few of the JDBC interfaces, see HIVE-48: Support JDBC connections for interoperability between Hive and RDBMS. So the commit left auto-generated "not supported" code for interfaces like CallableStatement or PreparedStatement.
With HIVE-2158: add the HivePreparedStatement implementation based on current HIVE supported data-type some of the methods were fleshed out, see the commit. But types like Blob, AsciiStream, binary stream and ... bigDecimal were not added. When HIVE-2158 was resolved (2011-06-15) the support for DECIMAL in Hive was not in, it came with HIVE-2693: Add DECIMAL data type, on 2013-01-17. When support for DECIMAL was added, looks like the JDBC driver interface was not updated.
So basically the JDBC driver needs to be updated with the new types supported. You should file a JIRA for this. Workaround: don't use DECIMAL, or don't use PrepareStatement.
更多推荐
不支持Hive方法
发布评论