You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Volodymyr Vysotskyi (JIRA)" <ji...@apache.org> on 2018/11/06 20:26:00 UTC

[jira] [Comment Edited] (DRILL-6816) NPE - Concurrent query execution using PreparedStatement

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

Volodymyr Vysotskyi edited comment on DRILL-6816 at 11/6/18 8:25 PM:
---------------------------------------------------------------------

According to the Javadoc of {{PreparedStatement.executeUpdate()}}, the error should be thrown for this case:
{quote} * @exception SQLException if a database access error occurs;
 * this method is called on a closed <code>PreparedStatement</code>
 * *or the SQL statement returns a <code>ResultSet</code> object*{quote}

Also, in the same Javadoc was pointed, in which cases this method should be used:
{quote}
    /**
     * Executes the SQL statement in this <code>PreparedStatement</code> object,
     * which must be an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or
     * <code>DELETE</code>; or an SQL statement that returns nothing,
     * such as a DDL statement.
{quote}



was (Author: vvysotskyi):
According to the Javadoc of {{PreparedStatement.executeUpdate()}}, the error should be thrown for this case:
{quote} * @exception SQLException if a database access error occurs;
 * this method is called on a closed <code>PreparedStatement</code>
 * *or the SQL statement returns a <code>ResultSet</code> object*{quote}


> NPE - Concurrent query execution using PreparedStatement 
> ---------------------------------------------------------
>
>                 Key: DRILL-6816
>                 URL: https://issues.apache.org/jira/browse/DRILL-6816
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.14.0
>            Reporter: Khurram Faraaz
>            Priority: Major
>         Attachments: test_tbl.json
>
>
> Concurrent query execution from JDBC program using PreparedStatement results in NPE.
> Queries that were executed concurrently are (part of a query file),
> {noformat}
> select id from `test_tbl.json`
> select count(id) from `test_tbl.json`
> select count(*) from `test_tbl.json`
> select * from `test_tbl.json`
> {noformat}
> Drill 1.14.0
>  git.commit.id=35a1ae23c9b280b9e73cb0f6f01808c996515454
>  MapR version => 6.1.0.20180911143226.GA (secure cluster)
> JDBC driver used was org.apache.drill.jdbc.Driver
> Executing the above queries concurrently using a Statement object results in successful query execution.
> {noformat}
> Statement stmt = conn.createStatement();
> ResultSet rs = stmt.executeQuery(query);
> {noformat}
> However, when the same queries listed above are executed using a PreparedStatement object we see an NPE
> {noformat}
> PreparedStatement prdstmnt = conn.prepareStatement(query);
> prdstmnt.executeUpdate();
> {noformat}
> Stack trace from drillbit.log
> {noformat}
> 17:04:32.941 [pool-1-thread-3] DEBUG o.a.d.j.impl.DrillStatementRegistry - Adding to open-statements registry: org.apache.drill.jdbc.impl.DrillJdbc41Factory$DrillJdbc41PreparedStatement@35757005
> 17:04:32.941 [pool-1-thread-2] DEBUG o.a.d.j.impl.DrillStatementRegistry - Adding to open-statements registry: org.apache.drill.jdbc.impl.DrillJdbc41Factory$DrillJdbc41PreparedStatement@d4413b8
> 17:04:32.956 [pool-1-thread-1] DEBUG o.a.d.j.impl.DrillStatementRegistry - Adding to open-statements registry: org.apache.drill.jdbc.impl.DrillJdbc41Factory$DrillJdbc41PreparedStatement@5eb3b9ab
> 17:04:32.956 [pool-1-thread-4] DEBUG o.a.d.j.impl.DrillStatementRegistry - Adding to open-statements registry: org.apache.drill.jdbc.impl.DrillJdbc41Factory$DrillJdbc41PreparedStatement@d9367d0
> java.lang.NullPointerException
>  at java.util.Objects.requireNonNull(Objects.java:203)
>  at org.apache.calcite.avatica.Meta$MetaResultSet.create(Meta.java:577)
>  at org.apache.drill.jdbc.impl.DrillMetaImpl.execute(DrillMetaImpl.java:1143)
>  at org.apache.drill.jdbc.impl.DrillMetaImpl.execute(DrillMetaImpl.java:1150)
>  at org.apache.calcite.avatica.AvaticaConnection.executeQueryInternal(AvaticaConnection.java:511)
>  at org.apache.calcite.avatica.AvaticaPreparedStatement.executeLargeUpdate(AvaticaPreparedStatement.java:146)
>  at org.apache.drill.jdbc.impl.DrillPreparedStatementImpl.executeLargeUpdate(DrillPreparedStatementImpl.java:512)
>  at org.apache.calcite.avatica.AvaticaPreparedStatement.executeUpdate(AvaticaPreparedStatement.java:142)
>  at RunQuery.executeQuery(RunQuery.java:61)
>  at RunQuery.run(RunQuery.java:30)
>  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>  at java.lang.Thread.run(Thread.java:748)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)