Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expression: Support push InetAton, InetNtoa, Inet6Aton, and Inet6Nota down to TiFlash #26984

Merged
merged 4 commits into from
Aug 7, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions expression/expr_to_pb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,26 @@ func (s *testEvaluatorSuite) TestExprPushDownToFlash(c *C) {
c.Assert(err, IsNil)
exprs = append(exprs, function)

// InetAton
function, err := NewFunction(mock.NewContext(), ast.InetAton, types.NewFieldType(mysql.TypeString), stringColumn)
c.Assert(err, IsNil)
exprs = append(exprs, function)

// InetNtoa
function, err = NewFunction(mock.NewContext(), ast.InetNtoa, types.NewFieldType(mysql.TypeLonglong), stringColumn)
c.Assert(err, IsNil)
exprs = append(exprs, function)

// Inet6Aton
function, err = NewFunction(mock.NewContext(), ast.Inet6Aton, types.NewFieldType(mysql.TypeString), stringColumn)
c.Assert(err, IsNil)
exprs = append(exprs, function)

// Inet6Ntoa
function, err = NewFunction(mock.NewContext(), ast.Inet6Ntoa, types.NewFieldType(mysql.TypeLonglong), stringColumn)
c.Assert(err, IsNil)
exprs = append(exprs, function)

// ScalarFuncSig_RoundReal
function, err = NewFunction(mock.NewContext(), ast.Round, types.NewFieldType(mysql.TypeDouble), realColumn)
c.Assert(err, IsNil)
Expand Down
3 changes: 2 additions & 1 deletion expression/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,8 @@ func scalarExprSupportedByFlash(function *ScalarFunction) bool {
ast.DateDiff, ast.TimestampDiff, ast.DateFormat, ast.FromUnixTime,
ast.Sqrt, ast.Log, ast.Log2, ast.Log10, ast.Ln, ast.Exp, ast.Pow, ast.Sign,
ast.Radians, ast.Degrees, ast.Conv, ast.CRC32,
ast.JSONLength:
ast.JSONLength,
ast.InetNtoa, ast.InetAton, ast.Inet6Ntoa, ast.Inet6Aton:
return true
case ast.Substr, ast.Substring, ast.Left, ast.Right, ast.CharLength:
switch function.Function.PbCode() {
Expand Down