Skip to content

Text Functions

concat

Syntaxconcat(S1,S2,S3...)
Parameter DescriptionString type parameters; the number of parameters is variable, requiring at least 1 parameter
Return TypeString
DescriptionConcatenates multiple parameters into a single text string. For example: concat('abc', 123) returns a string: 'abc123'
Examplesconcat('abc', 123, 'hello') returns: 'abc123hello'
concat('abc', 123) returns: 'abc123'

initcap

Syntaxinitcap(S)
Parameter DescriptionString type parameter
Return Value TypeString
DescriptionFormats the specified string by capitalizing the first letter of each word and converting other letters to lowercase
Exampleinitcap('hello world'), returns: 'Hello World'
Unsupported Data Sourcestidb, mongodb

length

Syntaxlength(S)
ParameterString type parameter
Return TypeNumber
DescriptionCalculates the length of a string
Examplelength('hello'), returns: 5

like

Syntaxlike(S, LITERAL_PATTERN)
Parameter Description1. String type parameter, optional type: STRING;
2. Specified pattern, optional type: STRING
Return TypeBoolean
DescriptionSpecifies whether a field contains a specific string
Examplelike('hello world', 'world'), returns: TRUE

like_all

Syntaxlike_all(S,LITERAL_PATTERN_LIST)
Parameter Description1. String type parameter, optional type: STRING;
2. Specified pattern list, optional type: list of strings
Return TypeBoolean
DescriptionSpecifies that the field contains all items in the specified string list
Examplelike_all('hello world', ['world','ello']), returns: TRUE

like_any

Syntaxlike_any(S, LITERAL_PATTERN_LIST)
Parameter Description1. String type parameter, optional type: STRING;
2. Specified pattern list, optional type: string list
Return TypeBoolean
DescriptionSpecifies whether the field contains any item from the given string list
Examplelike_any('hello world', ['world','abcd']), returns: TRUE

like_ci

Syntaxlike_ci(S,LITERAL_PATTERN)
Parameter Description1. String type parameter, optional type: STRING;
2. Specified pattern, optional type: STRING
Return TypeBoolean
DescriptionSpecifies whether the field contains a specific string, case-insensitive
Examplelike_ci('hello world', 'World'), returns: TRUE

like_ci_all

Syntaxlike_ci_all(S,LITERAL_PATTERN_LIST)
Parameter Description1. String type parameter, optional type: STRING;
2. Specified pattern list, optional type: string list
Return TypeBoolean
DescriptionSpecifies that the field contains all items in the given string list, case-insensitive
Examplelike_ci_all('hello world', ['World','ello']), returns: TRUE

like_ci_any

Syntaxlike_ci_any(S, LITERAL_PATTERN_LIST)
Parameter Description1. String type parameter, optional type: STRING;
2. Specified pattern list, optional type: string list
Return TypeBoolean
DescriptionChecks if the specified field contains any item from the given string list, case-insensitive
Examplelike_ci_any('hello world', ['World','abcd']), returns: TRUE

lower

Syntaxlower(S)
ParameterString type parameter
Return TypeString
DescriptionConverts all characters of the specified string to lowercase
Examplelower('HELLO'), returns: 'hello'

ltrim

Syntaxltrim(s1, s2)
Parameters1. String type parameter;
2. Specifies the string to be removed
Return TypeString
DescriptionSearches for content in the beginning of the s1 string that matches the s2 string. The search stops when the content no longer matches the s2 string, and the matched content is removed. Example: ltrim('abcbabca','ab'), the result is cbabca
Exampleltrim('abcbabca','ab'), returns: 'cbabca'

position

Syntaxposition(S, PATTERN)
Parameter Description1. The string to search;
2. The substring
Return TypeNumber
DescriptionRetrieves the position of the first occurrence of the substring in the specified string
Exampleposition('hello world', 'world'), returns: 7

regexp_extract

Syntaxregexp_extract(s, regexp, index)
Parameter Description1. String type parameter;
2. Regular expression, optional type: string;
3. Desired string index, optional type: number
Return TypeString
DescriptionSplits the string s according to the rules of the regular expression regexp and returns the character specified by index.
Exampleregexp_extract('hello123world', '(\d+)', 1), returns: '123'
Unsupported Data SourcesNone (Supported data sources: Athena, Doris, Postgresql, Spark, Hive, Hologres, Impala, Presto)

regexp_match

Syntaxregexp_match(s, regexp)
Parameters1. String type parameter;
2. Regular expression, optional type: string
Return TypeBoolean
DescriptionDetermines whether the string s matches the regular expression regexp pattern. Returns TRUE if the match is successful, otherwise returns FALSE.
Exampleregexp_match('hello123', '\d+'), returns: TRUE

regexp_replace

Syntaxregexp_replace(s, regexp, replacement)
Parameter Description1. String type parameter;
2. Regular expression, optional type: string;
3. New string
Return TypeString type
DescriptionReplaces characters in the string s that match the regular expression regexp with the specified string replacement
Exampleregexp_replace('hello123world', '\d+', ''), returns: 'helloworld'

replace

Syntaxreplace(s,s1,s2)
Parameter Description1. String type parameter;
2. Original string;
3. New string
Return TypeString
DescriptionReplace a string. Usage: replace(s, s1, s2), s2 replaces all occurrences of s1 in s
Examplereplace('hello world', 'world', 'there'), returns: 'hello there'

rtrim

Syntaxrtrim(s1, s2)
Parameters1. String type parameter;
2. Specifies the string to be removed
Return TypeString
DescriptionStarting from the end of the s1 string, it searches backward for content matching the s2 string. The search stops when the content no longer matches the s2 string, and the matched content is removed. Example: rtrim('abadcdabab','ab') returns abadcd
Examplertrim('abadcdabab','ab'), returns: 'abadcd'

split

Syntaxsplit(s, delimiter, n)
Parameter Description1. String type parameter;
2. Delimiter, optional type: string;
3. Desired string index, optional type: number
Return TypeString
DescriptionSplits the string s by the delimiter delimiter and returns the nth (starting from 1) split string. For example, split('abc,abc,abcdef',',',3) returns the string abcdef.
Examplesplit('abc,abc,abcdef',',',3) returns: 'abcdef'

to_string

Syntaxto_string(ARG)
ParameterArgument of any type
Return TypeString
DescriptionConverts the input field or value into a string
Exampleto_string(123), returns: '123'

trim

Syntaxtrim(S)
ParameterString type parameter
Return TypeString
DescriptionRemoves leading and trailing spaces from a string
Exampletrim(' hello '), returns: 'hello'

upper

Syntaxupper(S)
ParametersString type parameter
Return TypeString
DescriptionConverts all characters of the specified string to uppercase
Exampleupper('hello'), returns: 'HELLO'

unlike

Syntaxunlike(S, LITERAL_PATTERN)
Parameter Description1. String type parameter;
2. Specified pattern, optional type: string
Return TypeBoolean
DescriptionSpecifies that the field does not contain a particular string
Exampleunlike('hello world', 'test'), returns: TRUE

unlike_ci

Syntaxunlike_ci(S,LITERAL_PATTERN)
Parameter Description1. String type parameter;
2. Specified pattern, optional type: string
Return TypeBoolean
DescriptionSpecifies that the field does not contain a particular string, case-insensitive
Exampleunlike_ci('hello world', 'HE'), returns: FALSE

User Manual for Hengshi Analysis Platform