Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-6816

NPE - Concurrent query execution using PreparedStatement

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 1.14.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Concurrent query execution from JDBC program using PreparedStatement results in NPE.

      Queries that were executed concurrently are (part of a query file),

      select id from `test_tbl.json`
      select count(id) from `test_tbl.json`
      select count(*) from `test_tbl.json`
      select * from `test_tbl.json`
      

      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.

      Statement stmt = conn.createStatement();
      ResultSet rs = stmt.executeQuery(query);
      

      However, when the same queries listed above are executed using a PreparedStatement object we see an NPE

      PreparedStatement prdstmnt = conn.prepareStatement(query);
      prdstmnt.executeUpdate();
      

      Stack trace from drillbit.log

      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)
      

        Attachments

        1. test_tbl.json
          0.5 kB
          Khurram Faraaz

          Issue Links

            Activity

              People

              • Assignee:
                vitalii Vitalii Diravka
                Reporter:
                khfaraaz Khurram Faraaz
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: