Eval implements the TypedExpr interface.
(ctx *EvalContext)
| 3279 | |
| 3280 | // Eval implements the TypedExpr interface. |
| 3281 | func (expr *CastExpr) Eval(ctx *EvalContext) (Datum, error) { |
| 3282 | d, err := expr.Expr.(TypedExpr).Eval(ctx) |
| 3283 | if err != nil { |
| 3284 | return nil, err |
| 3285 | } |
| 3286 | |
| 3287 | // NULL cast to anything is NULL. |
| 3288 | if d == DNull { |
| 3289 | return d, nil |
| 3290 | } |
| 3291 | d = UnwrapDatum(ctx, d) |
| 3292 | return PerformCast(ctx, d, expr.Type) |
| 3293 | } |
| 3294 | |
| 3295 | // PerformCast performs a cast from the provided Datum to the specified |
| 3296 | // types.T. |
no test coverage detected