# split()

The SPLIT() function reads a compound token and splits it into a collection of elements, to form a set or list collection, or a map.

## Syntax

• `split(column, separator)`

• `split(column, separator, [sub_separator])`

## Parameters

The function can split a column to load to a map attribute or a set/list attribute.

When it loads data to a set/list attribute:

column

Required. The index or the name of the column to split.

separator

Required. The separator by which to split the values in the column.

When it loads data into a map attribute:

column

Required. The index or the name of the column to split.

separator

Required. The separator that splits the key-value pairs in the column. For example. if the key-value pair in the column is formatted like this: `key:value`, then the separator is `:`.

sub_separator

Required only when the column has multiple key-value pairs separated by a sub separator. For example, if the column has values such as `key1:value1,key2:value2`, then `sub_separator` is `,`.

## Examples

### Load a `MAP` attribute

• Data file 1

• Data file 2

Example data with one key-value pair per line
``````vid,key_value
v1,1:mike
v2,2:tom
v1,3:lucy``````
Example data with multiple key-value pairs per line
``````vid,key_value_list
v1,1:mike#4:lin
v2,2:tom
v1,3:lucy#1:john#6:jack``````
``````CREATE VERTEX v_map  (PRIMARY_ID id STRING, att_map MAP<INT, STRING>)
LOAD f TO VERTEX v_map  VALUES ($0, SPLIT($1, ":", "#"));