[
https://issues.apache.org/jira/browse/CALCITE-4203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17188703#comment-17188703
]
Julian Hyde commented on CALCITE-4203:
--------------------------------------
{quote}> Is there any benefit in delegating to getUniqueKeys((SetOp) r, mq,
ignoreNulls)?
For reusing the code.
{quote}
I don't think it's helpful. The Union case is very different to the others, so
when you call into it you make the semantics much less clear. Note that
RelMdColumnUniqueness does not reuse code in this way, nor should it.
{quote}I don't do this in case it may break the downstream project if it has a
subclass of SetOp except Minus and Intersect.
{quote}
That is not supported behavior. If they've done it, we should break them.
> 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: 20m
> 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)