morrySnow commented on code in PR #1842: URL: https://github.com/apache/doris-website/pull/1842#discussion_r1919771326
########## docs/sql-manual/sql-functions/scalar-functions/string-functions/cut-to-first-significant-subdomain.md: ########## @@ -24,40 +24,63 @@ specific language governing permissions and limitations under the License. --> - ## Description +The CUT_TO_FIRST_SIGNIFICANT_SUBDOMAIN function extracts the effective part of a domain from a URL, including the top-level domain up to the "first significant subdomain". If the input URL is invalid, it returns an empty string. + ## Syntax -`VARCHAR cut_to_first_significant_subdomain(VARCHAR url)` +```sql +VARCHAR CUT_TO_FIRST_SIGNIFICANT_SUBDOMAIN(VARCHAR url) Review Comment: 不要类型 ```suggestion CUT_TO_FIRST_SIGNIFICANT_SUBDOMAIN(<url>) ``` ########## docs/sql-manual/sql-functions/scalar-functions/string-functions/count_substrings.md: ########## @@ -22,86 +22,89 @@ specific language governing permissions and limitations under the License. --> -## count_substrings +## Description -### description +The COUNT_SUBSTRINGS function counts the number of occurrences of a specified substring within a string. Note: The current implementation continues searching after shifting by the length of the substring when a match is found. For example, when str='ccc' and pattern='cc', the result returned is 1. -#### Syntax +## Syntax -`int count_substrings(STRING str, STRING pattern)` -Returns the total number of occurrences of the substring pattern in the string str. -Note: The current implementation shifts by the length of the pattern after each match in the string. -Therefore, when str: ccc and pattern: cc, the result returned is 1. - -#### Arguments +```sql +COUNT_SUBSTRINGS(str, pattern) Review Comment: 参数需要用尖括号包裹 ```suggestion COUNT_SUBSTRINGS(<str>, <pattern>) ``` ########## docs/sql-manual/sql-functions/scalar-functions/string-functions/count_substrings.md: ########## @@ -22,86 +22,89 @@ specific language governing permissions and limitations under the License. --> -## count_substrings +## Description -### description +The COUNT_SUBSTRINGS function counts the number of occurrences of a specified substring within a string. Note: The current implementation continues searching after shifting by the length of the substring when a match is found. For example, when str='ccc' and pattern='cc', the result returned is 1. -#### Syntax +## Syntax -`int count_substrings(STRING str, STRING pattern)` -Returns the total number of occurrences of the substring pattern in the string str. -Note: The current implementation shifts by the length of the pattern after each match in the string. -Therefore, when str: ccc and pattern: cc, the result returned is 1. - -#### Arguments +```sql +COUNT_SUBSTRINGS(str, pattern) +``` -`str` — The string to be checked. Type: `String` -`pattern` — The substring to be matched. Type: `String` +## Parameters +| Parameter | Description | +| --------- | --------------------------------------- | +| str | The string to be searched. Type: STRING | +| pattern | The substring to match. Type: STRING | Review Comment: ```suggestion | `<str>` | The string to be searched. Type: STRING | | `<pattern>` | The substring to match. Type: STRING | ``` ########## docs/sql-manual/sql-functions/scalar-functions/string-functions/strright.md: ########## @@ -25,43 +25,81 @@ under the License. --> -## strright -### Description -#### Syntax +## Description -`VARCHAR strright (VARCHAR str, INT len)` +The STRRIGHT function returns a specified number of characters from the right side of a string. The length is measured in UTF8 characters. +## Alias -It returns the right part of a string of specified length, length is char length not the byte size. Another alias for this function is `right`. -If the parameters contain a NULL value, the function will always return NULL. If the integer parameter is negative, the function will retrieve the portion of the string starting from the left and moving to the right, beginning at the absolute value of len. +RIGHT -### example +## Syntax +```sql +VARCHAR STRRIGHT(VARCHAR str, INT len) ``` -mysql> select strright("Hello doris",5); + +## Parameters +| Parameter | Description | +| --------- | --------------------------------------------- | +| str | The string to extract from. Type: VARCHAR | +| len | The number of characters to return. Type: INT | + +## Return Value + +Returns VARCHAR type, representing the extracted substring. + +Special cases: +- Returns NULL if any argument is NULL +- If len is negative, returns the substring starting from the abs(len)th character from the right +- Returns the entire string if len is greater than the string length + +## Examples + +1. Basic usage +```sql +SELECT strright('Hello doris', 5); +``` +```text +-------------------------+ | strright('Hello doris', 5) | +-------------------------+ | doris | +-------------------------+ -mysql> select strright("Hello doris",-7); +``` + +2. Handling negative length +```sql +SELECT strright('Hello doris', -7); +``` +```text +--------------------------+ | strright('Hello doris', -7) | +--------------------------+ | doris | +--------------------------+ -mysql> select strright("Hello doris",NULL); +``` + +3. Handling NULL parameter +```sql +SELECT strright('Hello doris', NULL); +``` +```text +----------------------------+ | strright('Hello doris', NULL) | +----------------------------+ | NULL | +----------------------------+ -mysql> select strright(NULL,5); +``` + +4. Handling NULL string +```sql +SELECT strright(NULL, 5); +``` +```text +----------------+ | strright(NULL, 5) | +----------------+ | NULL | +----------------+ Review Comment: 这个结果表格有点儿问题?101行,表格出去了 -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org