[
https://issues.apache.org/jira/browse/DRILL-6891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16715893#comment-16715893
]
Paul Rogers commented on DRILL-6891:
------------------------------------
IMHO, in general it makes sense to implicitly cast required types to optional.
It may even make sense to allow casting optional types to required if we don't
mind a per-value check and failing the query if the value turns out to be null.
(JSON files, for example, produce optional types even for things like an id
which might always occur.)
> Drill cannot cast required type to optional and vise versa that may cause
> failures of functions with more than one argument.
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: DRILL-6891
> URL: https://issues.apache.org/jira/browse/DRILL-6891
> Project: Apache Drill
> Issue Type: Bug
> Components: Functions - Drill
> Affects Versions: 1.14.0
> Reporter: Anton Gozhiy
> Priority: Major
> Labels: SchemaChangeException
> Fix For: Future
>
>
> *Query:*
> {code:sql}
> with t (pkey, lnum) as
> (select l_partkey,
> case when l_linenumber < 3 then null else l_linenumber end
> from cp.`tpch/lineitem.parquet`)
> select covar_samp(pkey, lnum) from t limit 5
> {code}
> *Note:* Case statement is needed to transform required data mod to optional.
> *Expected result:*
> The function should return result.
> *Actual result:*
> Exception happens: Missing function implementation:
> [covar_samp(INT-REQUIRED, INT-OPTIONAL)]
> {noformat}
> SYSTEM ERROR: Drill Remote Exception
> Please, refer to logs for more information.
> (org.apache.drill.exec.exception.SchemaChangeException) Failure while
> materializing expression.
> Error in expression at index -1. Error: Missing function implementation:
> [covar_samp(INT-REQUIRED, INT-OPTIONAL)]. Full expression: --UNKNOWN
> EXPRESSION--.
>
> org.apache.drill.exec.physical.impl.aggregate.StreamingAggBatch.createAggregatorInternal():513
>
> org.apache.drill.exec.physical.impl.aggregate.StreamingAggBatch.createAggregator():434
>
> org.apache.drill.exec.physical.impl.aggregate.StreamingAggBatch.buildSchema():181
> org.apache.drill.exec.record.AbstractRecordBatch.next():161
> org.apache.drill.exec.record.AbstractRecordBatch.next():126
> org.apache.drill.exec.record.AbstractRecordBatch.next():116
> org.apache.drill.exec.record.AbstractUnaryRecordBatch.innerNext():63
> org.apache.drill.exec.physical.impl.limit.LimitRecordBatch.innerNext():101
> org.apache.drill.exec.record.AbstractRecordBatch.next():186
> org.apache.drill.exec.record.AbstractRecordBatch.next():126
> org.apache.drill.exec.record.AbstractRecordBatch.next():116
> org.apache.drill.exec.record.AbstractUnaryRecordBatch.innerNext():63
> org.apache.drill.exec.record.AbstractRecordBatch.next():186
> org.apache.drill.exec.record.AbstractRecordBatch.next():126
> org.apache.drill.exec.record.AbstractRecordBatch.next():116
> org.apache.drill.exec.record.AbstractUnaryRecordBatch.innerNext():63
>
> 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
> .......():0
> org.apache.hadoop.security.UserGroupInformation.doAs():1669
> org.apache.drill.exec.work.fragment.FragmentExecutor.run():284
> org.apache.drill.common.SelfCleaningRunnable.run():38
> .......():0
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)