【发布时间】:2020-04-02 09:10:16
【问题描述】:
如题,我想通过spring NamedParameterJbbcTemplate批量插入数据到hive表中,可以这样工作:
SqlParameterSource[] batchParameterSources = SqlParameterSourceUtils.createBatch(batchValues);
template.batchUpdate("insert into table(a, b, c) values(:a, :b, :c)", batchParameterSources);
但是,上面的sql不能分配分区,使用sql
"insert overwrite table partition(date = '2020-04-02') values (:a, :b, :c)"
spring 会抛出 SQLFeatureNotSupportException: Method not supported。
那么如何使用spring jdbc模板批量插入数据到具有特殊分区的hive表中呢?
期待您的回答, 非常感谢!
【问题讨论】:
-
我尝试使用
insert into table(a, b, c) partition(date = '2020-04-02') values (:a, :b, :c),还是不行。
标签: spring hive jdbctemplate partition batch-insert