नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
Applies to:
Databricks SQL
Databricks Runtime
Splits str around occurrences that match regex and returns an array with a length of at most limit.
Syntax
split(str, regex [, limit] )
Arguments
str: ASTRINGexpression to be split.regexp: ASTRINGexpression that is a Java regular expression used to splitstr.limit: An optionalINTEGERexpression defaulting to 0 (no limit).
Returns
An ARRAY<STRING>.
If limit > 0: The resulting array's length will not be more than limit, and the resulting array's last entry will contain all input beyond the last matched regex.
If limit <= 0: regex will be applied as many times as possible, and the resulting array can be of any size.
Examples
> SELECT split('oneAtwoBthreeC', '[ABC]');
[one,two,three,]
> SELECT split('oneAtwoBthreeC', '[ABC]', -1);
[one,two,three,]
> SELECT split('oneAtwoBthreeC', '[ABC]', 2);
[one,twoBthreeC]
> SELECT split('oneAtwoBthreeC' COLLATE UTF8_BINARY, '[abc]');
[oneAtwoBthreeC]
> SELECT split('oneAtwoBthreeC' COLLATE UTF8_LCASE, '[abc]');
[one,two,three,]