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

NPE from planner when using a table function with an invalid table

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.10.0
    • 1.12.0
    • None
    • None

    Description

      Create a CSV file, with headers and call it "data_3.csv."

      Set up a storage plugin config with headers, delimiter of ",". Call it "myws". Then read the file:

      SELECT * FROM `dfs.myws`.`data_3.csv`
      

      This query works.

      Try the same with a table function:

      SELECT * FROM table(dfs.myws.`data_3.csv` (type => 'text', fieldDelimiter => ',' , extractHeader => true))
      

      This also works.

      Now, let's use an incorrect name:

      SELECT * FROM `dfs.myws`.`data_33.csv`
      

      (Note the "33" in the name.)

      This produces an error to the client:

      Now the bug. Do the same thing with the table function:

      SELECT * FROM table(dfs.myws.`data_33.csv` (type => 'text', fieldDelimiter => ',' , extractHeader => true))
      

      This results in an NPE:

      org.apache.drill.common.exceptions.UserRemoteException: VALIDATION ERROR: null
      
      SQL Query null
      
      [Error Id: cf151c28-9879-4ecc-893a-78d85a11c2f4 on 10.250.50.74:31010]
      	at org.apache.drill.exec.rpc.user.QueryResultHandler.resultArrived(QueryResultHandler.java:123)
      ...
      
      Caused by: java.lang.NullPointerException: null
      	at org.apache.drill.exec.planner.logical.DrillTranslatableTable.getRowType(DrillTranslatableTable.java:49) ~[classes/:na]
      	at org.apache.calcite.sql.validate.ProcedureNamespace.validateImpl(ProcedureNamespace.java:68) ~[calcite-core-1.4.0-drill-r21.jar:1.4.0-drill-r21]
      	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:86) ~[calcite-core-1.4.0-drill-r21.jar:1.4.0-drill-r21]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:883) ~[calcite-core-1.4.0-drill-r21.jar:1.4.0-drill-r21]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:869) ~[calcite-core-1.4.0-drill-r21.jar:1.4.0-drill-r21]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:2806) ~[calcite-core-1.4.0-drill-r21.jar:1.4.0-drill-r21]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:2791) ~[calcite-core-1.4.0-drill-r21.jar:1.4.0-drill-r21]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3014) ~[calcite-core-1.4.0-drill-r21.jar:1.4.0-drill-r21]
      	at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60) ~[calcite-core-1.4.0-drill-r21.jar:1.4.0-drill-r21]
      	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:86) ~[calcite-core-1.4.0-drill-r21.jar:1.4.0-drill-r21]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:883) ~[calcite-core-1.4.0-drill-r21.jar:1.4.0-drill-r21]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:869) ~[calcite-core-1.4.0-drill-r21.jar:1.4.0-drill-r21]
      	at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:210) ~[calcite-core-1.4.0-drill-r21.jar:1.4.0-drill-r21]
      ...
      

      This bug causes much user confusion as the user cannot immediately tell that this is "user error" vs. something terribly wrong with Drill.

      Attachments

        Issue Links

          Activity

            People

              arina Arina Ielchiieva
              paul-rogers Paul Rogers
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: