[ https://issues.apache.org/jira/browse/DRILL-6976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Anton Gozhiy closed DRILL-6976. ------------------------------- Verified with Drill 1.16.0-SNAPSHOT, commit bf1bdec6069f6fdd2132608450357edea47d328c. Checked as well the output of coalesce function. > SchemaChangeException happens when using split function in subquery if it > returns empty result. > ----------------------------------------------------------------------------------------------- > > Key: DRILL-6976 > URL: https://issues.apache.org/jira/browse/DRILL-6976 > Project: Apache Drill > Issue Type: Bug > Affects Versions: 1.15.0 > Reporter: Anton Gozhiy > Assignee: Bohdan Kazydub > Priority: Major > Fix For: 1.16.0 > > > *Query:* > {code:sql} > 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); > {code} > *Expected result:* > {noformat} > +---------+ > | EXPR$0 | > +---------+ > +---------+ > {noformat} > *Actual result:* > {noformat} > 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) > {noformat} > *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 > {code:sql} > cast(split(n_comment, ' ') [3] as varchar) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)