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

Index aggregates pushdown wrongly

    XMLWordPrintable

    Details

    • Story Points:
      1

      Description

      CREATE INDEX cx1 ON default(type, a1 );
       
      UPSERT INTO default VALUES ("c001", {"type": "doc", "a1":[{"name":"a1"}, {"name":"a2"}]}),
                          VALUES ("c002", {"type": "doc", "a1":[{"name":"b1"}, {"name":"a2"}]}),
                          VALUES ("c003", {"type": "doc", "a1":[{"name":"b1"}, {"name":"a2"}]});
       
      SELECT COUNT(1) FROM default AS d
      WHERE d.type = "doc" AND (EVERY v IN a1 SATISFIES v.name != "b1" END OR d.a1 IS MISSING);
       
      SELECT * FROM default AS d
      WHERE d.type = "doc" AND (EVERY v IN a1 SATISFIES v.name != "b1" END OR d.a1 IS MISSING);
      

      count query returns 3, non-count query returns 1

      Index is not array Index. array field is Scalar value. count query can cover. But the EVERY predicate is not pushed to indexer. It should not push index aggregation.
      Also note EVERY query can't push any index pushdowns.

      Workaround:
      SELECT COUNT(1) FROM default AS d WHERE d.type = "doc" AND (EVERY v IN IFMISSING(a1,[]) SATISFIES v.name != "b1" END);
      EVERY is true for empty ARRAY.

        Attachments

        For Gerrit Dashboard: MB-42474
        # Subject Branch Project Status CR V

          Activity

          Hide
          ajay.bhullar Ajay Bhullar added a comment -

          verified in 7.0.0-3646 using the steps in the description count is now returning 1 as well as 1 doc being returned

          Show
          ajay.bhullar Ajay Bhullar added a comment - verified in 7.0.0-3646 using the steps in the description count is now returning 1 as well as 1 doc being returned
          Hide
          build-team Couchbase Build Team added a comment -

          Build couchbase-server-6.5.1-6313 contains query commit 89d8869 with commit message:
          MB-42474 Set exact spans properly in case of multiple spans for the same index

          Show
          build-team Couchbase Build Team added a comment - Build couchbase-server-6.5.1-6313 contains query commit 89d8869 with commit message: MB-42474 Set exact spans properly in case of multiple spans for the same index
          Hide
          ajay.bhullar Ajay Bhullar added a comment -

          verified in 6.5.1-6313 with the steps in the description, count and query both return 1 document (count returns 1)

          Show
          ajay.bhullar Ajay Bhullar added a comment - verified in 6.5.1-6313 with the steps in the description, count and query both return 1 document (count returns 1)
          Hide
          ajay.bhullar Ajay Bhullar added a comment -

          verified in all versions the fix was pushed to

          Show
          ajay.bhullar Ajay Bhullar added a comment - verified in all versions the fix was pushed to
          Hide
          build-team Couchbase Build Team added a comment -

          Build couchbase-server-6.5.2-6601 contains query commit 89d8869 with commit message:
          MB-42474 Set exact spans properly in case of multiple spans for the same index

          Show
          build-team Couchbase Build Team added a comment - Build couchbase-server-6.5.2-6601 contains query commit 89d8869 with commit message: MB-42474 Set exact spans properly in case of multiple spans for the same index

            People

            Assignee:
            mihir.kamdar Mihir Kamdar
            Reporter:
            Sitaram.Vemulapalli Sitaram Vemulapalli
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                PagerDuty