Hi,
We are receiving the error \[Amazon](500310) Invalid operation: Assert using JDBC and prepared statements when we set a value to a field with type "bpchar" and the query has a GROUP BY.
Tested with several versions of Redshift JDBC driver, included latest 1.2.X version.
RedshiftJDBC42-no-awssdk-1.2.47.1071.jar
Reproduce
- Create next table
create table parameters_bug (
c_int integer,
c_bpchar bpchar);
- Execute next query from a JDBC client using parameters
select c_int
from parameters_bug
where c_bpchar = ?
group by c_int;
Query works fine if no parameter is used (i.e where c_bpchar = 'xx').
Also, query is working fine with redshift driver version 2.0.0
Returned exception
\[Amazon](500310) Invalid operation: Assert
Details:
error: Assert
code: 1000
context: IsSDDisabled(m_dispatch_level) || num_compute_segments == 1 - Query with multi-segment stream cannot be selective dispatched
query: 8737107
location: query.cpp:1905
process: padbmaster \[pid=3094]
-----------------------------------------------;, idconnection=895503322
java.sql.SQLException: \[Amazon](500310) Invalid operation: Assert
Details:
error: Assert
code: 1000
context: IsSDDisabled(m_dispatch_level) || num_compute_segments == 1 - Query with multi-segment stream cannot be selective dispatched
query: 8737107
location: query.cpp:1905
process: padbmaster \[pid=3094]
-----------------------------------------------;
at com.amazon.redshift.client.messages.inbound.ErrorResponse.toErrorException(Unknown Source) ~\[RedshiftJDBC42-no-awssdk-1.2.47.1071.jar:?]
at com.amazon.redshift.client.PGMessagingContext.handleErrorResponse(Unknown Source) ~\[RedshiftJDBC42-no-awssdk-1.2.47.1071.jar:?]
at com.amazon.redshift.client.PGMessagingContext.handleMessage(Unknown Source) ~\[RedshiftJDBC42-no-awssdk-1.2.47.1071.jar:?]
at com.amazon.jdbc.communications.InboundMessagesPipeline.getNextMessageOfClass(Unknown Source) ~\[RedshiftJDBC42-no-awssdk-1.2.47.1071.jar:?]
at com.amazon.redshift.client.PGMessagingContext.doMoveToNextClass(Unknown Source) ~\[RedshiftJDBC42-no-awssdk-1.2.47.1071.jar:?]
at com.amazon.redshift.client.PGMessagingContext.getErrorResponse(Unknown Source) ~\[RedshiftJDBC42-no-awssdk-1.2.47.1071.jar:?]
at com.amazon.redshift.client.PGClient.handleErrorsScenario2ForPrepareExecution(Unknown Source) ~\[RedshiftJDBC42-no-awssdk-1.2.47.1071.jar:?]
at com.amazon.redshift.client.PGClient.handleErrorsPrepareExecute(Unknown Source) ~\[RedshiftJDBC42-no-awssdk-1.2.47.1071.jar:?]
at com.amazon.redshift.dataengine.CallablePreparedOrAtomicExecuteTask.call(Unknown Source) ~\[RedshiftJDBC42-no-awssdk-1.2.47.1071.jar:?]
at com.amazon.redshift.dataengine.CallablePreparedOrAtomicExecuteTask.call(Unknown Source) ~\[RedshiftJDBC42-no-awssdk-1.2.47.1071.jar:?]
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) ~\[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java) ~\[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~\[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~\[?:?]
Caused by: com.amazon.support.exceptions.ErrorException: \[Amazon](500310) Invalid operation: Assert
Details:
error: Assert
code: 1000
context: IsSDDisabled(m_dispatch_level) || num_compute_segments == 1 - Query with multi-segment stream cannot be selective dispatched
query: 8737107
location: query.cpp:1905
process: padbmaster \[pid=3094]
Regards.
Edited by: scruz on Nov 9, 2020 6:57 AM
Edited by: scruz on Nov 9, 2020 7:00 AM
Edited by: scruz on Nov 9, 2020 7:01 AM