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

Index aggregates pushdown wrongly

    XMLWordPrintable

Details

    • 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

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

        Activity

          Sitaram.Vemulapalli Sitaram Vemulapalli created issue -
          Sitaram.Vemulapalli Sitaram Vemulapalli made changes -
          Field Original Value New Value
          Link This issue is triggered by CBSE-9158 [ CBSE-9158 ]
          Sitaram.Vemulapalli Sitaram Vemulapalli made changes -
          Issue Type Task [ 3 ] Bug [ 1 ]
          kamini.jagtiani Kamini Jagtiani made changes -
          Assignee Kamini Jagtiani [ kamini.jagtiani ] Bingjie Miao [ bingjie.miao ]

          Build couchbase-server-7.0.0-3646 contains query commit 5998cfd with commit message:
          MB-42474 Set exact spans properly in case of multiple spans for the same index

          build-team Couchbase Build Team added a comment - Build couchbase-server-7.0.0-3646 contains query commit 5998cfd with commit message: MB-42474 Set exact spans properly in case of multiple spans for the same index
          bingjie.miao Bingjie Miao made changes -
          Assignee Bingjie Miao [ bingjie.miao ] Mihir Kamdar [ mihir.kamdar ]
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          wayne Wayne Siu made changes -
          Link This issue blocks MB-40528 [ MB-40528 ]
          wayne Wayne Siu added a comment -

          Re-opening it for 6.6.1

          wayne Wayne Siu added a comment - Re-opening it for 6.6.1
          wayne Wayne Siu made changes -
          Assignee Mihir Kamdar [ mihir.kamdar ] Sitaram Vemulapalli [ sitaram.vemulapalli ]
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          wayne Wayne Siu made changes -
          Labels approved-for-6.6.1
          wayne Wayne Siu made changes -
          Fix Version/s 6.6.1 [ 17002 ]
          Sitaram.Vemulapalli Sitaram Vemulapalli made changes -
          Assignee Sitaram Vemulapalli [ sitaram.vemulapalli ] Bingjie Miao [ bingjie.miao ]
          bingjie.miao Bingjie Miao made changes -
          Affects Version/s 6.6.2 [ 17103 ]

          Build couchbase-server-6.6.1-9176 contains query commit a5aa02a with commit message:
          MB-42474 Set exact spans properly in case of multiple spans for the same index

          build-team Couchbase Build Team added a comment - Build couchbase-server-6.6.1-9176 contains query commit a5aa02a with commit message: MB-42474 Set exact spans properly in case of multiple spans for the same index
          bingjie.miao Bingjie Miao made changes -
          Assignee Bingjie Miao [ bingjie.miao ] Mihir Kamdar [ mihir.kamdar ]
          Resolution Fixed [ 1 ]
          Status Reopened [ 4 ] Resolved [ 5 ]
          ajay.bhullar Ajay Bhullar added a comment -

          verified in 6.6.1-9176 using the repro in description

          ajay.bhullar Ajay Bhullar added a comment - verified in 6.6.1-9176 using the repro in description
          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

          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
          wayne Wayne Siu made changes -
          Link This issue blocks MB-42749 [ MB-42749 ]
          wayne Wayne Siu made changes -
          Link This issue blocks MB-42583 [ MB-42583 ]
          bingjie.miao Bingjie Miao made changes -
          Fix Version/s 6.5.1 [ 16622 ]
          wayne Wayne Siu made changes -
          Fix Version/s 6.5.2 [ 17223 ]
          Fix Version/s 6.5.1 [ 16622 ]

          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

          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
          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)

          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)
          ajay.bhullar Ajay Bhullar added a comment -

          verified in all versions the fix was pushed to

          ajay.bhullar Ajay Bhullar added a comment - verified in all versions the fix was pushed to
          ajay.bhullar Ajay Bhullar made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

          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

          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
          arunkumar Arunkumar Senthilnathan made changes -
          Labels approved-for-6.6.1 approved-for-6.6.1 releasenote
          lynn.straus Lynn Straus made changes -
          Fix Version/s 7.0.0 [ 17233 ]
          lynn.straus Lynn Straus made changes -
          Fix Version/s Cheshire-Cat [ 15915 ]

          People

            mihir.kamdar Mihir Kamdar (Inactive)
            Sitaram.Vemulapalli Sitaram Vemulapalli
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty