Skip to content

Commit

Permalink
opt: fix crdb_internal.decode_plan_gist to work with unknown index
Browse files Browse the repository at this point in the history
Release note (bug fix): crdb_internal.decode_plan_gist will no longer
produce an internal error when it is used to decode a plan gist for which
no schema information is available.
  • Loading branch information
rytaft committed Jul 19, 2022
1 parent bdaab44 commit c3dc767
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions pkg/sql/opt/exec/execbuilder/testdata/explain_gist
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,17 @@ SELECT crdb_internal.decode_plan_gist('$lookup_join_gist')
└── • scan
table: s83537@s83537_pkey
spans: FULL SCAN

# Ensure that we can decode a gist even if we do not have the schema info.
query T
SELECT crdb_internal.decode_plan_gist('AgGSARIAAwlAsJ8BE5IBAhcGFg==')
----
• limit
└── • index join
│ table: ?@?
└── • scan
table: ?@?
spans: 32 spans
limit: 10200
2 changes: 1 addition & 1 deletion pkg/sql/opt/exec/explain/plan_gist_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ func (u *unknownTable) DeletableIndexCount() int {
}

func (u *unknownTable) Index(i cat.IndexOrdinal) cat.Index {
panic(errors.AssertionFailedf("not implemented"))
return &unknownIndex{}
}

func (u *unknownTable) StatisticCount() int {
Expand Down

0 comments on commit c3dc767

Please sign in to comment.