跳到主要内容

MAP_PICK

Introduced or updated: v1.2.654

Returns a new MAP containing the specified key-value pairs from an existing MAP.

Syntax

MAP_PICK( <map>, <key1> [, <key2>, ... ] )
MAP_PICK( <map>, <array> )

Arguments

ArgumentsDescription
<map>The input MAP.
<keyN>The KEYs to be included from the returned MAP.
<array>The Array of KEYs to be included from the returned MAP.
备注
  • The types of the key expressions and the keys in the map must be the same.
  • Key values not found in the map will be ignored.

Return Type

Map.

Examples

SELECT MAP_PICK({'a':1,'b':2,'c':3}, 'a', 'c');
┌─────────────────────────────────────────┐
│ map_pick({'a':1,'b':2,'c':3}, 'a', 'c')
├─────────────────────────────────────────┤
│ {'a':1,'c':3} │
└─────────────────────────────────────────┘

SELECT MAP_PICK({'a':1,'b':2,'c':3}, ['a', 'b']);
┌───────────────────────────────────────────┐
│ map_pick({'a':1,'b':2,'c':3}, ['a', 'b'])
├───────────────────────────────────────────┤
│ {'a':1,'b':2} │
└───────────────────────────────────────────┘
开始使用 Databend Cloud
低成本
快速分析
多种数据源
弹性扩展
注册