You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2020/09/01 06:03:00 UTC

[jira] [Commented] (CALCITE-4203) RelMdUniqueKeys should not return empty when meeting Intersect and Minus if its input has unique keys

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

Julian Hyde commented on CALCITE-4203:
--------------------------------------

Review:
* Is there any benefit in delegating to {{getUniqueKeys((SetOp) r, mq, ignoreNulls)}}?
* In fact I think {{getUniqueKeys(SetOp, RelMetadataQuery, boolean)}} should be changed to {{getUniqueKeys(Union, RelMetadataQuery, boolean)}}
* Use {{LinkedHashSet}} or {{TreeSet}} rather than {{HashSet}}, for determinism.
* Add tests.
* Some comments would be nice. The unique keys of Minus are precisely the unique keys of its first input. Any unique key of any input of Intersect is a unique key of the Intersect.
* Are your methods consistent with {{RelMdColumnUniqueness}} for {{Intersect}} and {{Minus}}? 


> RelMdUniqueKeys should not return empty when meeting Intersect and Minus if its input has unique keys
> -----------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4203
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4203
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Chunwei Lei
>            Assignee: Chunwei Lei
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, we get an empty unique key for Intersect and Minus if its all is true. 
>  
> {code:java}
> // code placeholder
> public Set<ImmutableBitSet> getUniqueKeys(SetOp rel, RelMetadataQuery mq,
>     boolean ignoreNulls) {
>   if (!rel.all) {
>     return ImmutableSet.of(
>         ImmutableBitSet.range(rel.getRowType().getFieldCount()));
>   }
>   return ImmutableSet.of();
> }
> {code}
> However, from the semantic of Intersect and Minus, we can get their unique keys from its input even if its all is true. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)