Skip to content

Commit

Permalink
update bazel
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongjiwei committed Dec 19, 2022
1 parent f404166 commit d9669d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions expression/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ go_test(
"integration_serial_test.go",
"integration_test.go",
"main_test.go",
"multi_valued_index_test.go",
"scalar_function_test.go",
"schema_test.go",
"typeinfer_test.go",
Expand Down
14 changes: 7 additions & 7 deletions expression/builtin_cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -1981,13 +1981,7 @@ func BuildCastCollationFunction(ctx sessionctx.Context, expr Expression, ec *Exp
func BuildCastFunction(ctx sessionctx.Context, expr Expression, tp *types.FieldType) (res Expression) {
res, err := BuildCastFunctionWithCheck(ctx, expr, tp)
terror.Log(err)
// We do not fold CAST if the eval type of this scalar function is ETJson
// since we may reset the flag of the field type of CastAsJson later which
// would affect the evaluation of it.
if tp.EvalType() != types.ETJson {
res = FoldConstant(res)
}
return res
return
}

// BuildCastFunctionWithCheck builds a CAST ScalarFunction from the Expression and return error if any.
Expand Down Expand Up @@ -2028,6 +2022,12 @@ func BuildCastFunctionWithCheck(ctx sessionctx.Context, expr Expression, tp *typ
RetType: tp,
Function: f,
}
// We do not fold CAST if the eval type of this scalar function is ETJson
// since we may reset the flag of the field type of CastAsJson later which
// would affect the evaluation of it.
if tp.EvalType() != types.ETJson && err == nil {
res = FoldConstant(res)
}
return res, err
}

Expand Down

0 comments on commit d9669d2

Please sign in to comment.