Chinmay Kulkarni created PHOENIX-5982:
-----------------------------------------

             Summary: Overall query metrics not updated if rs.next is called 
just once
                 Key: PHOENIX-5982
                 URL: https://issues.apache.org/jira/browse/PHOENIX-5982
             Project: Phoenix
          Issue Type: Improvement
    Affects Versions: 4.15.0
            Reporter: Chinmay Kulkarni
             Fix For: 4.16.0


The generic method to issue queries is a variation of the following:

{code:java}
try (Connection conn = DriverManager.getConnection(url);
  Statement stmt = conn.createStatement()) {
    ResultSet rs = stmt.executeQuery("select * from t");
    while(rs.next()) {
        // do something
    }
}
{code}

However, a client that issues a point lookup may just call rs.next() without 
the while loop. In that case, overallQueryMetrics will not be updated due to 
the current logic (see 
[this|https://github.com/apache/phoenix/blob/dcc88af8acc2ba8df10d2e9d498ab3646fdf0a78/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixResultSet.java#L878-L881]).

In this case, it may be better to move this logic to PhoenixResultSet.close() 
which is a more obvious restriction we can impose on end-client behavior as 
opposed to a seemingly unnecessary while loop.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to