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

Window frame reference CTE variable panics

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 6.5.0, 6.5.1, 6.6.1
    • 6.6.2, 7.0.0
    • query
    • Untriaged
    • 1
    • Unknown

    Description

      WITH noffset AS (2)
      SELECT b.name,
             ARRAY_AGG(b) OVER (ORDER BY b.name ROWS BETWEEN 2*noffset PRECEDING AND 2*noffset FOLLOWING) AS docs
      FROM [{"name":"option 1"},{"name":"option 2"},{"name":"option 3"},{"name":"option 4"},{"name":"option 5"},{"name":"option 6"},{"name":"option 7"},{"name":"option 8"} ]  AS b
      WHERE b.name IS NOT NULL;
      

      _time=2021-02-14T11:10:00.486-08:00 _level=SEVERE _msg=panic: runtime error: invalid memory address or nil pointer dereference
      _time=2021-02-14T11:10:00.486-08:00 _level=SEVERE _msg=request text: <ud>WITH noffset AS (2) SELECT b.name, ARRAY_AGG(b) OVER (ORDER BY b.name ROWS BETWEEN 2*noffset PRECEDING AND 2*noffset FOLLOWING) AS docs FROM [{"name":"option 1"},{"name":"option 2"},{"name":"option 3"},{"name":"option 4"},{"name":"option 5"},{"name":"option 6"},{"name":"option 7"},{"name":"option 8"} ]  AS b WHERE b.name IS NOT NULL;</ud>
      _time=2021-02-14T11:10:00.486-08:00 _level=SEVERE _msg=query context: <ud></ud>
      _time=2021-02-14T11:10:00.486-08:00 _level=SEVERE _msg=stack: goroutine 275 [running]:
      github.com/couchbase/query/execution.(*Context).Recover(0xc000c69680, 0xc000dcc000)
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/execution/context.go:921 +0xbb
      panic(0x546a000, 0x6b55c70)
      	/usr/local/Cellar/go/1.13.7/libexec/src/runtime/panic.go:679 +0x1b2
      github.com/couchbase/query/execution.(*base).close(0xc000dcc000, 0xc000c69680)
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/execution/base.go:270 +0x22a
      panic(0x546a000, 0x6b55c70)
      	/usr/local/Cellar/go/1.13.7/libexec/src/runtime/panic.go:679 +0x1b2
      github.com/couchbase/query/execution.(*base).notify(0xc000dcc000)
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/execution/base.go:975 +0x6e
      panic(0x546a000, 0x6b55c70)
      	/usr/local/Cellar/go/1.13.7/libexec/src/runtime/panic.go:679 +0x1b2
      github.com/couchbase/query/expression.(*Identifier).Evaluate(0xc000142dc0, 0x0, 0x0, 0x5a41d00, 0xc000c69680, 0x5a63960, 0xc0000414c0, 0x0, 0x0)
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/expression/identifier.go:64 +0x22
      github.com/couchbase/query/expression.(*Mult).Evaluate(0xc00052cd70, 0x0, 0x0, 0x5a41d00, 0xc000c69680, 0xc000de9b20, 0x404809c, 0x10, 0x56511c0)
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/expression/arith_mult.go:52 +0xdc
      github.com/couchbase/query/execution.(*AggregateInfo).windowValidateValExpr(0xc000b4ec30, 0x5a71c20, 0xc00052cd70, 0xc000b15100, 0xc000c69680, 0x7f9ad98, 0x0, 0x6c99f8a51996613d, 0x0)
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/execution/window.go:872 +0x56
      github.com/couchbase/query/execution.(*AggregateInfo).setOnce(0xc000b4ec30, 0xc000c69680, 0x71, 0x0)
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/execution/window.go:300 +0x315
      github.com/couchbase/query/execution.(*WindowAggregate).setupTerms(0xc000dcc000, 0xc000c69680, 0x0)
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/execution/window.go:193 +0x6dd
      github.com/couchbase/query/execution.(*WindowAggregate).beforeItems(0xc000dcc000, 0xc000c69680, 0x5a62f40, 0xc00014b400, 0x0)
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/execution/window.go:974 +0x35
      github.com/couchbase/query/execution.(*base).runConsumer.func1()
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/execution/base.go:887 +0x284
      github.com/couchbase/query/util.(*Once).Do(0xc000dcc138, 0xc000de9ec8)
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/util/sync.go:57 +0x4a
      github.com/couchbase/query/execution.(*base).runConsumer(0xc000dcc000, 0x5a30d80, 0xc000dcc000, 0xc000c69680, 0x5a62f40, 0xc00014b400)
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/execution/base.go:847 +0xa2
      github.com/couchbase/query/execution.(*WindowAggregate).RunOnce(0xc000dcc000, 0xc000c69680, 0x5a62f40, 0xc00014b400)
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/execution/window.go:970 +0x99
      github.com/couchbase/query/execution.execOp(0x5a80d60, 0xc000dcc000, 0xc000c69680, 0x5a62f40, 0xc00014b400)
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/execution/base.go:506 +0x54
      created by github.com/couchbase/query/execution.(*base).fork
      	/Users/sitaram/trans/query/src/github.com/couchbase/query/execution/base.go:517 +0x103
      
      

      Attachments

        Issue Links

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

          Activity

            Mihir Kamdar, Wayne Siu Would like to fix in 6.6.2

            Sitaram.Vemulapalli Sitaram Vemulapalli added a comment - Mihir Kamdar , Wayne Siu Would like to fix in 6.6.2

            Build couchbase-server-7.0.0-4463 contains query commit 713181f with commit message:
            MB-44329. pass the parent value for evaluation

            build-team Couchbase Build Team added a comment - Build couchbase-server-7.0.0-4463 contains query commit 713181f with commit message: MB-44329 . pass the parent value for evaluation

            Hi Wayne Siu lets take this in 6.6.2.

            mihir.kamdar Mihir Kamdar (Inactive) added a comment - Hi Wayne Siu lets take this in 6.6.2.

            Build couchbase-server-6.6.2-9510 contains query commit 8cce36d with commit message:
            MB-44329. pass the parent value for evaluation

            build-team Couchbase Build Team added a comment - Build couchbase-server-6.6.2-9510 contains query commit 8cce36d with commit message: MB-44329 . pass the parent value for evaluation

            Verified on build 7.0.0-4463 and 6.6.2-9510

             cbq> WITH noffset AS (2)
               > SELECT b.name,
               >        ARRAY_AGG(b) OVER (ORDER BY b.name ROWS BETWEEN 2*noffset PRECEDING AND 2*noffset FOLLOWING) AS docs
               > FROM [{"name":"option 1"},{"name":"option 2"},{"name":"option 3"},{"name":"option 4"},{"name":"option 5"},{"name":"option 6"},{"name":"option 7"},{"name":"option 8"} ]  AS b
               > WHERE b.name IS NOT NULL;
            {
                "requestID": "b0e9ffa3-89b0-44de-b82f-c0729c23d0f9",
                "signature": {
                    "docs": "array",
                    "name": "json"
                },
                "results": [
                {
                    "docs": [
                        {
                            "name": "option 1"
                        },
                        {
                            "name": "option 2"
                        },
                        {
                            "name": "option 3"
                        },
                        {
                            "name": "option 4"
                        },
                        {
                            "name": "option 5"
                        }
                    ],
                    "name": "option 1"
                },
                {
                    "docs": [
                        {
                            "name": "option 1"
                        },
                        {
                            "name": "option 2"
                        },
                        {
                            "name": "option 3"
                        },
                        {
                            "name": "option 4"
                        },
                        {
                            "name": "option 5"
                        },
                        {
                            "name": "option 6"
                        }
                    ],
                    "name": "option 2"
                },
                {
                    "docs": [
                        {
                            "name": "option 1"
                        },
                        {
                            "name": "option 2"
                        },
                        {
                            "name": "option 3"
                        },
                        {
                            "name": "option 4"
                        },
                        {
                            "name": "option 5"
                        },
                        {
                            "name": "option 6"
                        },
                        {
                            "name": "option 7"
                        }
                    ],
                    "name": "option 3"
                },
                {
                    "docs": [
                        {
                            "name": "option 1"
                        },
                        {
                            "name": "option 2"
                        },
                        {
                            "name": "option 3"
                        },
                        {
                            "name": "option 4"
                        },
                        {
                            "name": "option 5"
                        },
                        {
                            "name": "option 6"
                        },
                        {
                            "name": "option 7"
                        },
                        {
                            "name": "option 8"
                        }
                    ],
                    "name": "option 4"
                },
                {
                    "docs": [
                        {
                            "name": "option 1"
                        },
                        {
                            "name": "option 2"
                        },
                        {
                            "name": "option 3"
                        },
                        {
                            "name": "option 4"
                        },
                        {
                            "name": "option 5"
                        },
                        {
                            "name": "option 6"
                        },
                        {
                            "name": "option 7"
                        },
                        {
                            "name": "option 8"
                        }
                    ],
                    "name": "option 5"
                },
                {
                    "docs": [
                        {
                            "name": "option 2"
                        },
                        {
                            "name": "option 3"
                        },
                        {
                            "name": "option 4"
                        },
                        {
                            "name": "option 5"
                        },
                        {
                            "name": "option 6"
                        },
                        {
                            "name": "option 7"
                        },
                        {
                            "name": "option 8"
                        }
                    ],
                    "name": "option 6"
                },
                {
                    "docs": [
                        {
                            "name": "option 3"
                        },
                        {
                            "name": "option 4"
                        },
                        {
                            "name": "option 5"
                        },
                        {
                            "name": "option 6"
                        },
                        {
                            "name": "option 7"
                        },
                        {
                            "name": "option 8"
                        }
                    ],
                    "name": "option 7"
                },
                {
                    "docs": [
                        {
                            "name": "option 4"
                        },
                        {
                            "name": "option 5"
                        },
                        {
                            "name": "option 6"
                        },
                        {
                            "name": "option 7"
                        },
                        {
                            "name": "option 8"
                        }
                    ],
                    "name": "option 8"
                }
                ],
                "status": "success",
                "metrics": {
                    "elapsedTime": "10.039868ms",
                    "executionTime": "9.711322ms",
                    "resultCount": 8,
                    "resultSize": 3824,
                    "sortCount": 8
                }
            }

            pierre.regazzoni Pierre Regazzoni added a comment - Verified on build 7.0.0-4463 and 6.6.2-9510 cbq> WITH noffset AS ( 2 )    > SELECT b.name,    >        ARRAY_AGG(b) OVER (ORDER BY b.name ROWS BETWEEN 2 *noffset PRECEDING AND 2 *noffset FOLLOWING) AS docs    > FROM [{ "name" : "option 1" },{ "name" : "option 2" },{ "name" : "option 3" },{ "name" : "option 4" },{ "name" : "option 5" },{ "name" : "option 6" },{ "name" : "option 7" },{ "name" : "option 8" } ]  AS b    > WHERE b.name IS NOT NULL; {     "requestID" : "b0e9ffa3-89b0-44de-b82f-c0729c23d0f9" ,     "signature" : {         "docs" : "array" ,         "name" : "json"     },     "results" : [     {         "docs" : [             {                 "name" : "option 1"             },             {                 "name" : "option 2"             },             {                 "name" : "option 3"             },             {                 "name" : "option 4"             },             {                 "name" : "option 5"             }         ],         "name" : "option 1"     },     {         "docs" : [             {                 "name" : "option 1"             },             {                 "name" : "option 2"             },             {                 "name" : "option 3"             },             {                 "name" : "option 4"             },             {                 "name" : "option 5"             },             {                 "name" : "option 6"             }         ],         "name" : "option 2"     },     {         "docs" : [             {                 "name" : "option 1"             },             {                 "name" : "option 2"             },             {                 "name" : "option 3"             },             {                 "name" : "option 4"             },             {                 "name" : "option 5"             },             {                 "name" : "option 6"             },             {                 "name" : "option 7"             }         ],         "name" : "option 3"     },     {         "docs" : [             {                 "name" : "option 1"             },             {                 "name" : "option 2"             },             {                 "name" : "option 3"             },             {                 "name" : "option 4"             },             {                 "name" : "option 5"             },             {                 "name" : "option 6"             },             {                 "name" : "option 7"             },             {                 "name" : "option 8"             }         ],         "name" : "option 4"     },     {         "docs" : [             {                 "name" : "option 1"             },             {                 "name" : "option 2"             },             {                 "name" : "option 3"             },             {                 "name" : "option 4"             },             {                 "name" : "option 5"             },             {                 "name" : "option 6"             },             {                 "name" : "option 7"             },             {                 "name" : "option 8"             }         ],         "name" : "option 5"     },     {         "docs" : [             {                 "name" : "option 2"             },             {                 "name" : "option 3"             },             {                 "name" : "option 4"             },             {                 "name" : "option 5"             },             {                 "name" : "option 6"             },             {                 "name" : "option 7"             },             {                 "name" : "option 8"             }         ],         "name" : "option 6"     },     {         "docs" : [             {                 "name" : "option 3"             },             {                 "name" : "option 4"             },             {                 "name" : "option 5"             },             {                 "name" : "option 6"             },             {                 "name" : "option 7"             },             {                 "name" : "option 8"             }         ],         "name" : "option 7"     },     {         "docs" : [             {                 "name" : "option 4"             },             {                 "name" : "option 5"             },             {                 "name" : "option 6"             },             {                 "name" : "option 7"             },             {                 "name" : "option 8"             }         ],         "name" : "option 8"     }     ],     "status" : "success" ,     "metrics" : {         "elapsedTime" : "10.039868ms" ,         "executionTime" : "9.711322ms" ,         "resultCount" : 8 ,         "resultSize" : 3824 ,         "sortCount" : 8     } }

            People

              pierre.regazzoni Pierre Regazzoni
              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