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

Julian Hyde commented on CALCITE-7608:
--------------------------------------

Given that there is a "COLLECT" aggregate function (differing from 
{{ARRAY_AGG}} in that it is standard, and produces a multiset rather than an 
array) I think that {{Uncollect}} was well-named.

It may be more appropriate to extend {{Uncollect}} (with appropriate defaults) 
rather than create a new operator with a very misleading name.

{quote}So this operator really is the missing piece to make the algebra 
complete. {quote}

I agree that this new operator is better than the old {{Uncollect}}, but I 
remain unconvinced that this is the perfect operator to complete the algebra.

> Introduce a SelectMany operator
> -------------------------------
>
>                 Key: CALCITE-7608
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7608
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.42.0
>            Reporter: Mihai Budiu
>            Assignee: Mihai Budiu
>            Priority: Minor
>              Labels: pull-request-available
>
> Today UNNEST is implemented using the Uncollect operator. We propose adding 
> an alternative LogicalSelectMany operator, which generalizes Uncollect. 
> (Notice that Enumerable API already has a SelectMany.) The main difference 
> between Uncollect and SelectMany is that Uncollect unnests all the fields of 
> its input relation, whereas LogicalSelectMany would only unnest SOME of the 
> fields of the input collection, preserving the other ones in each output row.
> This distinction is very important, because:
>  * LogicalSelectMany can be directly and efficiently implemented using the 
> Enumerable SelectMany
>  * UNNEST used in a cross-join is implemented using an Uncollect and a 
> LogicalCorrelate. However, the same UNNEST can be represented using just one 
> LogicalSelectMany node
>  * Neither the old nor the new decorrelator can actually eliminate 
> LogicalCorrelate nodes that are paired with Uncollect. Using 
> LogicalSelectMany we can decorrelate many more plans.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to