You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Khurram Faraaz (JIRA)" <ji...@apache.org> on 2016/06/16 17:06:05 UTC

[jira] [Closed] (DRILL-4718) call to ResultSet.getObject(int columnIndex) results in InvalidCursorStateSqlException

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

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

This one was due to a user error, it not an issue any more.

> call to ResultSet.getObject(int columnIndex) results in InvalidCursorStateSqlException
> --------------------------------------------------------------------------------------
>
>                 Key: DRILL-4718
>                 URL: https://issues.apache.org/jira/browse/DRILL-4718
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Client - JDBC
>    Affects Versions: 1.7.0
>         Environment: CentOS 6.8
>            Reporter: Khurram Faraaz
>
> The JDBC snippet below results in the exception on Drill 1.7.0
> Result set cursor is positioned before all rows.  Call next() first.
> org.apache.drill.jdbc.InvalidCursorStateSqlException: Result set cursor is positioned before all rows.  Call next() first.
> Drill git.commit.id=6286c0a
> JDBC Driver : drill-jdbc-all-1.7.0-SNAPSHOT.jar
> {noformat}
> try {
>                 final String URL_STRING = "jdbc:drill:schema=dfs.tmp;drillbit=<IP-ADDRESS>";
>                 Class.forName("org.apache.drill.jdbc.Driver").newInstance();
>                 Connection conn = DriverManager.getConnection(URL_STRING,"test","test");
>                 Statement stmt = conn.createStatement();
>                 String query = "select columns[0] from `t3.csv`";
>                 ResultSet rs = stmt.executeQuery(query);
>                 System.out.println("ResultSet.getObject(1) :"+rs.getObject(1));
>                 while (rs.next()) {
>                 }
>                 if (rs != null)
>                     rs.close();
>                 stmt.close();
>                 conn.close();
>         } catch ( Exception e ) {
>             System.out.println(e.getMessage());
>             e.printStackTrace();
>         }
> {noformat}
> data used in above query in t3.csv
> {noformat}
> abcd
> efgh
> ijkl
> mnop
> qrst
> {noformat}
> Here is the Exception
> {noformat}
> ...
> row_count: 5
> def {
>   record_count: 5
>   field {
>     major_type {
>       minor_type: VARCHAR
>       mode: OPTIONAL
>     }
>     name_part {
>       name: "EXPR$0"
>     }
>     child {
>       major_type {
>         minor_type: UINT1
>         mode: REQUIRED
>       }
>       name_part {
>         name: "$bits$"
>       }
>       value_count: 5
>       buffer_length: 5
>     }
>     child {
>       major_type {
>         minor_type: VARCHAR
>         mode: OPTIONAL
>       }
>       name_part {
>         name: "EXPR$0"
>       }
>       child {
>         major_type {
>           minor_type: UINT4
>           mode: REQUIRED
>         }
>         name_part {
>           name: "$offsets$"
>         }
>         value_count: 6
>         buffer_length: 24
>       }
>       value_count: 5
>       buffer_length: 44
>     }
>     value_count: 5
>     buffer_length: 49
>   }
>   carries_two_byte_selection_vector: false
> }
> , data=DrillBuf[14], udle: [9 131..180]].
> 08:37:17.483 [USER-rpc-event-queue] DEBUG o.a.d.e.rpc.user.QueryResultHandler - resultArrived: queryState: COMPLETED, queryId = 28a18f42-410f-bbc4-6445-0c95423ca341
> 08:37:17.484 [USER-rpc-event-queue] DEBUG o.a.d.j.i.DrillResultSetImpl$ResultsListener - [#1] Received query completion: COMPLETED.
> 08:37:17.485 [USER-rpc-event-queue] DEBUG o.a.drill.exec.rpc.user.UserClient - Sending response with Sender 1404764360
> Result set cursor is positioned before all rows.  Call next() first.
> org.apache.drill.jdbc.InvalidCursorStateSqlException: Result set cursor is positioned before all rows.  Call next() first.
> 	at org.apache.drill.jdbc.impl.AvaticaDrillSqlAccessor.getCurrentRecordNumber(AvaticaDrillSqlAccessor.java:73)
> 	at org.apache.drill.jdbc.impl.AvaticaDrillSqlAccessor.getObject(AvaticaDrillSqlAccessor.java:179)
> 	at net.hydromatic.avatica.AvaticaResultSet.getObject(AvaticaResultSet.java:351)
> 	at org.apache.drill.jdbc.impl.DrillResultSetImpl.getObject(DrillResultSetImpl.java:420)
> 	at GetTblName.main(GetTblName.java:28)
> {noformat}



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