Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4585

Improve error message from RelRunner

    XMLWordPrintableJSON

    Details

      Description

      When use prepareStatement parse and run RelNode error, the exception's error message is confusing.

      In particular, if you prepare the statement using RelRunner.prepare(RelNode) and prepare fails, the exception should report the RelNode plan. Currently it tries to report the SQL, and for this kind of query, there is no SQL.

      This code capture the exception,But Only the output of SQL exception is processed.So need to add the procedure to handle extra exception. 

      // 
      try {
        final Meta.Signature signature =
            parseQuery(query, createPrepareContext(), -1);
        final CalcitePreparedStatement calcitePreparedStatement =
            (CalcitePreparedStatement) factory.newPreparedStatement(this, null,
                signature, resultSetType, resultSetConcurrency, resultSetHoldability);
        server.getStatement(calcitePreparedStatement.handle).setSignature(signature);
        return calcitePreparedStatement;
      } catch (Exception e) {
        throw Helper.INSTANCE.createException(
            "Error while preparing statement [" + query.sql + "]", e);
      }
      
      

      When we run RelNode or  queryable show wrong,this exception can be:

      "Error while preparing statement [null]"

       can't log the real exception

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julianhyde Julian Hyde
                Reporter:
                nobigo duan xiong
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 50m
                  2h 50m