---
title: "split()"
component: "gsql-ref"
version: "4.3"
module: "ddl-and-loading"
html_url: "/gsql-ref/4.3/ddl-and-loading/functions/token/split"
canonical_url: "https://www.tigergraph.com/docs/gsql-ref/4.3/ddl-and-loading/functions/token/split"
markdown_url: "https://www.tigergraph.com/docs/gsql-ref/4.3/ddl-and-loading/functions/token/split.md"
---

[View as HTML](https://www.tigergraph.com/docs/gsql-ref/4.3/ddl-and-loading/functions/token/split)

# 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 `SET` or `LIST` attribute

### Load a `MAP` attribute

* Data file 1
* Data file 2
* Loading job

[Download one\_key\_value.csv](https://www.tigergraph.com/docs/gsql-ref/4.3/ddl-and-loading/_attachments/one_key_value.csv)

Example data with one key-value pair per line

```text
vid,key_value
v1,1:mike
v2,2:tom
v1,3:lucy
```

[Download multi\_key\_value.csv](https://www.tigergraph.com/docs/gsql-ref/4.3/ddl-and-loading/_attachments/multi_key_value.csv)

Example data with multiple key-value pairs per line

```text
vid,key_value_list
v1,1:mike#4:lin
v2,2:tom
v1,3:lucy#1:john#6:jack
```

Loading a MAP by SPLIT() function

```gsql
CREATE VERTEX v_map  (PRIMARY_ID id STRING, att_map MAP<INT, STRING>)
CREATE GRAPH Test_Graph (*)
CREATE LOADING JOB load_map FOR GRAPH Test_Graph {
    DEFINE FILENAME f;
    LOAD f TO VERTEX v_map  VALUES ($0, SPLIT($1, ":", "#"));
}
```
