Extract Values from a Map
AtScale has a special tool for adding calculated columns that extract key:value pairs from a map.
About this task
A MAP
type column contains a delimited list of key:value pairs. Map
columns are imported into AtScale as STRING
type columns. AtScale does
not support the MAP
data type, but it does have a special calculated
column creation tool for working with strings containing a map. This
tool generates a calculated column formula using the REGEXP_EXTRACT
function.
Procedure
- Locate the dataset on the canvas, and open the dataset preview so you can see the sample values.
- Locate the
STRING
type column that contains map values (a delimited list of key:value pairs). - Locate the column in the dataset, and click the edit icon to open the 'calculated column from map' tool.
note
Note: The 'calculated column from map' tool opens for any STRING type column, regardless if the values are a map or not.
- In the Delimited list, choose the data type for the key, the delimiter character separating a key and a value, the data type for the value, and the delimiter character separating the key:value pairs.
- In the Columns list, enter the name of the key whose value you want to extract, and choose the data type of the new calculated column you are adding.
- (optional) Click Add Column to extract other values from the map. If you click this in error, delete the item from the Columns list.
- Click Save. Confirm that the new calculated columns were added to the dataset.