Slice array(切片数组 (Slice array))¶
Supported in: Batch, Faster, Streaming
Returns the array sliced from the first position to the second position. First position must be 1 or higher. If second position is longer than the array, the entire rest of the array will be returned.
Expression categories: Array
Declared arguments¶
- Expression: Array to slice.
Expression\> - Slice begins: Array index start at 1, or from the end if start is negative. If this value is zero, expression will throw an error.
Expression\ - Slice length: The length of the slice. If the slice length goes beyond the end of the array, the entire rest of the array will be returned.
Expression\
Type variable bounds: T accepts AnyType
Output type: Array\
Examples¶
Example 1: Base case¶
Argument values:
- Expression:
array - Slice begins:
sliceBegins - Slice length:
sliceLength
| array | sliceBegins | sliceLength | Output |
|---|---|---|---|
| [ hello, world, out, there ] | 1 | 2 | [ hello, world ] |
| [ hello, world, out, there ] | 2 | 2 | [ world, out ] |
| [ hello, world, out, there ] | 1 | 0 | [ ] |
| [ hello, world, out, there ] | 2 | 10 | [ world, out, there ] |
| [ hello, world, out, there ] | -1 | 2 | [ there ] |
Example 2: Null case¶
Argument values:
- Expression:
array - Slice begins:
sliceBegins - Slice length:
sliceLength
| array | sliceBegins | sliceLength | Output |
|---|---|---|---|
| [ hello, world, out, there ] | 0 | 1 | null |
| [ hello, world, out, there ] | 0 | 0 | null |
| [ hello, world, out, there ] | 1 | -1 | null |
| [ ] | 1 | 2 | [ ] |
| [ null, null ] | 1 | 1 | [ null ] |
中文翻译¶
切片数组 (Slice array)¶
支持:批处理 (Batch)、快速处理 (Faster)、流处理 (Streaming)
返回从第一个位置到第二个位置切片的数组。第一个位置必须为 1 或更大。如果第二个位置超出数组长度,则返回数组的剩余全部内容。
表达式类别: 数组 (Array)
声明的参数¶
- 表达式 (Expression): 要切片的数组。
表达式\<数组\> - 切片起始 (Slice begins): 数组索引从 1 开始,若起始值为负数,则从末尾开始计数。如果该值为零,表达式将抛出错误。
表达式\<整数> - 切片长度 (Slice length): 切片的长度。如果切片长度超出数组末尾,则返回数组的剩余全部内容。
表达式\<整数>
类型变量边界: T 接受任意类型 (AnyType)
输出类型: 数组\
示例¶
示例 1:基本情况¶
参数值:
- 表达式:
array - 切片起始:
sliceBegins - 切片长度:
sliceLength
| array | sliceBegins | sliceLength | 输出 |
|---|---|---|---|
| [ hello, world, out, there ] | 1 | 2 | [ hello, world ] |
| [ hello, world, out, there ] | 2 | 2 | [ world, out ] |
| [ hello, world, out, there ] | 1 | 0 | [ ] |
| [ hello, world, out, there ] | 2 | 10 | [ world, out, there ] |
| [ hello, world, out, there ] | -1 | 2 | [ there ] |
示例 2:空值情况¶
参数值:
- 表达式:
array - 切片起始:
sliceBegins - 切片长度:
sliceLength
| array | sliceBegins | sliceLength | 输出 |
|---|---|---|---|
| [ hello, world, out, there ] | 0 | 1 | null |
| [ hello, world, out, there ] | 0 | 0 | null |
| [ hello, world, out, there ] | 1 | -1 | null |
| [ ] | 1 | 2 | [ ] |
| [ null, null ] | 1 | 1 | [ null ] |