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

SchemaChangeException happens when using split function in subquery if it returns empty result.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.15.0
    • 1.16.0
    • None
    • None

    Description

      Query:

      select substr(col, 2, 3) 
      from (select split(n_comment, ' ') [3] col 
            from cp.`tpch/nation.parquet` 
            where n_nationkey = -1 
            group by n_comment 
            order by n_comment 
            limit 5);
      

      Expected result:

      +---------+
      | EXPR$0  |
      +---------+
      +---------+
      

      Actual result:

      Error: SYSTEM ERROR: SchemaChangeException: Failure while trying to materialize incoming schema.  Errors:
       
      Error in expression at index -1.  Error: Missing function implementation: [castVARCHAR(NULL-OPTIONAL, BIGINT-REQUIRED)].  Full expression: --UNKNOWN EXPRESSION--..
      
      Fragment 0:0
      
      Please, refer to logs for more information.
      
      [Error Id: 86515d74-7b9c-4949-8ece-c9c17e00afc3 on userf87d-pc:31010]
      
        (org.apache.drill.exec.exception.SchemaChangeException) Failure while trying to materialize incoming schema.  Errors:
       
      Error in expression at index -1.  Error: Missing function implementation: [castVARCHAR(NULL-OPTIONAL, BIGINT-REQUIRED)].  Full expression: --UNKNOWN EXPRESSION--..
          org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.setupNewSchemaFromInput():498
          org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.setupNewSchema():583
          org.apache.drill.exec.record.AbstractUnaryRecordBatch.innerNext():101
          org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext():143
          org.apache.drill.exec.record.AbstractRecordBatch.next():186
          org.apache.drill.exec.physical.impl.BaseRootExec.next():104
          org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext():83
          org.apache.drill.exec.physical.impl.BaseRootExec.next():94
          org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():297
          org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():284
          java.security.AccessController.doPrivileged():-2
          javax.security.auth.Subject.doAs():422
          org.apache.hadoop.security.UserGroupInformation.doAs():1746
          org.apache.drill.exec.work.fragment.FragmentExecutor.run():284
          org.apache.drill.common.SelfCleaningRunnable.run():38
          java.util.concurrent.ThreadPoolExecutor.runWorker():1149
          java.util.concurrent.ThreadPoolExecutor$Worker.run():624
          java.lang.Thread.run():748 (state=,code=0)
      

      Note: Filter "where n_nationkey = -1" doesn't return any rows. In case of " = 1", for example, the query will return result without error.

      Workaround: Use cast on the split function, like

      cast(split(n_comment, ' ') [3] as varchar)
      

      Attachments

        Issue Links

          Activity

            People

              bohdan Bohdan Kazydub
              angozhiy Anton Gozhiy
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: