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

        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 ]
          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 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 ]
          bingjie.miao Bingjie Miao made changes -
          Assignee Bingjie Miao [ bingjie.miao ] Mihir Kamdar [ mihir.kamdar ]
          Resolution Fixed [ 1 ]
          Status Reopened [ 4 ] Resolved [ 5 ]
          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.1 [ 16622 ]
          Fix Version/s 6.5.2 [ 17223 ]
          ajay.bhullar Ajay Bhullar made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          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

            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