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

filter_covers must wrap expressions in Cover()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 4.5.0
    • 4.5.0
    • query
    • None
    • Untriaged
    • Unknown

    Description

      There is a bug with filter_covers that prevents correct behavior. They need to wrap the corresponding expressions in Cover(). For example:

      CREATE INDEX idx_userprofile_status
      ON couchmusic2(status)
      WHERE type = "userprofile";

      EXPLAIN
      SELECT COUNT AS active_profiles
      FROM couchmusic2
      WHERE status = "active"
      AND type = "userprofileā€;

      [
      {
      "plan": {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "IndexScan",
      "covers": [
      "cover ((`couchmusic2`.`status`))",
      "cover ((meta(`couchmusic2`).`id`))"
      ],
      "filter_covers":

      { "(`couchmusic2`.`type`)": "userprofile" }

      ,
      "index": "idx_userprofile_status",
      "index_id": "d4f9d46ba034ae40",
      "keyspace": "couchmusic2",
      "namespace": "default",
      "spans": [
      {
      "Range":

      { "High": [ "\"active\"" ], "Inclusion": 3, "Low": [ "\"active\"" ] }

      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "Parallel",
      "~child": {
      "#operator": "Sequence",
      "~children": [

      { "#operator": "Filter", "condition": "((cover ((`couchmusic2`.`status`)) = \"active\") and ((`couchmusic2`.`type`) = \"userprofile\"))" }

      ,

      { "#operator": "InitialGroup", "aggregates": [ "count(*)" ], "group_keys": [] }

      ]
      }
      },

      { "#operator": "IntermediateGroup", "aggregates": [ "count(*)" ], "group_keys": [] }

      ,

      { "#operator": "FinalGroup", "aggregates": [ "count(*)" ], "group_keys": [] }

      ,
      {
      "#operator": "Parallel",
      "~child": {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "InitialProject",
      "result_terms": [

      { "as": "active_profiles", "expr": "count(*)" }

      ]
      },

      { "#operator": "FinalProject" }

      ]
      }
      }
      ]
      },
      "text": "\nSELECT COUNT AS active_profiles\nFROM couchmusic2\nWHERE status = \"active\"\nAND type = \"userprofile\";"
      }
      ]

      Attachments

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

        Activity

          People

            gerald Gerald Sangudi (Inactive)
            gerald Gerald Sangudi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty