[
https://issues.apache.org/jira/browse/CALCITE-7628?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated CALCITE-7628:
------------------------------------
Labels: pull-request-available (was: )
> Interpreter gives wrong result for query with MINUS or INTERSECT with 3 or
> more inputs
> --------------------------------------------------------------------------------------
>
> Key: CALCITE-7628
> URL: https://issues.apache.org/jira/browse/CALCITE-7628
> Project: Calcite
> Issue Type: Bug
> Reporter: Julian Hyde
> Priority: Major
> Labels: pull-request-available
>
> A {{MINUS}} (or {{INTERSECT}}, {{UNION}}) with three or more inputs returns
> the wrong result in the interpreter. For example, evaluated via the
> interpreter:
> {code:sql}
> VALUES 1, 2, 3 EXCEPT VALUES 3, 4, 5 EXCEPT VALUES 4, 5, 1;
> {code}
> returns {{[1], [2]}} but should return {{[2]}}.
> The cause is that {{SetOpNode}} reads only the first two inputs
> ({{compiler.source(setOp, 0)}} and {{compiler.source(setOp, 1)}}); inputs at
> index 2 and beyond are silently dropped. It should fold the operation across
> all of {{setOp.getInputs()}}.
> Only the interpreter (BindableConvention) is affected; {{EnumerableMinus}} is
> correct. Note that {{A EXCEPT B EXCEPT C}} is converted to a left-deep tree
> of two-input nodes, so this only surfaces once the merge rules collapse it
> into a single n-ary {{SetOp}} (as they do in bindable mode).
> Reported via [Morel #402|https://github.com/hydromatic/morel/issues/402].
--
This message was sent by Atlassian Jira
(v8.20.10#820010)