当前位置:网站首页>Maxcompute string splitting function -split_ PART
Maxcompute string splitting function -split_ PART
2022-07-03 08:00:00 【The dawn of victory】
Grammar format
string split_part(string <str>, string <separator>, bigint <start>[, bigint <end>])
Function description
According to the separator separator Split string str, Return from start Part to end Substring of part ( Closed interval ).
Parameter description
- str: Required .STRING type . The string to be split . If it is BIGINT、DOUBLE、DECIMAL or DATETIME type , Will be implicitly converted to STRING Participate in the operation after type .
- separator: Required .STRING Type constant . Separator for splitting , It can be a character , It can also be a string .
- start: Required .BIGINT Type constant , Must be greater than 0. Indicates the start number of the returned segment ( from 1 Start ).
- end:BIGINT Type constant , Greater than or equal to start. Indicates the end number of the returned segment , Omission , By default, it means and start The values are equal , return start Specified segment .
Return value description
return STRING type . The return rule is as follows :
- If start The value of is greater than the actual number of segments after segmentation , For example, there is 6 A fragment ,start Greater than 6, Return to empty string .
- If separator There is no in str in , And start Designated as 1, Back to the whole str. If str For the empty string , Then an empty string is output .
- If separator For the empty string , Return the original string str.
- If end Greater than the number of fragments , Return from start The starting substring .
- str Not STRING、BIGINT、DOUBLE、DECIMAL or DATETIME Type , Return error .
- separator Not STRING Type constant , Return error .
- start or end Not BIGINT Type constant , Return error .
- except separator Outside , If any parameter value is NULL, return NULL.
Examples of use
Example 1: According to the separator , Split string a,b,c,d, Returns the substring of the specified part . An example command is as follows .
-- return a.
select split_part('a,b,c,d', ',', 1);
-- return a,b.
select split_part('a,b,c,d', ',', 1, 2);
Example 2:start The value of is greater than the actual number of segments after segmentation . An example command is as follows .
-- Return to empty string .
select split_part('a,b,c,d', ',', 10);
Example 3:separator There is no in str in . An example command is as follows .
-- return a,b,c,d.
select split_part('a,b,c,d', ':', 1);
-- Return to empty string .
select split_part('a,b,c,d', ':', 2);
Example 4:separator For the empty string . An example command is as follows .
-- return a,b,c,d.
select split_part('a,b,c,d', '', 1);
Example 5:end The value of is greater than the actual number of segments after segmentation . An example command is as follows .
-- return b,c,d.
select split_part('a,b,c,d', ',', 2, 6);
Example 6: except separator Outside , Any input parameter is NULL. An example command is as follows .
-- return NULL.
select split_part('a,b,c,d', ',', null);
边栏推荐
- P2622 关灯问题II(状态压缩 搜索)
- 【LeetCode】4. Best time to buy and sell stock
- 超限黑客认知
- Open the influence list of "National Meteorological Short Videos (Kwai, Tiktok) in November" in an interactive way“
- Redis查看客户端连接
- L'installateur a été installé avec une erreur inattendue
- Technical dry goods | some thoughts on the future of AI architecture
- JSON与Object之间转换
- Zohocrm deluge function application time verification
- the installer has encountered an unexpected error installing this package
猜你喜欢

What is a data type? What is the use of data types?

Zohocrm deluge function application time verification

Getting started with minicom

freetype库的移植
![[end of 2021] National Meteorological Short Video (Kwai, Tiktok) influence list in December](/img/51/81ceaf8746ec7455ea8abf9f038e81.jpg)
[end of 2021] National Meteorological Short Video (Kwai, Tiktok) influence list in December

Oracle queries grouped by time

C language learning notes (mind map)

Docker installs MySQL and successfully uses Navicat connection

*p++、*++p、++*p、(*p)++

【cocos creator】点击按钮切换界面
随机推荐
How to configure GDAL under idea
Huawei s5700 switch initialization and configuration SSH and telnet remote login methods
VMware virtual machine configuration static IP
Retail philosophy retail psychological warfare after reading -- 7-11 is a good product!
JSON与Object之间转换
Huawei s5700 switch initialization and configuration Telnet, SSH user methods
freetype库的移植
Pycharm remote ssh pyenv error: pydev debugger: warning: trying to add breakpoint to file that does
regular expression
PIP uses image website to solve the problem of slow network speed
Quality blog——
Quelle est la définition? Qu'est - ce qu'une déclaration? Quelle est la différence?
An intern's journey to cnosdb
MaxCompute字符串分割函数-SPLIT_PART
Structure of golang
华为S5700交换机初始化和配置telnet,ssh用户方法
Install cross compiler arm none liunx gnueabihf
一个实习生的CnosDB之旅
Docker installs MySQL and successfully uses Navicat connection
Precautions for opensips and TLS SIP trunk docking