当前位置:网站首页>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);
边栏推荐
- Professor Zhang Yang of the University of Michigan is employed as a visiting professor of Shanghai Jiaotong University, China (picture)
- 在浏览器输入url后执行什么
- 【LeetCode】3. Merge two sorted lists · merge two ordered linked lists
- JS common basic case sorting (continuous update)
- Pat class a 1028 list sorting
- 华为交换机基础配置(telnet/ssh登录)
- What does (+) in Oracle mean
- [USACO12MAR]Cows in a Skyscraper G(状态压缩dp)
- PHP wechat red packet grabbing algorithm
- 【LeetCode】2. Valid parentheses · valid parentheses
猜你喜欢
the installer has encountered an unexpected error installing this package
Install cross compiler arm none liunx gnueabihf
Technology dry goods | Roberta of the migration of mindspore NLP model - emotion analysis task
璞华PLM为全场景产品生命周期管理赋能,助力产品主线的企业数字化转型
Worldview satellite remote sensing image data / meter resolution remote sensing image
一条通往服务器所有端口的隧道
unity2019_ Input management
An article for you to understand - Manchester code
[MySQL 11] how to solve the case sensitive problem of MySQL 8.0.18
IP production stream is so close to me
随机推荐
Static keyword
the installer has encountered an unexpected error installing this package
tp3.2和tp5.0的区别
[MySQL 13] if you change your password for the first time after installing mysql, you can skip MySQL password verification to log in
Huawei s5700 switch initialization and configuration Telnet, SSH user methods
VMware virtual machine configuration static IP
超限黑客认知
链式长取值
什么是定义?什么是声明?它们有何区别?
华为交换机:配置telnet和ssh、web访问
PostGIS space function
Redis批量启停脚本
I want to do large screen data visualization application feature analysis
Redis view client connection
The general trend of data news releases the power of visual reporting ----- essays after reading
How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03
static关键字
一个实习生的CnosDB之旅
Generate video using clipout in viz engine
Free use until 2015 -- viz artist multi touch plug-in package