{"record":{"id":"d0aa1df859f1ea29","repo":"vitessio/vitess","slug":"err-d0aa1d","errorCode":null,"errorMessage":"err","messagePattern":"err","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtgate/planbuilder/operators/hash_join.go","lineNumber":349,"sourceCode":"\t\t}\n\n\t\tif rOffset := check(rId, hj.RHS, rhsOffset); rOffset >= 0 {\n\t\t\tr.replaceExpr = sqlparser.NewOffset(rOffset, expr)\n\t\t\treturn false\n\t\t}\n\n\t\treturn true\n\t}\n\n\trewrittenExpr := sqlparser.CopyOnRewrite(in, pre, r.post, ctx.SemTable.CopySemanticInfo).(sqlparser.Expr)\n\tcfg := &evalengine.Config{\n\t\tResolveType: ctx.TypeForExpr,\n\t\tCollation:   ctx.SemTable.Collation,\n\t\tEnvironment: ctx.VSchema.Environment(),\n\t}\n\teexpr, err := evalengine.Translate(rewrittenExpr, cfg)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t_, isPureOffset := rewrittenExpr.(*sqlparser.Offset)\n\n\treturn &ProjExpr{\n\t\tOriginal: aeWrap(in),\n\t\tEvalExpr: rewrittenExpr,\n\t\tColExpr:  rewrittenExpr,\n\t\tInfo:     &EvalEngine{EExpr: eexpr},\n\t}, isPureOffset\n}\n\n// JoinPredicate produces an AST representation of the join condition this join has\nfunc (hj *HashJoin) JoinPredicate() sqlparser.Expr {\n\texprs := slice.Map(hj.JoinComparisons, func(from Comparison) sqlparser.Expr {\n\t\treturn &sqlparser.ComparisonExpr{\n\t\t\tLeft:  from.LHS,\n\t\t\tRight: from.RHS,","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtgate/planbuilder/operators/hash_join.go#L331-L367","documentation":"addColumn panics with the raw error when evalengine.Translate fails to translate a rewritten projection expression for the hash join's output columns. Unlike filter planning there is no special-casing here: any translation failure (unsupported expression, bad AST shape, environment/collation problem) bubbles up as an internal panic.","triggerScenarios":"A projection expression on a hash join, after rewriting to offsets (rewrittenExpr), contains something evalengine.Translate rejects - unsupported functions, unexpected Offset/expression combinations, or invalid collation context - reached via the anonymous caller of addColumn.","commonSituations":"SELECT lists over hash joins containing functions or expressions the evalengine cannot translate; collation misconfigurations; planner bugs where offset rewriting produced an untranslatable tree.","solutions":["Identify the offending SELECT expression from the query and replace it with a supported equivalent or compute it client-side","Simplify the projection (select base columns, transform in application code)","Reproduce minimally and file a Vitess bug with the query and panic stack"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-validate projection expressions in tooling\nif _, err := evalengine.Translate(expr, cfg); err != nil { /* simplify SELECT list before planning */ }","typeGuard":null,"tryCatchPattern":"defer func() {\n\tif r := recover(); r != nil {\n\t\terr = vterrors.Errorf(vtrpcpb.Code_INTERNAL, \"hash join column planning failed: %v\", r)\n\t}\n}()","preventionTips":["Keep SELECT-list expressions over hash joins to supported functions","Run query suites against Vitess CI to catch untranslatable projections","Compute exotic transformations in application code instead of SQL"],"tags":["vitess","planbuilder","hash-join","evalengine"],"backgroundTag":"expression-not-supported","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}