Skip to content

Commit

Permalink
Merge branch 'master' into stabalize-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
morgo authored Mar 15, 2022
2 parents a548cbb + 7ca9aff commit 106aab9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
30 changes: 30 additions & 0 deletions expression/expr_to_pb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,36 @@ func TestExprPushDownToFlash(t *testing.T) {
function, err = NewFunction(mock.NewContext(), ast.Least, types.NewFieldType(mysql.TypeDouble), float32Column, intColumn)
require.NoError(t, err)
exprs = append(exprs, function)
// is true
function, err = NewFunction(mock.NewContext(), ast.IsTruthWithoutNull, types.NewFieldType(mysql.TypeLonglong), int32Column)
require.NoError(t, err)
exprs = append(exprs, function)
function, err = NewFunction(mock.NewContext(), ast.IsTruthWithoutNull, types.NewFieldType(mysql.TypeLonglong), float32Column)
require.NoError(t, err)
exprs = append(exprs, function)
function, err = NewFunction(mock.NewContext(), ast.IsTruthWithoutNull, types.NewFieldType(mysql.TypeLonglong), decimalColumn)
require.NoError(t, err)
exprs = append(exprs, function)
// is true with null
function, err = NewFunction(mock.NewContext(), ast.IsTruthWithNull, types.NewFieldType(mysql.TypeLonglong), int32Column)
require.NoError(t, err)
exprs = append(exprs, function)
function, err = NewFunction(mock.NewContext(), ast.IsTruthWithNull, types.NewFieldType(mysql.TypeLonglong), float32Column)
require.NoError(t, err)
exprs = append(exprs, function)
function, err = NewFunction(mock.NewContext(), ast.IsTruthWithNull, types.NewFieldType(mysql.TypeLonglong), decimalColumn)
require.NoError(t, err)
exprs = append(exprs, function)
// is false, note seems there is actually no is_false_with_null, so unable to add ut for it
function, err = NewFunction(mock.NewContext(), ast.IsFalsity, types.NewFieldType(mysql.TypeLonglong), int32Column)
require.NoError(t, err)
exprs = append(exprs, function)
function, err = NewFunction(mock.NewContext(), ast.IsFalsity, types.NewFieldType(mysql.TypeLonglong), float32Column)
require.NoError(t, err)
exprs = append(exprs, function)
function, err = NewFunction(mock.NewContext(), ast.IsFalsity, types.NewFieldType(mysql.TypeLonglong), decimalColumn)
require.NoError(t, err)
exprs = append(exprs, function)

// DayOfMonth
function, err = NewFunction(mock.NewContext(), ast.DayOfMonth, types.NewFieldType(mysql.TypeDatetime), datetimeColumn)
Expand Down
2 changes: 2 additions & 0 deletions expression/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,8 @@ func scalarExprSupportedByFlash(function *ScalarFunction) bool {
tipb.ScalarFuncSig_LeastInt, tipb.ScalarFuncSig_LeastReal:
return true
}
case ast.IsTruthWithNull, ast.IsTruthWithoutNull, ast.IsFalsity:
return true
}
return false
}
Expand Down

0 comments on commit 106aab9

Please sign in to comment.