当前位置:网站首页>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);
边栏推荐
- 华为S5700交换机初始化和配置SSH和TELNET远程登录方法
- Technical dry goods | Bert model for the migration of mindspore NLP model - text matching task (2): training and evaluation
- Unity one click AssetBundle
- the installer has encountered an unexpected error installing this package
- Luaframwrok handles resource updates
- Quality blog——
- L'installateur a été installé avec une erreur inattendue
- Structure of golang
- My touch screen production "brief history" 1
- E: 无法定位软件包 ros-melodic-desktop-full
猜你喜欢
Worldview satellite remote sensing image data / meter resolution remote sensing image
【cocos creator】点击按钮切换界面
【LeetCode】2. Valid parentheses · valid parentheses
IP production stream is so close to me
Docker installs MySQL and successfully uses Navicat connection
My touch screen production "brief history" 1
[untitled]
Professor Zhang Yang of the University of Michigan is employed as a visiting professor of Shanghai Jiaotong University, China (picture)
[MySQL 12] MySQL 8.0.18 reinitialization
Research shows that breast cancer cells are more likely to enter the blood when patients sleep
随机推荐
Huawei switch console password reset, device initialization, default password
[MySQL 13] if you change your password for the first time after installing mysql, you can skip MySQL password verification to log in
Pat class a 1030 travel plan
What does (+) in Oracle mean
WPF:解决MaterialDesign:DialogHost 无法关闭问题
Professor Zhang Yang of the University of Michigan is employed as a visiting professor of Shanghai Jiaotong University, China (picture)
Ilruntime learning - start from scratch
Worldview satellite remote sensing image data / meter resolution remote sensing image
Transfinite hacker cognition
Lua framwrok framework starts
Getting started with minicom
Research shows that breast cancer cells are more likely to enter the blood when patients sleep
PHP常用排序算法
Generate video using clipout in viz engine
[MySQL 11] how to solve the case sensitive problem of MySQL 8.0.18
Pat class a 1028 list sorting
Redis批量启停脚本
Technical dry goods | Bert model for the migration of mindspore NLP model - text matching task (2): training and evaluation
Docker installs MySQL and successfully uses Navicat connection
【cocos creator】获取资源uuid