drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-3566) Calling Connection.prepareStatement throws a ClassCastException
Date Thu, 03 Sep 2015 22:53:45 GMT

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

ASF GitHub Bot commented on DRILL-3566:
---------------------------------------

Github user adeneche commented on a diff in the pull request:

    https://github.com/apache/drill/pull/143#discussion_r38706036
  
    --- Diff: exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillResultSetImpl.java ---
    @@ -87,12 +88,12 @@
       boolean hasPendingCancelationNotification;
     
     
    -  DrillResultSetImpl(DrillStatementImpl statement, AvaticaPrepareResult prepareResult,
    +  DrillResultSetImpl(AvaticaStatement statement, AvaticaPrepareResult prepareResult,
                          ResultSetMetaData resultSetMetaData, TimeZone timeZone) {
         super(statement, prepareResult, resultSetMetaData, timeZone);
    -    this.statement = statement;
    +    connection = (DrillConnectionImpl) statement.getConnection();
         final int batchQueueThrottlingThreshold =
    -        this.getStatement().getConnection().getClient().getConfig().getInt(
    +        connection.getClient().getConfig().getInt(
    --- End diff --
    
    if you move the line `this.client = client;` before this line you should be able to reuse
`this.client` instead of calling `connection.getClient()`
    You can also reuse `this.connection` instead of creating another instance `c` below


> Calling Connection.prepareStatement throws a ClassCastException
> ---------------------------------------------------------------
>
>                 Key: DRILL-3566
>                 URL: https://issues.apache.org/jira/browse/DRILL-3566
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Client - JDBC
>            Reporter: Rahul Challapalli
>            Assignee: Deneche A. Hakim
>            Priority: Blocker
>             Fix For: 1.2.0
>
>
> Git Commit # : 65935db8d01b95a7a3107835d7cd5e61220e2f84
> I am hitting the below exception when using Connection.prepareStatement without binding
any parameters
> {code}
> PreparedStatement stmt = con.prepareStatement(DRILL_SAMPLE_QUERY);
> Exception in thread "main" java.lang.ClassCastException: org.apache.drill.jdbc.impl.DrillJdbc41Factory$DrillJdbc41PreparedStatement
cannot be cast to org.apache.drill.jdbc.impl.DrillStatementImpl
> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(DrillJdbc41Factory.java:106)
> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(DrillJdbc41Factory.java:1)
> at net.hydromatic.avatica.AvaticaConnection.executeQueryInternal(AvaticaConnection.java:397)
> at net.hydromatic.avatica.AvaticaPreparedStatement.executeQuery(AvaticaPreparedStatement.java:77)
> at com.incorta.trails.DrillTest.query(DrillTest.java:33)
> at com.incorta.trails.DrillTest.main(DrillTest.java:12)
> {code}



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

Mime
View raw message