[ 
https://issues.apache.org/jira/browse/CALCITE-4784?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stamatis Zampetakis resolved CALCITE-4784.
------------------------------------------
    Resolution: Fixed

Fixed in 
[8ddb3f82e997d1a10619fc37ff7900823c7c0b91|https://github.com/apache/calcite/commit/8ddb3f82e997d1a10619fc37ff7900823c7c0b91].

> Ensure Correlate#requiredColumns is subset of columns in left relation
> ----------------------------------------------------------------------
>
>                 Key: CALCITE-4784
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4784
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Stamatis Zampetakis
>            Assignee: Stamatis Zampetakis
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.28.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> The {{Correlate}} 
> [expression|https://github.com/apache/calcite/blob/f3baf348598fcc6bc4f97a0abee3f99309e5bf76/core/src/main/java/org/apache/calcite/rel/core/Correlate.java]
>  has among others a field ({{requiredColumns}} for representing the set of 
> columns that are used by the correlation.
> {code:java}
> public abstract class Correlate extends BiRel {
>   protected final CorrelationId correlationId;
>   protected final ImmutableBitSet requiredColumns;
>   protected final JoinRelType joinType;
>   /**
>    * Returns the required columns in left relation required for the 
> correlation
>    * in the right.
>    *
>    * @return columns in left relation required for the correlation in the 
> right
>    */
>   public ImmutableBitSet getRequiredColumns() {
>     return requiredColumns;
>   }
> {code}
> As the javadoc indicates (implicitly) these columns must be a subset of the 
> columns of the left relation. This is currently not enforced when creating a 
> correlation which can lead to invalid plans and runtime failures which are 
> hard to investigate.
> I propose to introduce an additional check inside {{Correlate#isValid}} 
> method for enforcing that required columns are valid.



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

Reply via email to