Skip to content

Commit

Permalink
Merge pull request #94423 from msirek/backport22.2-94112
Browse files Browse the repository at this point in the history
release-22.2: main: update optgen Op alias to match current memo group member
  • Loading branch information
Mark Sirek authored Dec 30, 2022
2 parents 09f5c8b + e487c4e commit 1af184f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/sql/opt/optgen/cmd/optgen/rule_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,9 @@ func (g *newRuleGen) genMatchNameAndChildren(
g.w.nest("else {\n")
g.w.writeIndent("_member = _member.NextExpr()\n")
g.w.unnest("}\n")
if context.untypedAlias != "" {
g.w.write("%s = _member\n", context.untypedAlias)
}

if match == g.innerExploreMatch {
// This is the innermost match expression, so skip over already
Expand Down
3 changes: 3 additions & 0 deletions pkg/sql/opt/optgen/cmd/optgen/testdata/explorer
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ func (_e *explorer) exploreLimit(
} else {
_member = _member.NextExpr()
}
scan = _member
if !_partlyExplored || _ord >= _state.start {
_scan, _ := _member.(*memo.ScanExpr)
if _scan != nil {
Expand Down Expand Up @@ -420,6 +421,7 @@ func (_e *explorer) exploreLimit(
} else {
_member = _member.NextExpr()
}
input = _member
if !_partlyExplored || _ord >= _state.start {
_scan, _ := _member.(*memo.ScanExpr)
if _scan == nil {
Expand Down Expand Up @@ -652,6 +654,7 @@ func (_e *explorer) exploreUnion(
} else {
_member = _member.NextExpr()
}
left = _member
if !_partlyExplored || _ord >= _state.start {
_union, _ := _member.(*memo.UnionExpr)
if _union != nil {
Expand Down

0 comments on commit 1af184f

Please sign in to comment.