chucheng92 opened a new pull request, #3348:
URL: https://github.com/apache/calcite/pull/3348

   # What is the purpose of the change
   
   current mysql soundex has 2 different behaviors with actual mysql soundex.
   1: mysql soundex return arbitrarily long string
   
   current in calcite:
   ```
   returns an arbitrarily long string
   ```
   
   mysql
   ```
   mysql> SELECT SOUNDEX('Quadratically');
       -> 'Q36324'
   ```
   
   2. if input is multibyte str, calcite cause exception, but mysql return 
result by padding 0 with unmapped chars.
   ```
   mysql> select soundex('字节');
   +-------------------+
   | soundex('字节')   |
   +-------------------+
   | 字000             |
   +-------------------+
   1 row in set (0.00 sec)
   ```
   
   The SqlFunctions#soundexMySQL rewrite the mysql's c++ soundex 
implementation. pls see:
   
https://github.com/mysql/mysql-server/blob/ea1efa9822d81044b726aab20c857d5e1b7e046a/sql/item_strfunc.cc#L2054
   
   
   # Brief change log
   Add a new soundex implementation by rewrite the mysql soundex. 
   
   # Verifying this change
   
   SqlOperatorTests#testMysqlSoundex()
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to