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

CG hint for WITH ARRAY bindings clears constant values

    XMLWordPrintable

Details

    • Untriaged
    • 0
    • Yes

    Description

       

      prepare p2 AS with aa AS ([1,2,3]) SELECT d, aa FROM [1,2] AS d;
      

      Second execution of p2 losses value

       execute p2;
      {
          "requestID": "0ea587d4-634d-4545-a833-427d2c6fe007",
          "signature": {
              "d": "json",
              "aa": "json"
          },
          "results": [
          {
              "d": 1,
              "aa": [
                  1,
                  2,
                  3
              ]
          },
          {
              "d": 2,
              "aa": [
                  1,
                  2,
                  3
              ]
          }
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "681.667µs",
              "executionTime": "542.625µs",
              "resultCount": 2,
              "resultSize": 186,
              "serviceLoad": 2
          }
      }
      cbq> execute p2;
      {
          "requestID": "8552a837-65cc-49b7-9c97-5fd712c8cd3a",
          "signature": {
              "d": "json",
              "aa": "json"
          },
          "results": [
          {
              "d": 1,
              "aa": [
                  null,
                  null,
                  null
              ]
          },
          {
              "d": 2,
              "aa": [
                  null,
                  null,
                  null
              ]
          }
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "724.75µs",
              "executionTime": "566.292µs",
              "resultCount": 2,
              "resultSize": 204,
              "serviceLoad": 2
          }
      }

       

      It looks like constant construct expression (Array, Object). Which evaluate and store in value.

      Later we return.

      Problem with this is prepare (but can happen correlated subquries too)

      At the end of execution, it might recycled (not sure where) and giving  array of nil values, second execution of prepare statement.

      https://github.com/couchbase/query/blob/master/execution/with.go#L96

      If call here with.Expression().ResetValue() it re-evalaute constants. Or some how  track if it is constant.

       

      Attachments

        Issue Links

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

          Activity

            People

              ajay.bhullar Ajay Bhullar
              Sitaram.Vemulapalli Sitaram Vemulapalli
              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