Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-3766

ResultSet.getRow() returns incorrect row number of current row

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: Client - JDBC
    • Labels:
      None

      Description

      getRow() function returns incorrect row number for current row. It returns one less than the actual row number. The first row should be row number 1 and second row is row number 2 and so on as per javadoc for getRow()

                      String query = "select * from FEWRWSPQQ_101";
                      
                      ResultSet rs = stmt.executeQuery(query);
                      ResultSetMetaData rsmd = rs.getMetaData();
      
                      while (rs.next()) {
                            System.out.println(" row Number :"+rs.getRow());
                      }
      

      Output of call to getRow() in the while loop.

      row Number :0
       row Number :1
       row Number :2
       row Number :3
       row Number :4
       row Number :5
       row Number :6
       row Number :7
       row Number :8
       row Number :9
       row Number :10
       row Number :11
       row Number :12
       row Number :13
       row Number :14
       row Number :15
       row Number :16
       row Number :17
       row Number :18
       row Number :19
       row Number :20
       row Number :21
      

      Table has twenty two rows in it.

      0: jdbc:drill:schema=dfs.tmp> select count(*) from FEWRWSPQQ_101;
      +---------+
      | EXPR$0  |
      +---------+
      | 22      |
      +---------+
      1 row selected (0.266 seconds)
      

      From javadoc

      int getRow()
                 throws SQLException
      Retrieves the current row number. The first row is number 1, the second number 2, and so on.
      Note:Support for the getRow method is optional for ResultSets with a result set type of TYPE_FORWARD_ONLY
      
      Returns:
      the current row number; 0 if there is no current row
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dsbos Daniel Barclay
                Reporter:
                khfaraaz Khurram Faraaz
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: