You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by dz...@apache.org on 2021/06/24 05:21:27 UTC
[drill] 13/26: DRILL-7928: [DOC-UPDATE] Add doc for split_part
(#2229)
This is an automated email from the ASF dual-hosted git repository.
dzamo pushed a commit to branch gh-pages
in repository https://gitbox.apache.org/repos/asf/drill.git
commit a4a149b2f044621c3813a6f206de85de9058e606
Author: leon <32...@qq.com>
AuthorDate: Wed Jun 2 01:37:34 2021 +0800
DRILL-7928: [DOC-UPDATE] Add doc for split_part (#2229)
* add doc for split_part
---
.../sql-functions/040-string-manipulation.md | 23 +++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/_docs/sql-reference/sql-functions/040-string-manipulation.md b/_docs/sql-reference/sql-functions/040-string-manipulation.md
index 376832f..7e30515 100644
--- a/_docs/sql-reference/sql-functions/040-string-manipulation.md
+++ b/_docs/sql-reference/sql-functions/040-string-manipulation.md
@@ -520,13 +520,14 @@ The _delimiter_ must not be null and must contain a single character.
|------------------------------------|
## SPLIT_PART
-Return the string part at _index_ after splitting the input string using the specified delimiter.
+Return the string part at _start_ or from _start_ to _end_ after splitting the input string using the specified delimiter.
### SPLIT_PART Syntax
- SPLIT_PART(string, delimiter, index)
+ SPLIT_PART(string, delimiter, start[, end])
### SPLIT_PART Usage Notes
-The _delimiter_ string may be multiple characters long. The _index_ must be a positive integer.
+The _delimiter_ string may be multiple characters long. The _start_ must be a positive integer.
+The _end_ must be greater than or equal to _start_ if provided.
### SPLIT_PART Examples
@@ -537,7 +538,23 @@ The _delimiter_ string may be multiple characters long. The _index_ must be a p
|--------|
| fox |
|--------|
+
+ SELECT split_part('The | quick | brown | fox | jumps', ' | ', 4, 5);
+ |--------------|
+ | EXPR$0 |
+ |--------------|
+ | fox | jumps |
+ |--------------|
+
+ SELECT split_part('The | quick | brown | fox | jumps', ' | ', 4, 10);
+
+ |--------------|
+ | EXPR$0 |
+ |--------------|
+ | fox | jumps |
+ |--------------|
+
## STRPOS
Returns the location of the first occurrence of a substring of the input
string, or 0 if the substring does not occur.