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

Remove redundant rowtype check in RelSubset#add

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.34.0
    • core

    Description

      void add(RelNode rel) {
        if (set.rels.contains(rel)) {
          return;
        }
      
        VolcanoPlanner planner = (VolcanoPlanner) rel.getCluster().getPlanner();
        if (planner.getListener() != null) {
          RelOptListener.RelEquivalenceEvent event =
              new RelOptListener.RelEquivalenceEvent(
                  planner,
                  rel,
                  this,
                  true);
          planner.getListener().relEquivalenceFound(event);
        }
      
        // If this isn't the first rel in the set, it must have compatible
        // row type.
        if (set.rel != null) {
          RelOptUtil.equal("rowtype of new rel", rel.getRowType(),
              "rowtype of set", getRowType(), Litmus.THROW);
        }
        set.addInternal(rel);
        if (false) {
          Set<CorrelationId> variablesSet = RelOptUtil.getVariablesSet(rel);
          Set<CorrelationId> variablesStopped = rel.getVariablesSet();
          Set<CorrelationId> variablesPropagated =
              Util.minus(variablesSet, variablesStopped);
          assert set.variablesPropagated.containsAll(variablesPropagated);
          Set<CorrelationId> variablesUsed = RelOptUtil.getVariablesUsed(rel);
          assert set.variablesUsed.containsAll(variablesUsed);
        }
      } 

      Double checking relset rowtype and input parameter relNode rowtype may be unnecessary

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            xinqiu asdfgh19
            xinqiu asdfgh19
            Votes:
            0 Vote for this issue
            Watchers:
            2 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 - 40m
                40m

                Slack

                  Issue deployment