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

Array Index WHEN clause and query named parameters not working

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Yes

    Description

      create index ix1 on default(DISTINCT ARRAY v.lname FOR v IN names WHEN v.mname = "abc" END);
      EXPLAIN SELECT 1 FROM default WHERE ANY v IN names SATISFIES v.lname = "xyz" AND  v.mname = "abc" END;  -- works
      cbq> \set -$mname  "abc";
      cbq> EXPLAIN SELECT 1 FROM default WHERE ANY v IN names SATISFIES v.lname = "xyz" AND  v.mname = $mname END;
      {
          "requestID": "adc9c3a6-4904-492c-a15b-94c6b3cca802",
          "errors": [
              {
                  "code": 4000,
                  "msg": "No index available on keyspace default that matches your query. Use CREATE INDEX or CREATE PRIMARY INDEX to create an index, or check that your expected index is online."
              }
          ],
          "status": "fatal",
          "metrics": {
              "elapsedTime": "2.189019ms",
              "executionTime": "2.021909ms",
              "resultCount": 0,
              "resultSize": 0,
              "errorCount": 1
          }
      }
      
      

      last one is adhoc = true, If when clause value is parameterized it is not working. In adhoc=true we suppose to replace parameter with value before index selection.

      Looks like some case is missed in MB-33009

      Attachments

        Issue Links

          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-10662 [ CBSE-10662 ]
            Sitaram.Vemulapalli Sitaram Vemulapalli made changes -
            Description
            {code:java}
            create index ix1 on default(DISTINCT ARRAY v.lname FOR v IN names WHEN v.mname = "abc" END);
            EXPLAIN SELECT 1 FROM default WHERE ANY v IN names SATISFIES v.lname = "xyz" AND v.mname = "abc" END; -- works
            cbq> \set -$mname "abc";
            cbq> EXPLAIN SELECT 1 FROM default WHERE ANY v IN names SATISFIES v.lname = "xyz" AND v.mname = $mname END;
            {
                "requestID": "adc9c3a6-4904-492c-a15b-94c6b3cca802",
                "errors": [
                    {
                        "code": 4000,
                        "msg": "No index available on keyspace default that matches your query. Use CREATE INDEX or CREATE PRIMARY INDEX to create an index, or check that your expected index is online."
                    }
                ],
                "status": "fatal",
                "metrics": {
                    "elapsedTime": "2.189019ms",
                    "executionTime": "2.021909ms",
                    "resultCount": 0,
                    "resultSize": 0,
                    "errorCount": 1
                }
            }

            {code}

            last one is adhoc = true

            Looks like some case is missed in MB-33009
            {code:java}
            create index ix1 on default(DISTINCT ARRAY v.lname FOR v IN names WHEN v.mname = "abc" END);
            EXPLAIN SELECT 1 FROM default WHERE ANY v IN names SATISFIES v.lname = "xyz" AND v.mname = "abc" END; -- works
            cbq> \set -$mname "abc";
            cbq> EXPLAIN SELECT 1 FROM default WHERE ANY v IN names SATISFIES v.lname = "xyz" AND v.mname = $mname END;
            {
                "requestID": "adc9c3a6-4904-492c-a15b-94c6b3cca802",
                "errors": [
                    {
                        "code": 4000,
                        "msg": "No index available on keyspace default that matches your query. Use CREATE INDEX or CREATE PRIMARY INDEX to create an index, or check that your expected index is online."
                    }
                ],
                "status": "fatal",
                "metrics": {
                    "elapsedTime": "2.189019ms",
                    "executionTime": "2.021909ms",
                    "resultCount": 0,
                    "resultSize": 0,
                    "errorCount": 1
                }
            }

            {code}

            last one is adhoc = true, If when clause value is parameterized it is not working. In adhoc=true we suppose to replace parameter with value before index selection.

            Looks like some case is missed in MB-33009
            bingjie.miao Bingjie Miao made changes -
            Assignee Kamini Jagtiani [ kamini.jagtiani ] Bingjie Miao [ bingjie.miao ]
            bingjie.miao Bingjie Miao made changes -
            Link This issue is caused by MB-33009 [ MB-33009 ]
            bingjie.miao Bingjie Miao made changes -
            Fix Version/s 7.0.2 [ 18012 ]
            wayne Wayne Siu made changes -
            Link This issue blocks MB-46308 [ MB-46308 ]
            wayne Wayne Siu made changes -
            Labels approved-for-7.0.2
            wayne Wayne Siu made changes -
            Is this a Regression? Unknown [ 10452 ] Yes [ 10450 ]
            bingjie.miao Bingjie Miao made changes -
            Assignee Bingjie Miao [ bingjie.miao ] Mihir Kamdar [ mihir.kamdar ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]
            pierre.regazzoni Pierre Regazzoni made changes -
            Assignee Mihir Kamdar [ mihir.kamdar ] Pierre Regazzoni [ JIRAUSER25157 ]
            pierre.regazzoni Pierre Regazzoni made changes -
            Status Resolved [ 5 ] Closed [ 6 ]
            wayne Wayne Siu made changes -
            Link This issue blocks MB-47673 [ MB-47673 ]
            wayne Wayne Siu made changes -
            Labels approved-for-7.0.2 approved-for-6.6.4 approved-for-7.0.2
            wayne Wayne Siu made changes -
            Assignee Pierre Regazzoni [ JIRAUSER25157 ] Bingjie Miao [ bingjie.miao ]
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Reopened [ 4 ]
            wayne Wayne Siu made changes -
            Fix Version/s 6.6.4 [ 17614 ]
            bingjie.miao Bingjie Miao made changes -
            Assignee Bingjie Miao [ bingjie.miao ] Pierre Regazzoni [ JIRAUSER25157 ]
            Resolution Fixed [ 1 ]
            Status Reopened [ 4 ] Resolved [ 5 ]
            pierre.regazzoni Pierre Regazzoni made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

            People

              pierre.regazzoni Pierre Regazzoni
              Sitaram.Vemulapalli Sitaram Vemulapalli
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty