Skip to content

Commit

Permalink
sql: fix explain gist output to show number of scan span constraints
Browse files Browse the repository at this point in the history
If there were span constraints we would always print 1, need to actually
append them to get the count right.

Fixes: #85324

Release note: None
  • Loading branch information
cucaroach committed Jul 29, 2022
1 parent 60293f9 commit f1a608e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/sql/opt/exec/explain/plan_gist_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,10 @@ func (f *PlanGistFactory) decodeScanParams() exec.ScanParams {
if l > 0 {
idxConstraint = new(constraint.Constraint)
idxConstraint.Spans.Alloc(l)
var sp constraint.Span
idxConstraint.Spans.Append(&sp)
for i := 0; i < l; i++ {
var sp constraint.Span
idxConstraint.Spans.Append(&sp)
}
}

var invertedConstraint inverted.Spans
Expand Down
14 changes: 14 additions & 0 deletions pkg/sql/opt/exec/explain/testdata/gists
Original file line number Diff line number Diff line change
Expand Up @@ -1119,3 +1119,17 @@ explain(shape):
• explain
explain(gist):
• explain

# Regression test for #85324
explain-plan-gist
AgHyAQIA//8HHgAAByoFKiHyAQAA
----
• update
│ table: ?
│ set
└── • render
└── • scan
table: ?@?
spans: 15 spans

0 comments on commit f1a608e

Please sign in to comment.