[ 
https://issues.apache.org/jira/browse/OPTIQ-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14126098#comment-14126098
 ] 

Julian Hyde commented on OPTIQ-401:
-----------------------------------

[~ashutoshc] I've started work on this. It seems that we need to allow any 
piece of metadata to be null.

Quite a few pieces in the code are automatically unboxing -- see e.g. 
FilterRelBase.computeSelfCost -- and these will need to be changed to check for 
nulls, and return null if any of the values they need are null. I'll fix a few 
of these, but I won't catch all of them. You should submit a patch fixing any 
additional "holes" you find.

We won't need a new SqlExplainLevel. ALL_ATTRIBUTES will have the desired 
effect -- some of the costs will just come back "null".

Also, you will need run Hive without a "fallback" provider. 
ChainingMetadataProvider will move to the next provider, namely the default, 
which will just supply bad estimates.

> New SqlExplainLevel ALL_ATTRIBUTES_COST_IF_AVAILABLE
> ----------------------------------------------------
>
>                 Key: OPTIQ-401
>                 URL: https://issues.apache.org/jira/browse/OPTIQ-401
>             Project: Optiq
>          Issue Type: Improvement
>            Reporter: Ashutosh Chauhan
>            Assignee: Julian Hyde
>
> We want to use ALL_ATTRIBUTES because it prints cost, which is helpful in 
> debugging. But in certain systems (eg Hive) stats are fetched only on demand. 
> So, its possible that stats are not fetched and are thus not available for 
> few columns because they were not referred in query. Now, if you do 
> {{RelOptUtil.toString(optiqPlan, SqlExplainLevel.ALL_ATTRIBUTES)}} It results 
> in following stack trace:
> {code}
>         at com.sun.proxy.$Proxy18.getRowCount(Unknown Source)
>         at 
> org.eigenbase.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:95)
>         at org.eigenbase.rel.RelWriterImpl.explain_(RelWriterImpl.java:103)
>         at org.eigenbase.rel.RelWriterImpl.done(RelWriterImpl.java:171)
>         at org.eigenbase.rel.AbstractRelNode.explain(AbstractRelNode.java:280)
>         at org.eigenbase.relopt.RelOptUtil.toString(RelOptUtil.java:1694)
> Caused by: java.lang.AssertionError
>         at 
> org.eigenbase.rel.metadata.RelMetadataQuery.isNonNegative(RelMetadataQuery.java:381)
>         at 
> org.eigenbase.rel.metadata.RelMetadataQuery.validateResult(RelMetadataQuery.java:400)
>         at 
> org.eigenbase.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:96)
>         at 
> org.eigenbase.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:61)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to