From ea5ca22294a732378a0850e7ce350080d1169b52 Mon Sep 17 00:00:00 2001 From: clark1013 Date: Thu, 28 Jan 2021 16:47:06 +0800 Subject: [PATCH] [parser] parser: support builtin function SOUNDEX (#1161) * add soundex * add unit test --- parser/ast/functions.go | 1 + parser/ast/functions_test.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/parser/ast/functions.go b/parser/ast/functions.go index d543f060a72f3..94f1b24950302 100644 --- a/parser/ast/functions.go +++ b/parser/ast/functions.go @@ -229,6 +229,7 @@ const ( CharacterLength = "character_length" FindInSet = "find_in_set" WeightString = "weight_string" + Soundex = "soundex" // information functions Benchmark = "benchmark" diff --git a/parser/ast/functions_test.go b/parser/ast/functions_test.go index 69d664aab8e56..8a8b7a59fa790 100644 --- a/parser/ast/functions_test.go +++ b/parser/ast/functions_test.go @@ -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