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

RQG: min query giving wrong result on IndexScan

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Test Blocker
    • 4.5.0
    • 4.5.0
    • query
    • 2151 build
    • Untriaged
    • Yes

    Description

      Query which gives wrong result:

      SELECT min( decimal_field1 ) FROM simple_table_1 WHERE NOT ((decimal_field1 < 5024) OR (decimal_field1 <= 5024)) ;

      Result:
      [

      { "$1": null }

      ]

      Explain of above query:
      [
      {
      "plan": {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "IndexScan",
      "covers": [
      "cover ((`simple_table_1`.`decimal_field1`))",
      "cover ((meta(`simple_table_1`).`id`))"
      ],
      "index": "simple_table_1_idx_decimal_field1",
      "index_id": "fb8e662572c5708b",
      "keyspace": "simple_table_1",
      "limit": "1",
      "namespace": "default",
      "spans": [
      {
      "Range":

      { "Inclusion": 1, "Low": [ "5024" ] }

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

      { "#operator": "Filter", "condition": "(not ((cover ((`simple_table_1`.`decimal_field1`)) < 5024) or (cover ((`simple_table_1`.`decimal_field1`)) <= 5024)))" }

      ,

      { "#operator": "InitialGroup", "aggregates": [ "min(cover ((`simple_table_1`.`decimal_field1`)))" ], "group_keys": [] }

      ]
      }
      },

      { "#operator": "IntermediateGroup", "aggregates": [ "min(cover ((`simple_table_1`.`decimal_field1`)))" ], "group_keys": [] }

      ,

      { "#operator": "FinalGroup", "aggregates": [ "min(cover ((`simple_table_1`.`decimal_field1`)))" ], "group_keys": [] }

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

      { "expr": "min(cover ((`simple_table_1`.`decimal_field1`)))" }

      ]
      },

      { "#operator": "FinalProject" }

      ]
      }
      }
      ]
      },
      "text": "SELECT min( decimal_field1 ) FROM simple_table_1 WHERE NOT ((decimal_field1 < 5024) OR (decimal_field1 <= 5024)) ;"
      }
      ]

      Index used:
      CREATE INDEX `simple_table_1_idx_decimal_field1` ON `simple_table_1`(`decimal_field1`) WITH

      { "defer_build"=true }

      Same query with primary index gives correct result:
      SELECT min( decimal_field1 ) FROM simple_table_1 use index(`#primary`) WHERE NOT ((decimal_field1 < 5024) OR (decimal_field1 <= 5024)) ;

      Result:
      [

      { "$1": 5028 }

      ]

      Uploading dataset and logs soon.
      Couchbase URL: http://172.23.107.87:8091/

      Attachments

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

        Activity

          People

            Sitaram.Vemulapalli Sitaram Vemulapalli
            Prerna.Manaktala Prerna Manaktala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty