gpt4 book ai didi

java - 不支持 Hive 方法

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:16:04 26 4
gpt4 key购买 nike

我正在尝试使用 Hive 作为底层数据存储运行 SQl 查询,该查询调用 Big Decimal 函数并抛出以下错误:

方法不支持

org.apache.hadoop.hive.jdbc.HivePreparedStatement.setBigDecimal(HivePreparedStatement.java:317) 

那是因为 Hive 不支持如下:

public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
// TODO Auto-generated method stub
throw new SQLException("Method not supported");
}

请提出可以解决此类问题的其他解决方法或修复方法

最佳答案

原始的 Hive JDBC 驱动程序仅支持少数 JDBC 接口(interface),请参阅 HIVE-48: Support JDBC connections for interoperability between Hive and RDBMS .所以 commitCallableStatement 等接口(interface)留下自动生成的“不支持”代码或 PreparedStatement .

HIVE-2158: add the HivePreparedStatement implementation based on current HIVE supported data-type一些方法被充实了,参见 commit .但是没有添加像 Blob、AsciiStream、二进制流和... bigDecimal 这样的类型。当解决了 HIVE-2158 ( 2011-06-15 ) 时,Hive 中对 DECIMAL 的支持不存在,它带有 HIVE-2693: Add DECIMAL data type。 , 于 2013-01-17。添加对 DECIMAL 的支持时,看起来 JDBC 驱动程序接口(interface)未更新。

因此,基本上 JDBC 驱动程序需要使用支持的新类型进行更新。您应该提交 JIRA为了这。解决方法:不要使用 DECIMAL,或者不要使用 PrepareStatement。

关于java - 不支持 Hive 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20212021/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com