Value from map(从映射中获取值)¶
Supported in: Batch, Faster, Streaming
Get a value from a map using a key.
Expression categories: Map
Declared arguments¶
- Key: Key expression.
Expression\ - Map: Map expression.
Expression\
Type variable bounds: K accepts ComparableType**V accepts AnyType
Output type: V
Examples¶
Example 1: Base case¶
Argument values:
- Key: [ 1 ]
- Map: {
[ 1 ] -> Foo,
}
Output: Foo
Example 2: Base case¶
Argument values:
- Key: Bar
- Map: {
Bar -> 2,
Foo -> 1,
}
Output: 2
Example 3: Base case¶
Argument values:
- Key: 1
- Map: {
1 -> 10,
2 -> 20,
}
Output: 10
Example 4: Base case¶
Argument values:
- Key: Foo
- Map: {
Bar -> World,
Foo -> Hello,
}
Output: Hello
Example 5: Base case¶
Argument values:
- Key: Foo
- Map: {
Bar -> World,
}
Output: null
Example 6: Base case¶
Argument values:
- Key: [ [ 1 ], [ 1 ] ]
- Map: {
[ [ 1 ], [ 1 ] ] -> Foo,
}
Output: Foo
Example 7: Null case¶
Argument values:
- Key:
key - Map:
map
| map | key | Output |
|---|---|---|
| null | null | null |
| { Foo -> Hello, } |
null | null |
| null | Foo | null |
中文翻译¶
从映射中获取值¶
支持:批处理(Batch)、快速处理(Faster)、流处理(Streaming)
使用键从映射(Map)中获取值。
表达式类别: 映射(Map)
声明的参数¶
- 键(Key): 键表达式。
表达式\ - 映射(Map): 映射表达式。
表达式\
类型变量约束: K 接受 ComparableType**V 接受 AnyType
输出类型: V
示例¶
示例 1:基本情况¶
参数值:
- 键(Key): [ 1 ]
- 映射(Map): {
[ 1 ] -> Foo,
}
输出: Foo
示例 2:基本情况¶
参数值:
- 键(Key): Bar
- 映射(Map): {
Bar -> 2,
Foo -> 1,
}
输出: 2
示例 3:基本情况¶
参数值:
- 键(Key): 1
- 映射(Map): {
1 -> 10,
2 -> 20,
}
输出: 10
示例 4:基本情况¶
参数值:
- 键(Key): Foo
- 映射(Map): {
Bar -> World,
Foo -> Hello,
}
输出: Hello
示例 5:基本情况¶
参数值:
- 键(Key): Foo
- 映射(Map): {
Bar -> World,
}
输出: null
示例 6:基本情况¶
参数值:
- 键(Key): [ [ 1 ], [ 1 ] ]
- 映射(Map): {
[ [ 1 ], [ 1 ] ] -> Foo,
}
输出: Foo
示例 7:空值情况¶
参数值:
- 键(Key):
key - 映射(Map):
map
| map | key | 输出(Output) |
|---|---|---|
| null | null | null |
| { Foo -> Hello, } |
null | null |
| null | Foo | null |