You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/02/07 11:12:06 UTC

[GitHub] [calcite] XuQianJin-Stars commented on a change in pull request #1768: [CALCITE-3704] Implement STRCMP function

XuQianJin-Stars commented on a change in pull request #1768: [CALCITE-3704] Implement STRCMP function
URL: https://github.com/apache/calcite/pull/1768#discussion_r376338376
 
 

 ##########
 File path: site/_docs/reference.md
 ##########
 @@ -2350,6 +2350,7 @@ semantics.
 | m o p | SOUNDEX(string)                            | Returns the phonetic representation of *string*; throws if *string* is encoded with multi-byte encoding such as UTF-8
 | m | SPACE(integer)                                 | Returns a string of *integer* spaces; returns an empty string if *integer* is less than 1
 | o | SUBSTR(string, position [, substringLength ]) | Returns a portion of *string*, beginning at character *position*, *substringLength* characters long. SUBSTR calculates lengths using characters as defined by the input character set
+| m | STRCMP(string, string)                         | Returns 0 if both of the strings are same and returns -1 when the first argument is smaller than the second according to the defined order and 1 when the second one is smaller the first one.
 
 Review comment:
   > Is the `defined order` customizable ?
   
   I noticed that this function of mysql can change the character set. as follows:
   mysql> SET @s1 = _utf8mb4 'x' COLLATE utf8mb4_0900_ai_ci;
   mysql> SET @s2 = _utf8mb4 'X' COLLATE utf8mb4_0900_ai_ci;
   mysql> SET @s3 = _utf8mb4 'x' COLLATE utf8mb4_0900_as_cs;
   mysql> SET @s4 = _utf8mb4 'X' COLLATE utf8mb4_0900_as_cs;
   mysql> SELECT STRCMP(@s1, @s2), STRCMP(@s3, @s4);
   +------------------+------------------+
   | STRCMP(@s1, @s2) | STRCMP(@s3, @s4) |
   +------------------+------------------+
   |                0 |               -1 |
   +------------------+------------------+

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services