Eval implements the TypedExpr interface.
(ctx *EvalContext)
| 4261 | |
| 4262 | // Eval implements the TypedExpr interface. |
| 4263 | func (expr *UnaryExpr) Eval(ctx *EvalContext) (Datum, error) { |
| 4264 | d, err := expr.Expr.(TypedExpr).Eval(ctx) |
| 4265 | if err != nil { |
| 4266 | return nil, err |
| 4267 | } |
| 4268 | if d == DNull { |
| 4269 | return DNull, nil |
| 4270 | } |
| 4271 | res, err := expr.fn.Fn(ctx, d) |
| 4272 | if err != nil { |
| 4273 | return nil, err |
| 4274 | } |
| 4275 | if ctx.TestingKnobs.AssertUnaryExprReturnTypes { |
| 4276 | if err := ensureExpectedType(expr.fn.ReturnType, res); err != nil { |
| 4277 | return nil, errors.NewAssertionErrorWithWrappedErrf(err, "unary op %q", expr) |
| 4278 | } |
| 4279 | } |
| 4280 | return res, err |
| 4281 | } |
| 4282 | |
| 4283 | // Eval implements the TypedExpr interface. |
| 4284 | func (expr DefaultVal) Eval(ctx *EvalContext) (Datum, error) { |
nothing calls this directly
no test coverage detected