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

Quirky handling of PrepareAndExecuteRequests maxRowCount attribute

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.5.0
    • None
    • avatica
    • None

    Description

      Another good find sent to me by cartershanklin.

      He noticed when using the Protobuf wire API directly, provided a value of 0 for maxRowCount in a PrepareAndExecuteRequest resulted in no values being returned.

      I dug around a little and found this little tweak done:

      AvaticaStatement.java
        protected void executeInternal(String sql) throws SQLException {
          // reset previous state before moving forward.
          this.updateCount = -1;
          try {
            // In JDBC, maxRowCount = 0 means no limit; in prepare it means LIMIT 0
            final long maxRowCount1 = maxRowCount <= 0 ? -1 : maxRowCount;
            for (int i = 0; i < connection.maxRetriesPerExecute; i++) {
              try {
                Meta.ExecuteResult x =
                    connection.prepareAndExecuteInternal(this, sql, maxRowCount1);
      

      It would be nice to also do this correction on the server side to get this behavior since our wire API so closely matches the JDBC API.

      Attachments

        Activity

          People

            elserj Josh Elser
            cartershanklin Carter Shanklin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: