Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-23601

Hive Statement Clear Statement Handle on Error

    XMLWordPrintableJSON

Details

    Description

        private void closeStatementIfNeeded() throws SQLException {
          try {
            if (stmtHandle != null) {
              TCloseOperationReq closeReq = new TCloseOperationReq(stmtHandle);
              TCloseOperationResp closeResp = client.CloseOperation(closeReq);
              Utils.verifySuccessWithInfo(closeResp.getStatus());
              stmtHandle = null;
            }
          } catch (SQLException e) {
            throw e;
          } catch (Exception e) {
            throw new SQLException("Failed to close statement", "08S01", e);
          }
        }
      
       void closeClientOperation() throws SQLException {
          closeStatementIfNeeded();
          isQueryClosed = true;
          stmtHandle = null;
        }
      

      verifySuccessWithInfo throws an Exception if it finds an error code and therefore leapfrogs over setting the statement handle to null (twice). Probably not what is intended since the original author(s) are tried twice to null it out.

      Attachments

        Issue Links

          Activity

            People

              belugabehr David Mollitor
              belugabehr David Mollitor
              Votes:
              0 Vote for this issue
              Watchers:
              1 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 - 0.5h
                  0.5h