aws / aws/amazon-redshift-jdbc-driver
Redshift driver 2.1.0.11 is not supporting batch operation using jooq
- Dominant language
- Java
- Stars
- 71
- Forks
- 42
- PR merge metrics
- No merged PRs in 30d
Description
## Driver version
2.1.0.11
## Client Operating System
ubuntu 20.04
## JAVA/JVM version
open jdk 11.0.18
## Problem description
Redshift driver is not supporting the batch operation with jooq(version 3.9.1) library..when trying to execute multiple statements at a time.
**Error message/stack trace:**
Exception in thread "main" java.sql.BatchUpdateException: Batch entry 1 was aborted: Too many update results were returned. Call getNextException to see other errors in the batch.
at com.amazon.redshift.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:167)
at com.amazon.redshift.jdbc.BatchResultHandler.handleCommandStatus(BatchResultHandler.java:108)
at com.amazon.redshift.core.ResultHandlerDelegate.handleCommandStatus(ResultHandlerDelegate.java:40)
at com.amazon.redshift.core.v3.QueryExecutorImpl$1.handleCommandStatus(QueryExecutorImpl.java:669)
at com.amazon.redshift.core.v3.QueryExecutorImpl.interpretCommandStatus(QueryExecutorImpl.java:2650)
at com.amazon.redshift.core.v3.QueryExecutorImpl.processResultsOnThread(QueryExecutorImpl.java:2150)
at com.amazon.redshift.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1874)
at com.amazon.redshift.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1866)
at com.amazon.redshift.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:593)
at com.amazon.redshift.jdbc.RedshiftStatementImpl.internalExecuteBatch(RedshiftStatementImpl.java:984)
at com.amazon.redshift.jdbc.RedshiftStatementImpl.executeBatch(RedshiftStatementImpl.java:1012)
at org.jooq.tools.jdbc.DefaultStatement.executeBatch(DefaultStatement.java:93)
at org.jooq.tools.jdbc.DefaultStatement.executeBatch(DefaultStatement.java:93)
at org.jooq.impl.BatchMultiple.execute(BatchMultiple.java:106)
at org.jooq.impl.BatchMultiple.execute(BatchMultiple.java:78)
at Main.main(Main.java:39)
Caused by: com.amazon.redshift.util.RedshiftException: Too many update results were returned.
... 15 more
## Reproduction code
String q = "insert into public.multi_test_Testtable values(111);insert into public.multi_test_Testatble values(222);";
DSLContext context = DSL.using(con, SQLDialect.REDSHIFT);
Query Q1 = context.query(q);
arrayList.add(Q1);
batch= context.batch(arrayList);
try {
result = batch.execute();
} catch (Throwable e) {
if(e.getCause() instanceof BatchUpdateException)
throw (BatchUpdateException)e.getCause();
}
Contributor guide
Research direction
Start at RedshiftStatementImpl.executeBatch and internalExecuteBatch, using the Main.main reproduction and the reported stack trace as entry points. Verify how multiple statements produce update results, then confirm that the jOOQ batch completes without the “Too many update results were returned” exception and returns appropriate batch results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100