Token Functions for Attribute Expressions
The token functions in this section are used in the attribute expressions in the destination clause of a LOAD
statement.
Function | Output type | Description |
---|---|---|
gsql_reverse(in_string) |
|
Returns a string with the characters in the reverse order of the input string in_string. |
gsql_concat(string1, string2,…,stringN) |
|
Returns a string which is the concatenation of all the input strings. |
gsql_uuid_v4() |
|
Returns a version-4 UUID. |
gsql_split_by_space(in_string) |
|
Returns a modified version of in_string, in which each space character is replaced with ASCII 30 (decimal). |
gsql_substring(str, beginIndex [, length]) |
|
Returns the substring beginning at beginIndex, having the given length. |
gsql_find(str, substr) |
|
Returns the start index of the substring within the string. If it is not found, then return -1. |
gsql_length(str) |
|
Returns the length of the string. |
gsql_replace(str, oldToken, newToken [, max]) |
|
Returns the string resulting from replacing all matching substrings of oldToken with newToken in the original string. If a max count is provided, there can only be up to that many replacements. |
gsql_regex_replace(str, regex, replaceSubstr) |
|
Returns the string resulting from replacing all substrings in the input string that match the given regex token with the substitute string. |
gsql_regex_match(str, regex) |
bool |
Returns true if the given string token matches the given regex token and false otherwise. |
gsql_to_bool(in_string) |
bool |
Returns true if the in_string is either "t" or "true", with case-insensitive checking. Returns false otherwise. |
gsql_to_uint(in_string) |
|
|
gsql_to_int(in_string) |
|
|
gsql_ts_to_epoch_seconds(timestamp) |
|
Converts a timestamp in canonical string format to Unix epoch time, which is the int number of seconds since Jan. 1, 1970. Refer to the timestamp input format note below. |
gsql_current_time_epoch(0) |
|
Returns the current time in Unix epoch seconds. By convention, the input parameter should be 0, but it is ignored. |
flatten (column_to_be_split, group_separator, 1) flatten (column_to_be_split, group_separator, sub_field_separator, number_of_sub_fields_in_one_group) |
Splits a multi-value field into a set of records. Those records are first stored in a temporary table, and then the temporary table can be loaded into vertices and/or edges. |
|
flatten_json_array ($"array_name") flatten_json_array ($"array_name", $"sub_obj_1", $"sub_obj_2", …, $"sub_obj_n") |
Parses a JSON array of primitive values or JSON objects, as well as JSON objects in a column of a CSV file. |
|
split(column_to_be_split, element_separator) split(column_to_be_split, key_value_separator, element _separator) |
Reads a compound token and splits it into a collection of elements, to form a set or list collection, or a map. |
|
gsql_upper(in_string) |
|
Returns the input string in upper-case. |
gsql_lower(in_string) |
|
Returns the input string in lower-case. |
gsql_trim(in_string) |
|
Trims whitespace from the beginning and end of the input string. |
gsql_ltrim(in_string) gsql_rtrim(in_string) |
|
Trims white space from either the beginning or the end of the input string (Left or right). |
gsql_year(timestamp) |
|
Returns 4-digit year from timestamp. |
gsql_month(timestamp) |
|
Returns month (1-12) from timestamp. |
gsql_day(timestamp) |
|
Returns day (1-31) from timestamp. |
gsql_year_epoch(epoch) |
|
Returns 4-digit year from Unix epoch time, which is the number of seconds since Jan. 1, 1970. |
gsql_month_epoch(epoch) |
|
Returns month (1-12) from Unix epoch time, which is the number of seconds since Jan. 1, 1970. |
gsql_day_epoch(epoch) |
|
Returns day (1-31) from Unix epoch time, which is the number of seconds since Jan. 1, 1970. |