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

SQL queries after first query in same statement have no results returned

    XMLWordPrintableJSON

Details

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

    Description

      When integrate avatica with calcite, when using same statement, except for the first sql query, other sql queries have no result to return.

      The following example

      private static void testMultiQueryWithSameStatement(Connection connection) throws Exception {
      // get avatica remote connection
      Connection connection = getRemoteConnection();
      String sql = "select * from mysql.jobs";
      ResultSet rs;
      Statement st;
      st = connection.createStatement();
      System.out.println("============================first query=====================================");
      rs = st.executeQuery(sql);
      ResultSetMetaData rsmd = rs.getMetaData();
      int columnNum = rsmd.getColumnCount();
      for (int i = 1; i <= columnNum; i++) {
      System.out.print(rsmd.getColumnName(i) + "\t");
      }
      System.out.println();
      while (rs.next()) {
      for (int i = 1; i <= columnNum; i++) {
      System.out.print(rs.getString(i) + "\t");
      }
      System.out.println();
      }
      
      System.out.println("============================second query=====================================");
      rs = st.executeQuery(sql);
      
      while (rs.next()) {
      for (int i = 1; i <= columnNum; i++) {
      System.out.print(rs.getString(i) + "\t");
      }
      System.out.println();
      }
      }
      
      

      The result would be like this. The first query has result while the second query has no result returned.

      ============================first query=====================================
      id name
      1 abc
      ============================second query=====================================
      
      

      What's more, use avatica alone and don't integrate with calcite, then query sql twice will return normal results.

      Attachments

        Issue Links

          Activity

            People

              xleesf leesf
              xleesf leesf
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

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