Skip to content

Commit

Permalink
[parser] parser: support builtin function SOUNDEX (#1161)
Browse files Browse the repository at this point in the history
* add soundex

* add unit test
  • Loading branch information
clark1013 authored and ti-chi-bot committed Oct 9, 2021
1 parent ef95ffa commit 85c41d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions parser/ast/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ const (
CharacterLength = "character_length"
FindInSet = "find_in_set"
WeightString = "weight_string"
Soundex = "soundex"

// information functions
Benchmark = "benchmark"
Expand Down
2 changes: 2 additions & 0 deletions parser/ast/functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ func (ts *testFunctionsSuite) TestFuncCallExprRestore(c *C) {
{"weight_string(a as character(5))", "WEIGHT_STRING(`a` AS CHAR(5))"},
{"weight_string(a as binary(5))", "WEIGHT_STRING(`a` AS BINARY(5))"},
{"hex(weight_string('abc' as binary(5)))", "HEX(WEIGHT_STRING(_UTF8MB4'abc' AS BINARY(5)))"},
{"soundex(attr)", "SOUNDEX(`attr`)"},
{"soundex('string')", "SOUNDEX(_UTF8MB4'string')"},
}
extractNodeFunc := func(node Node) Node {
return node.(*SelectStmt).Fields.Fields[0].Expr
Expand Down

0 comments on commit 85c41d1

Please sign in to comment.