vitessio/vitess · error

err

Error message

err

What it means

This is the same code path as the UNIMPLEMENTED case, but for any other translation failure: if evalengine.Translate of the rewritten filter predicate fails with an error NOT prefixed by ErrTranslateExprNotSupported, planOffsets panics with the raw error. These are hard translation errors (malformed expression, unexpected AST node, internal type/encoding problems) rather than recognized unsupported constructs.

Source

Thrown at go/vt/vtgate/planbuilder/operators/filter.go:117

func (f *Filter) GetOrdering(ctx *plancontext.PlanningContext) []OrderBy {
	return f.Source.GetOrdering(ctx)
}

func (f *Filter) planOffsets(ctx *plancontext.PlanningContext) Operator {
	cfg := &evalengine.Config{
		ResolveType: ctx.TypeForExpr,
		Collation:   ctx.SemTable.Collation,
		Environment: ctx.VSchema.Environment(),
	}

	predicate := sqlparser.AndExpressions(f.Predicates...)
	rewritten := useOffsets(ctx, predicate, f)
	eexpr, err := evalengine.Translate(rewritten, cfg)
	if err != nil {
		if strings.HasPrefix(err.Error(), evalengine.ErrTranslateExprNotSupported) {
			panic(vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "%s: %s", evalengine.ErrTranslateExprNotSupported, sqlparser.String(predicate)))
		}
		panic(err)
	}

	f.PredicateWithOffsets = eexpr
	return nil
}

func (f *Filter) ShortDescription() string {
	return sqlparser.String(sqlparser.AndExpressions(f.Predicates...))
}

func (f *Filter) setTruncateColumnCount(offset int) {
	f.ResultColumns = offset
}

func (f *Filter) getTruncateColumnCount() int {
	return f.ResultColumns
}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Capture the full panic/error message and query; reduce the query to a minimal reproducer
  2. Rewrite the query to avoid the failing predicate shape (e.g. split the query, use a simpler WHERE clause, or restructure the join)
  3. Report the reproducer to the Vitess project - a raw panic here indicates a planner/translator bug
Defensive patterns

Strategy: try-catch

Try / catch

defer func() {
	if r := recover(); r != nil {
		err = vterrors.Errorf(vtrpcpb.Code_INTERNAL, "filter offset planning failed: %v", r)
	}
}()

Prevention

When it happens

Trigger: evalengine.Translate returns a non-NotSupported error during filter offset planning - e.g. internal AST shapes the translator cannot handle, collation/environment issues, or bugs where useOffsets produced an invalid expression tree.

Common situations: Planner bugs with exotic queries (unions inside derived tables feeding filters); collation misconfiguration in the vschema; regression after upgrading Vitess where previously-working predicates hit a new code path.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/ee6c307d5a674543. Report an issue: GitHub.