phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karan Mehta (JIRA)" <>
Subject [jira] [Commented] (PHOENIX-5086) Prepare statement fails: Lost Bound parameter in TO_TIMESTAMP function
Date Fri, 11 Jan 2019 09:44:00 GMT


Karan Mehta commented on PHOENIX-5086:

I was able to reproduce this with all the branches, thanks for the integration test that you
added. This also appears to be a general Phoenix fat driver issue and not thin driver specifically.

Checkout the file Turns out that if getParameterMetaData is called
before the query is executed with bind values, it would work correctly. However once the values
are bind into the statement, it fails to determine the Metadata. 

I am not sure how to exactly fix this. Is this in Jdbc contract that the getParameterMetaData
should be idempodent? Is it allowed to call this method even after bind parameters have been
assigned values?
If yes, then the current behavior is correct. 
If no, we need to investigate further to understand the correct fix. A simple fix is to cache
the parameterMetaData values in PhoenixPreparedStatement and not compute it everytime. Other
approaches may involved correcting the way we parse our expression trees and fixing those.
The latter approach can be complicated and time consuming.

Let me know your thoughts.

> Prepare statement fails: Lost Bound parameter in TO_TIMESTAMP function
> ----------------------------------------------------------------------
>                 Key: PHOENIX-5086
>                 URL:
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 5.0.0
>            Reporter: Marwa Saleh
>            Priority: Critical
>              Labels: preparedstatements
> Please note the issue happens in case of SELECT and works fine in case of UPSERT. 
> Prepared Statement SQL: 
> {noformat}
HH:mm:ss.SSS','UTC'); {noformat}
> {code:java}
> preparedStatement.setString(1, "2018-12-30 14:38:24.208"); {code}
> {code:java}
> Stack trace: 
> Caused by: org.apache.calcite.avatica.AvaticaSqlException: Error -1 (00000) : Remote
driver error: RuntimeException: java.sql.SQLException: ERROR 2004 (INT05): Parameter value
unbound. Parameter at index 1 is unbound -> SQLException: ERROR 2004 (INT05): Parameter
value unbound. Parameter at index 1 is unbound 
>         at org.apache.calcite.avatica.Helper.createException( 
>         at org.apache.calcite.avatica.Helper.createException( 
>         at org.apache.calcite.avatica.AvaticaConnection.executeQueryInternal( 
>         at org.apache.calcite.avatica.AvaticaPreparedStatement.executeQuery( {code}
> Possible to be patched?

This message was sent by Atlassian JIRA

View raw message