[Amazon](500310) Invalid operation when setting parameter to bpchar (JDBC)

0

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

  1. Create next table
    create table parameters_bug (
    c_int integer,
    c_bpchar bpchar);
  2. 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)
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)
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)
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

scruz
gefragt vor 3 Jahren1756 Aufrufe
4 Antworten
0

Are you still having this issue? If so, please provide a minimal code example or script that we can use to reproduce the problem.

You can send me a direct message with this if needed.

beantwortet vor 3 Jahren
0

Hi, you have the steps on my previous message:

Reproduce

  1. Create next table
    create table parameters_bug (
    c_int integer,
    c_bpchar bpchar);
  2. 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').

The error happens executing that query with PreparedStatement, setting a value like 'xx' (setObject(1, "xx") ) . No more special steps.

scruz
beantwortet vor 3 Jahren
0

I am also facing the same issue. It happens for any query with GROUP BY + JDBC Prepared Statements.

A very simple repro case is:

TABLE: CREATE TABLE x (i INT);
QUERY: SELECT i FROM x GROUP BY i WHERE i = ?;

The query needs to be run via a JDBC client using PreparedStatement.

hashhar
beantwortet vor 3 Jahren
0

I reproduce the issue using latest JDBC driver (2.0.0.3). Using 2.0.0.0 the query works fine.

bcouce
beantwortet vor 3 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen