[ 
https://issues.apache.org/jira/browse/DRILL-3789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Khurram Faraaz closed DRILL-3789.
---------------------------------
    Resolution: Invalid

> Statement.cancel() does NOT CANCEL query.
> -----------------------------------------
>
>                 Key: DRILL-3789
>                 URL: https://issues.apache.org/jira/browse/DRILL-3789
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Client - JDBC
>    Affects Versions: 1.2.0
>         Environment: 4 node cluster CentOS
>            Reporter: Khurram Faraaz
>            Assignee: Daniel Barclay (Drill)
>
> Statement.cancel() does not leave the canceled query in CANCELED state in the 
> query profile on the Web UI, instead the query is marked as COMPLETED.
> Another observation is that the statement in not closed after it is canceled.
> {code}
> public class TestCancelStmt {
>     public static void main(String s[]) {
>         try {
>                 final String URL_STRING = 
> "jdbc:drill:schema=dfs.tmp;drillbit=10.10.101.301";
>                 Class.forName("org.apache.drill.jdbc.Driver").newInstance();
>                 Connection conn = 
> DriverManager.getConnection(URL_STRING,"","");
>                 Statement stmt = conn.createStatement();
>                 String query = "select * from FEWRWSPQQ_101";
>                 ResultSet rs = stmt.executeQuery(query);
>                 ResultSetMetaData rsmd = rs.getMetaData();
>                 while (rs.next()) {
>                     System.out.println(rs.getTimestamp("col5"));
>                     stmt.cancel();
>                     System.out.println("Statement.isClosed() : 
> "+stmt.isClosed());
>                 }
>                 if (rs != null)
>                     rs.close();
>                 stmt.close();
>                 conn.close();
>         } catch ( Exception e ) {
>             System.out.println(e.getMessage());
>             e.printStackTrace();
>         }
>     }
> }
> {code}
> From the log on the prompt, note that the query is marked as COMPLETED and 
> the statement is not closed, see isClosed() : false
> {code}
> 07:50:17.346 [Client-1] DEBUG o.a.d.e.rpc.user.QueryResultHandler - 
> resultArrived: queryState: COMPLETED, queryId = part1: 3028354939821241671
> part2: -4367740895230470400
> 07:50:17.346 [Client-1] DEBUG o.a.d.j.i.DrillResultSetImpl$ResultsListener - 
> [#1] Received query completion: COMPLETED.
> 07:50:17.347 [Client-1] DEBUG o.a.drill.exec.rpc.user.UserClient - Sending 
> response with Sender 475271556
> 2014-03-02 00:28:02.338
> 07:50:17.528 [main] DEBUG o.a.d.j.i.DrillResultSetImpl$ResultsListener - [#1] 
> Query listener closing.
> 07:50:17.529 [main] DEBUG o.a.d.j.i.DrillResultSetImpl$ResultsListener - [#1] 
> Query listener closing.
> Statement.isClosed() : false
> SQL statement execution canceled; ResultSet now closed.
> org.apache.drill.jdbc.ExecutionCanceledSqlException: SQL statement execution 
> canceled; ResultSet now closed.
>       at 
> org.apache.drill.jdbc.impl.DrillResultSetImpl.checkNotClosed(DrillResultSetImpl.java:118)
>       at 
> org.apache.drill.jdbc.impl.DrillResultSetImpl.next(DrillResultSetImpl.java:148)
>       at TestCancelStmt.main(TestCancelStmt.java:26)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to