Skip to content

Commit 55d7433

Browse files
committed
fix CI
1 parent 9a4c874 commit 55d7433

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

expression/scalar_function.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ func (sf *ScalarFunction) MarshalJSON() ([]byte, error) {
7272

7373
// NewFunction creates a new scalar function or constant.
7474
func NewFunction(ctx sessionctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {
75+
return newFunction(ctx, true, funcName, retType, args...)
76+
}
77+
78+
// NewFunctionBase creates a new scalar function or constant without constant fold
79+
func NewFunctionBase(ctx sessionctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {
80+
return newFunction(ctx, false, funcName, retType, args...)
81+
}
82+
83+
func newFunction(ctx sessionctx.Context, fold bool, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {
7584
if retType == nil {
7685
return nil, errors.Errorf("RetType cannot be nil for ScalarFunction.")
7786
}
@@ -96,7 +105,10 @@ func NewFunction(ctx sessionctx.Context, funcName string, retType *types.FieldTy
96105
RetType: retType,
97106
Function: f,
98107
}
99-
return FoldConstant(sf), nil
108+
if fold {
109+
return FoldConstant(sf), nil
110+
}
111+
return sf, nil
100112
}
101113

102114
// NewFunctionInternal is similar to NewFunction, but do not returns error, should only be used internally.

0 commit comments

Comments
 (0)