You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/01/28 22:45:00 UTC

[jira] [Commented] (PHOENIX-6634) PhoenixResultSet.next method closes the result set if the scanner returns null

    [ https://issues.apache.org/jira/browse/PHOENIX-6634?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17484000#comment-17484000 ] 

ASF GitHub Bot commented on PHOENIX-6634:
-----------------------------------------

yanxinyi opened a new pull request #1377:
URL: https://github.com/apache/phoenix/pull/1377


   …e scanner returns null


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> PhoenixResultSet.next method closes the result set if the scanner returns null
> ------------------------------------------------------------------------------
>
>                 Key: PHOENIX-6634
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6634
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.16.1
>            Reporter: Xinyi Yan
>            Assignee: Xinyi Yan
>            Priority: Major
>             Fix For: 4.17.0, 4.16.2
>
>
>  
> {code:java}
> public void test() throws Exception {
>     String query = "SELECT a_string FROM " + tableName + " WHERE organization_id=? LIMIT 1";
>     Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
>     try(Connection conn = DriverManager.getConnection(getUrl(), props)) {
>         PreparedStatement statement = conn.prepareStatement(query);
>         statement.setString(1, tenantId);
>         ResultSet rs = statement.executeQuery();
>         while (rs.next()) {
>         }
>         assertFalse(rs.next()); // exception happens here
>     }
> } {code}
>  
>  
> {code:java}
> java.sql.SQLException: ERROR 1101 (XCL01): ResultSet is closed.    at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:615)
>     at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:217)
>     at org.apache.phoenix.jdbc.PhoenixResultSet.checkOpen(PhoenixResultSet.java:288)
>     at org.apache.phoenix.jdbc.PhoenixResultSet.next(PhoenixResultSet.java:847)
>     at org.apache.phoenix.end2end.QueryIT.test(QueryIT.java:184)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method){code}
> Need to remove the unnecessary close inside the next method. 
>  
> https://github.com/apache/phoenix/blob/4.x/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixResultSet.java#L855



--
This message was sent by Atlassian Jira
(v8.20.1#820001)