phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marwa Saleh (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-5086) Prepare statement fails: Lost Bound parameter in TO_TIMESTAMP function
Date Thu, 03 Jan 2019 09:44:00 GMT

    [ https://issues.apache.org/jira/browse/PHOENIX-5086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16732815#comment-16732815
] 

Marwa Saleh commented on PHOENIX-5086:
--------------------------------------

[~karanmehta93]

Would this integration test be enough? If you try this out will give you the error above
{code:java}

public static void testBindParameterToTimestampFunction() throws SQLException {
 final String JDBC_PHOENIX = System.getProperty("PHOENIX_CONNECTION_URL",
 "jdbc:phoenix:thin:url=http://192.168.99.100:8765;serialization=PROTOBUF");
 final String createSQL =
 "CREATE TABLE IF NOT EXISTS TEST (ID VARCHAR PRIMARY KEY, DOC_MODIFY_DATE TIMESTAMP)";
 try (final Connection connection = DriverManager.getConnection(JDBC_PHOENIX)) {
 connection.createStatement().execute(createSQL);
 final String sql =
 "SELECT DOC_MODIFY_DATE FROM TEST where DOC_MODIFY_DATE >= TO_TIMESTAMP(?,'yyyy-MM-dd
HH:mm:ss.SSS' , 'UTC')";
 final PreparedStatement preparedStatement = connection.prepareStatement(sql);
 preparedStatement.setString(1, "2018-12-30 14:38:24.208");
 preparedStatement.executeQuery();
 }
}{code}

> Prepare statement fails: Lost Bound parameter in TO_TIMESTAMP function
> ----------------------------------------------------------------------
>
>                 Key: PHOENIX-5086
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-5086
>             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}
> SELECT "DOC_KEY" FROM XYZ WHERE  "DOC_MODIFY_DATE" >= TO_TIMESTAMP(?,'yyyy-MM-dd
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(Helper.java:54) 
>         at org.apache.calcite.avatica.Helper.createException(Helper.java:41) 
>         at org.apache.calcite.avatica.AvaticaConnection.executeQueryInternal(AvaticaConnection.java:520) 
>         at org.apache.calcite.avatica.AvaticaPreparedStatement.executeQuery(AvaticaPreparedStatement.java:133) {code}
>  
> Possible to be patched?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message