Stamatis Zampetakis created CALCITE-4784: --------------------------------------------
Summary: 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 Fix For: 1.28.0 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)