Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-55621

Possible regression in plans. Only one assignment shows up in plans rather than two previously.

    XMLWordPrintable

Details

    • Untriaged
    • 0
    • Unknown
    • Analytics CBO Sprint 13, Analytics CBO Sprint 14

    Description

      These two tests (rbo)

      asterixdb/asterix-app/src/test/resources/optimizerts/results/array-index/atomic-and-array-queries/query9.plan
      asterixdb/asterix-app/src/test/resources/optimizerts/results/array-index/atomic-and-array-queries/query8.plan

      The original plan had two assigns back to back. Now we have only one assign. Need to investigate and make sure this is not a regression.

      --------------------------------

      Ok, here are the critical differences in the final plans.

      Before NEO (assign is done in two steps)
      assign [$$69, $$68] <- [to-bigint($$65), to-bigint($$67)]
      – ASSIGN |PARTITIONED| <<<< I do not know why this is here???
      assign [$$60, $$58, $$67, $$65] <- [to-bigint($$D2.getField("field4")), to-bigint($$D2.getField("field1")), $$D2.getField("field2"), $$D2.getField("field3")]
      NEO (happens in one step).
      assign [$$69, $$68, $$60, $$58] <- [to-bigint($$D2.getField("field3")), to-bigint($$D2.getField("field2")), to-bigint($$D2.getField("field4")), to-bigint($$D2.getField("field1"))]
      Eventually, all the 4 variables have the same mapping. The NEO plan is more compact as well.

      These changes are expected. GG says:

      this is expected — for INL-JOINs (both columns and array) there is a need to push down all function calls out of the predicate (or else the JOIN doesn’t get recognized) — for array INLJ in particular, the rule that does the push down for column index JOINs doesn’t apply to array index JOINs so we do it ourselves in JoinFromSubplanRewrite

      (and doing it ourselves results in two ASSIGNs)

      This is done in file

      JoinFromSubplanRewrite (the change in expressions happens in the last two lines).

       
       if (new HashSet<>(varsFromLeftBranch).containsAll(usedVarsFromFunc)) {
                      newAssign.getInputs().add(new MutableObject<>(leftBranchRoot));
                      context.computeAndSetTypeEnvironmentForOperator(newAssign);
                      joinOp.getInputs().get(0).setValue(newAssign);
                      context.computeAndSetTypeEnvironmentForOperator(joinOp); <<<
                      arg.setValue(newVarRef); <<<
       
                  }
      
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            murali.krishna Murali Krishna
            murali.krishna Murali Krishna
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty