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

[N1QL] early filter order behavior changed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Major
    • None
    • 7.2.1
    • query
    • None
    • 7.2.1-5928
    • Untriaged
    • 0
    • Yes

    Description

      upsert into default values("k0",

      {"f1":1,"f2":2,"f3":3}

      ),values("k1",

      {"f1":2,"f2":2,"f3":0}

      ),values("k2",

      {"f1":1,"f2":2,"f3":3,"string":"abcd"}

      ),values("k3",

      {"f1":0,"f2":2,"f3":3}

      )

      create index ixto on default(f1,f2)

      explain select * from default where f1 < 10 and f2 = 2 and f3 = 3 order by f1 desc limit 2

      in the past we expected this to contain an index_keys section (early filter was being applied), and now it does not

      {
          "plan": {
              "#operator": "Sequence",
              "~children": [
                  {
                      "#operator": "Sequence",
                      "~children": [
                          {
                              "#operator": "IndexScan3",
                              "index": "ixto",
                              "index_id": "3e177cba1355215e",
                              "index_projection": {
                                  "primary_key": true
                              },
                              "keyspace": "default",
                              "namespace": "default",
                              "spans": [
                                  {
                                      "exact": true,
                                      "range": [
                                          {
                                              "high": "10",
                                              "inclusion": 0,
                                              "index_key": "`f1`",
                                              "low": "null"
                                          },
                                          {
                                              "high": "2",
                                              "inclusion": 3,
                                              "index_key": "`f2`",
                                              "low": "2"
                                          }
                                      ]
                                  }
                              ],
                              "using": "gsi"
                          },
                          {
                              "#operator": "Fetch",
                              "keyspace": "default",
                              "namespace": "default"
                          },
                          {
                              "#operator": "Parallel",
                              "~child": {
                                  "#operator": "Sequence",
                                  "~children": [
                                      {
                                          "#operator": "Filter",
                                          "condition": "((((`default`.`f1`) < 10) and ((`default`.`f2`) = 2)) and ((`default`.`f3`) = 3))"
                                      },
                                      {
                                          "#operator": "InitialProject",
                                          "result_terms": [
                                              {
                                                  "expr": "self",
                                                  "star": true
                                              }
                                          ]
                                      }
                                  ]
                              }
                          }
                      ]
                  },
                  {
                      "#operator": "Order",
                      "flags": 2,
                      "limit": "2",
                      "sort_terms": [
                          {
                              "desc": "\"desc\"",
                              "expr": "(`default`.`f1`)"
                          }
                      ]
                  },
                  {
                      "#operator": "Limit",
                      "expr": "2"
                  }
              ]
          }
      }
      

      The last time these tests all passed was 7.1.5-3858

      this does not appear to be affecting the results of the query itself

      select * from default where f1 < 10 and f2 = 2 and f3 = 3 order by f1 desc limit 2

      [
      {
      "default":

      { "f1": 1, "f2": 2, "f3": 3, "string": "abcd" }

      },
      {
      "default":

      { "f1": 1, "f2": 2, "f3": 3 }

      }
      ]

      if this is expected please let me know and I will change the tests

      Attachments

        Issue Links

          Activity

            People

              ajay.bhullar Ajay Bhullar
              ajay.bhullar Ajay Bhullar
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty