Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-1546

Calling getParameterMetaData on prepared statement where TO_NUMBER is used throws NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      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:

      PreparedStatement stmt = conn.prepareStatement(
                      "UPSERT INTO " + ATABLE + " (organization_id, entity_id, a_integer) " +
                              "VALUES (?,?,TO_NUMBER(?))");
      
              ParameterMetaData parameterMetaData = stmt.getParameterMetaData();
      

      results in the following stack trace:

      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)
      
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            gabriel.reid Gabriel Reid
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: