You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Dave Hacker (JIRA)" <ji...@apache.org> on 2015/01/01 00:45:13 UTC

[jira] [Commented] (PHOENIX-1546) Calling getParameterMetaData on prepared statement where TO_NUMBER is used throws NPE

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

Dave Hacker commented on PHOENIX-1546:
--------------------------------------

I was woking on this last week but haven't had a chance to get back to it.  I think I may have narrowed it down to a problem in the code path to  UpsertCompiler.visit().  We get to the UpsertCompiler.visit() for the bind variable in question but it is not a node for the upsert, it is a Function, so I'll have to dig around some more.  See https://github.com/dhacker1341/phoenix/compare/PHOENIX-1546

> Calling getParameterMetaData on prepared statement where TO_NUMBER is used throws NPE
> -------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-1546
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1546
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Gabriel Reid
>            Assignee: Dave Hacker
>
> There are some issues calling {{PhoenixPreparedStatement.getParameterMetaData}} on a prepared statement that uses function calls on its input parameters. 
> For example, the following test code:
> {code}
> PreparedStatement stmt = conn.prepareStatement(
>                 "UPSERT INTO " + ATABLE + " (organization_id, entity_id, a_integer) " +
>                         "VALUES (?,?,TO_NUMBER(?))");
>         ParameterMetaData parameterMetaData = stmt.getParameterMetaData();
> {code}
> results in the following stack trace:
> {code}
> java.lang.NullPointerException
> 	at org.apache.phoenix.parse.ToNumberParseNode.create(ToNumberParseNode.java:49)
> 	at org.apache.phoenix.parse.ToNumberParseNode.create(ToNumberParseNode.java:35)
> 	at org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:309)
> 	at org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:132)
> 	at org.apache.phoenix.parse.FunctionParseNode.accept(FunctionParseNode.java:83)
> 	at org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:726)
> 	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:479)
> 	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:470)
> 	at org.apache.phoenix.jdbc.PhoenixPreparedStatement.getParameterMetaData(PhoenixPreparedStatement.java:248)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)