The read-only analysis engine currently supports most MySQL string functions, but there are still limitations and incompatibilities in some scenarios. This document introduces the supported list of string functions in the read-only analysis engine and lists the type limitations in input parameters. Input parameters and functions not mentioned in the document are not supported.
Supported String Functions
substr Function
The string extraction function can be used in the following ways.
Syntax: substr(str, start)
Supported value types for str: char and varchar data.
Supported value types for start: bigint, double, and decimal.
Syntax: substr(str from start)
Supported value types for str: char and varchar data.
Supported value types for start: bigint, double, and decimal.
Syntax: substr(string, start, length)
Supported value types for str: char and varchar data.
Supported value types for start: bigint, double, and decimal.
Supported value types for length: bigint, double, and decimal.
Syntax: substr(string from start for length)
Supported value types for str: char and varchar data.
Supported value types for start: bigint, double, and decimal.
Supported value types for length: bigint, double, and decimal.
char_length Function
Decision function for string length, which returns the number of characters in a string.
Syntax: char_length(str)
Supported value types for str: char and varchar data.
replace Function
String replacement function.
Syntax: replace(str, from_str, to_str)
Supported value types for str: char and varchar data.
Supported value types for from_str: char and varchar data.
Supported value types for to_str: char and varchar data.
concat Function
String connection function.
Syntax: concat(str1, str2, ...)
Supported value types for str1: char and varchar data.
Supported value types for str2: char and varchar data.
concat_ws Function
String connection function with separators.
Syntax: concat_ws(str1, str2, ...)
Supported value types for str1: char and varchar data.
Supported value types for str2: char and varchar data.
left Function
Return the specified number of characters starting from the first character of the string.
Syntax: left(str, len)
Supported value types for str1: char and varchar data.
Supported value types for len: int, bigint, double, and decimal data.
right Function
Return the specified number of characters starting from the last character of the string.
Syntax: right(str, len)
Supported value types for str1: char and varchar data.
Supported value types for len: int, bigint, double, and decimal data.
ascii Function
Function that converts characters into ascii code values.
Syntax: ascii(str)
Supported value types for str1: char and varchar data.
length Function
Function that determines string length and returns the number of bytes in a string.
Syntax: length(str)
Supported value types for str1: char and varchar data.
trim Function
Function that removes unnecessary characters before and after a string.
Syntax: trim([{BOTH | LEADING | TRAILING} [remstr] FROM] str)
Supported value types for remstr: char and varchar data.
Supported value types for str: char and varchar data.
ltrim Function
Remove unnecessary characters before a string.
Syntax: ltrim(str)
Supported value types for str: char and varchar data.
rtrim Function
Remove unnecessary characters after a string.
Syntax: rtrim(str)
Supported value types for str: char and varchar data.
position Function
Return the function corresponding to the position of the substring.
Syntax: position(substr IN str)
Supported value types for str: char and varchar data.
Supported value types for substr: char and varchar data.
instr Function
Search for the position of the first occurrence of a string in another string.
Syntax: instr(str, substr)
Supported value types for str: char and varchar data.
Supported value types for substr: char and varchar data.
locate Function
Return the position of the first occurrence of a substring in a string.
Syntax: locate(str, substr)
Supported value types for str: char and varchar data.
Supported value types for substr: char and varchar data.
lower Function
Return the lowercase string of a string.
Syntax: lower(str)
Supported value types for str: char and varchar data.
ucase Function
Convert all lowercase letters in a given string to uppercase letters.
Syntax: ucase(str)
Supported value types for str: char and varchar data.
upper Function
Convert all lowercase letters in a given string to uppercase letters.
Syntax: upper(str)
Supported value types for str: char and varchar data.
substring_index Function
Support reverse string extraction functions.
Syntax: substring_index(str, delim, count)
Supported value types for str: char and varchar data.
Supported value types for delim: char and varchar data types. It can only be a constant, and variable values such as field values, are not accepted.
Supported value types for count: int, bigint, double, and decimal data types. It supports negative numbers. It can only be a constant and variable values such as field values are not accepted.
lpad Function
Pad the beginning of a string to achieve the specified length.
Syntax: lpad(str, len, padstr)
Supported value types for str: char and varchar data.
Supported value types for len: int, bigint, double, and decimal data. It can only be a constant and variable values like field values are not accepted.
Supported value types for padstr: char and varchar data.
rpad Function
Pad the end of a string to achieve the specified length.
Syntax: rpad(str, len, padstr)
Supported value types for str: char and varchar data.
Supported value types for len: int, bigint, double, and decimal data. It can only be a constant.
Supported value types for padstr: char and varchar data.
strcmp Function
Compare two strings and return an integer based on the comparison result.
Syntax: strcmp(expr1, expr2)
Supported value types for expr1: char and varchar data.
Supported value types for expr2: char and varchar data.
quote Function
Function that references a string containing special characters in a query.
Syntax: quote(str)
Supported value types for str: char and varchar data.
find_in_set Function
Function that locates the corresponding character in the string. Currently, only strlist is supported as a string type, and the set type is not supported.
Syntax: find_in_set(str,strlist)
str: string to be queried.
The strlist field name parameter is separated by a comma (,). Example: (1,2,6,8).
field Function
Function that sorts the query result set in SQL in the specified order.
Syntax: field(str,str2,...)
str: string value specified to be sorted from left to right.
uuid Function
It is used to generate a random 36-bit snowflake ID.
Syntax: uuid()
Input parameters are not required.