n and a text sequence, then splits the sequence into
overlapping contiguous subsequences of length n.
Syntax
Parameters
Return Types
ARRAY(TEXT)
- If any of the inputs is nullable, the result type is
ARRAY(TEXT) NULL.
Behavior
The function splits the input text into overlapping contiguous subsequences of lengthn.
- If
nis smaller than the size of the input text, an array containing the single value of the input text is returned. - If
nis smaller than 1, an error is thrown. - If any input is
NULL, the result isNULLregardless of the other input value.
Errors
An error is thrown ifn is smaller than 1.
Respect/Ignore Nulls
Propagates nulls: If any input isNULL, the result is NULL.
Examples
The following example generates 2-grams (bigrams) from the string ‘hello world’:Rows: 1Execution time: 5.56ms
Rows: 1Execution time: 5.68ms
Rows: 1Execution time: 5.62ms
Rows: 1Execution time: 5.08ms
Rows: 1Execution time: 5.10ms
Rows: 1Execution time: 5.69ms