Skip to content

Commit 48ad000

Browse files
committed
optbuilder: remove assertion annotation in an edge case
In 7ca00cc we added a panic-catcher to make any errors coming from `resolveAndRequireType` around partial indexes to be assertion failures. This was done under the assumption that we never expect any errors; however, we just saw a sentry report that had an error there that seems somewhat expected "interrupted during singleflight ×: context canceled". Thus, this commit removes the assertion annotation. Release note: None
1 parent e860c36 commit 48ad000

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

pkg/sql/opt/optbuilder/partial_index.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (b *Builder) addPartialIndexPredicatesForTable(tabMeta *opt.TableMeta, scan
120120
func (b *Builder) buildPartialIndexPredicate(
121121
tabMeta *opt.TableMeta, tableScope *scope, expr tree.Expr, context string,
122122
) (memo.FiltersExpr, error) {
123-
texpr := resolvePartialIndexPredicate(tableScope, expr)
123+
texpr := tableScope.resolveAndRequireType(expr, types.Bool)
124124

125125
var scalar opt.ScalarExpr
126126
b.factory.FoldingControl().TemporarilyDisallowStableFolds(func() {
@@ -198,16 +198,3 @@ func (b *Builder) buildPartialIndexPredicate(
198198
panic(errors.AssertionFailedf("unexpected expression during partial index normalization: %T", t))
199199
}
200200
}
201-
202-
// resolvePartialIndexPredicate attempts to resolve the type of expr as a
203-
// boolean and return a tree.TypedExpr if successful. It asserts that no errors
204-
// occur during resolution because the predicate should always be valid within
205-
// this context. If an error occurs, it is likely due to a bug in the optimizer.
206-
func resolvePartialIndexPredicate(tableScope *scope, expr tree.Expr) tree.TypedExpr {
207-
defer func() {
208-
if r := recover(); r != nil {
209-
panic(errors.AssertionFailedf("unexpected error during partial index predicate type resolution: %v", r))
210-
}
211-
}()
212-
return tableScope.resolveAndRequireType(expr, types.Bool)
213-
}

0 commit comments

Comments
 (0)