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

Limit 0 raises NullPointerException on JDBC storage sources

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.0, 1.9.0, 1.10.0, 1.11.0, 1.12.0
    • Fix Version/s: 1.15.0
    • Labels:
      None
    • Environment:

      Latest 1.9 release also 1.8 release version,
      mysql-connector-java-5.1.30, mysql-connector-java-5.1.40

      Description

      NullPointerExceptions occur when a query with 'limit 0' is executed on a jdbc storage source (e.g. Mysql):

      0: jdbc:drill:zk=local> select * from mysql.sugarcrm.sales_person limit 0;
      Error: SYSTEM ERROR: NullPointerException
      
      
      [Error Id: 6cd676fc-6db9-40b3-81d5-c2db044aeb77 on localhost:31010]
      
        (org.apache.drill.exec.work.foreman.ForemanException) Unexpected exception during fragment initialization: null
          org.apache.drill.exec.work.foreman.Foreman.run():281
          java.util.concurrent.ThreadPoolExecutor.runWorker():1142
          java.util.concurrent.ThreadPoolExecutor$Worker.run():617
          java.lang.Thread.run():745
        Caused By (java.lang.NullPointerException) null
          org.apache.drill.exec.planner.sql.handlers.FindHardDistributionScans.visit():55
          org.apache.calcite.rel.core.TableScan.accept():166
          org.apache.calcite.rel.RelShuttleImpl.visitChild():53
          org.apache.calcite.rel.RelShuttleImpl.visitChildren():68
          org.apache.calcite.rel.RelShuttleImpl.visit():126
          org.apache.calcite.rel.AbstractRelNode.accept():256
          org.apache.calcite.rel.RelShuttleImpl.visitChild():53
          org.apache.calcite.rel.RelShuttleImpl.visitChildren():68
          org.apache.calcite.rel.RelShuttleImpl.visit():126
          org.apache.calcite.rel.AbstractRelNode.accept():256
          org.apache.drill.exec.planner.sql.handlers.FindHardDistributionScans.canForceSingleMode():45
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToDrel():262
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToDrel():290
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan():168
          org.apache.drill.exec.planner.sql.DrillSqlWorker.getPhysicalPlan():123
          org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan():97
          org.apache.drill.exec.work.foreman.Foreman.runSQL():1008
          org.apache.drill.exec.work.foreman.Foreman.run():264
          java.util.concurrent.ThreadPoolExecutor.runWorker():1142
          java.util.concurrent.ThreadPoolExecutor$Worker.run():617
          java.lang.Thread.run():745 (state=,code=0)
      0: jdbc:drill:zk=local> select * from mysql.sugarcrm.sales_person limit 1;
      +-----+-------------+----------------+------------+-------------+
      | id  | first_name  |   last_name    | full_name  | manager_id  |
      +-----+-------------+----------------+------------+-------------+
      | 1   | null        | Administrator  | admin      | 0           |
      +-----+-------------+----------------+------------+-------------+
      1 row selected (0,235 seconds)
      

      Other datasources are okay:

      0: jdbc:drill:zk=local> SELECT * FROM cp.`employee.json` LIMIT 0;
      +------+-----------+-----------+---------+--------------+------------+-------------+------------+--------------+-----------------+-----------+----------------+-------------+------------+---------+----------------+------------------+-----------------+---------+------------------+
      | fqn  | filename  | filepath  | suffix  | employee_id  | full_name  | first_name  | last_name  | position_id  | position_title  | store_id  | department_id  | birth_date  | hire_date  | salary  | supervisor_id  | education_level  | marital_status  | gender  | management_role  |
      +------+-----------+-----------+---------+--------------+------------+-------------+------------+--------------+-----------------+-----------+----------------+-------------+------------+---------+----------------+------------------+-----------------+---------+------------------+
      +------+-----------+-----------+---------+--------------+------------+-------------+------------+--------------+-----------------+-----------+----------------+-------------+------------+---------+----------------+------------------+-----------------+---------+------------------+
      No rows selected (0,309 seconds)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vitalii Vitalii Diravka
                Reporter:
                korlawulki Holger Kiel
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: