Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4784

Ensure Correlate#requiredColumns is subset of columns in left relation

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.28.0
    • core

    Description

      The Correlate expression has among others a field (requiredColumns for representing the set of columns that are used by the correlation.

      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;
        }
      

      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.

      Attachments

        Issue Links

          Activity

            People

              zabetak Stamatis Zampetakis
              zabetak Stamatis Zampetakis
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h