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

No operator for name DistinctScan

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.5.1, 5.0.0
    • 4.5.0, 5.0.0
    • query
    • None
    • Untriaged
    • No

    Description

      Have this error coming from sdk:
      { [Error: Unable to decode prepared statement - cause: Unrecognizable prepared statement - cause: JSON unmarshalling error: No operator for name DistinctScan]

      I created the index with DISTINCT method in expression.
      CREATE INDEX build_ver on `server`(`build`, DISTINCT SPLIT(`build`,\'-\')[0] );

      Then query with:
      select DISTINCT SPLIT(`build`,'-')[0] from `server` where `build` IS NOT NULL;

      This goes ok with cbq, but sdk throws error seen above. From explain:

       
          "requestID": "ba2f7e01-2542-48c2-a688-570b45a9f921",
          "signature": "json",
          "results": [
              {
                  "plan": {
                      "#operator": "Sequence",
                      "~children": [
                          {
                              "#operator": "Sequence",
                              "~children": [
                                  {
                                      "#operator": "DistinctScan",
                                      "scan": {
                                          "#operator": "IndexScan",
                                          "covers": [
                                              "cover ((`server`.`build`))",
                                              "cover ((distinct ((split((`server`.`build`), \"\")[0]))))",
                                              "cover ((meta(`server`).`id`))"
                                          ],
                                          "index": "build_verions",
                                          "index_id": "8d28a330b0448436",
                                          "keyspace": "server",
                                          "namespace": "default",
                                          "spans": [
                                              {
                                                  "Range": {
                                                      "Inclusion": 0,
                                                      "Low": [
                                                          "null"
                                                      ]
                                                  }
                                              }
                                          ],
                                          "using": "gsi"
                                      }
                                  },
                                  {
                                      "#operator": "Parallel",
                                      "~child": {
                                          "#operator": "Sequence",
                                          "~children": [
                                              {
                                                  "#operator": "Filter",
                                                  "condition": "(cover ((`server`.`build`)) is not null)"
                                              },
                                              {
                                                  "#operator": "InitialProject",
                                                  "distinct": true,
                                                  "result_terms": [
                                                      {
                                                          "as": "version",
                                                          "expr": "(split(cover ((`server`.`build`)), \"-\")[0])"
                                                      }
                                                  ]
                                              },
                                              {
                                                  "#operator": "Distinct"
                                              }
                                          ]
                                      }
                                  },
                                  {
                                      "#operator": "Distinct"
                                  }
                              ]
                          },
                          {
                              "#operator": "Order",
                              "sort_terms": [
                                  {
                                      "expr": "`version`"
                                  }
                              ]
                          },
                          {
                              "#operator": "FinalProject"
                          }
                      ]
                  },
                  "text": "select DISTINCT SPLIT(`build`,'-')[0]  AS version from `server` where `build` IS NOT NULL ORDER BY version"
              }
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "2.736994ms",
              "executionTime": "2.707054ms",
              "resultCount": 1,
              "resultSize": 3654
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              tommie Tommie McAfee (Inactive)
              tommie Tommie McAfee (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty