System information functions¶
System information functions return details about NebulaGraph Database Developer Edition in persistent graphs and temporary graphs.
The following functions return system information.
typeof()¶
Returns the type of the input value.
Null behavior: general
Function signature¶
typeof(input: E) -> STRING
E represents any value type, including ordinary value types, graph element reference types, and table types.
Examples¶
Get predefined data types¶
'''
RETURN typeof(1) AS a,
typeof("hello") AS b,
typeof(null) AS c,
typeof(true) AS d,
typeof(CAST(1.5 AS UINT64)) AS e,
typeof(zoned_datetime("2011-03-04T11:06:08Z")) AS f,
typeof(duration({years:100, months:1}) ) AS g,
typeof(VECTOR<3,float>([1.1,2.1,3.1])) AS h
'''
Return:
+-------+--------+------+------+--------+---------------+----------+------------------+
| a | b | c | d | e | f | g | h |
+-------+--------+------+------+--------+---------------+----------+------------------+
| INT32 | STRING | NULL | BOOL | UINT64 | ZONEDDATETIME | DURATION | VECTOR<3, FLOAT> |
+-------+--------+------+------+--------+---------------+----------+------------------+
Get constructed data types¶
'''
RETURN typeof([1,2,3]) AS a,
typeof({a:1, b:true}) AS b,
typeof(SET {"a", "b", "c"}) AS c,
typeof(MAP{"a":1, "b":2}) AS d
'''
Return:
+-------------+-------------------------+-------------+--------------------+
| a | b | c | d |
+-------------+-------------------------+-------------+--------------------+
| LIST<INT32> | RECORD{a INT32, b BOOL} | SET<STRING> | MAP<STRING, INT32> |
+-------------+-------------------------+-------------+--------------------+
Get graph element reference types¶
'''
USE movie
MATCH p = (a@Actor)-[e]->(b@Movie)
RETURN typeof(p) AS p_type, typeof(a) AS a_type, typeof(e) AS e_type
LIMIT 1
'''
Return:
+--------+---------------+------------------------------+
| p_type | a_type | e_type |
+--------+---------------+------------------------------+
| PATH | Node<(Actor)> | Edge<(Actor)-[Act]->(Movie)> |
+--------+---------------+------------------------------+
Get a table type¶
'''
TABLE t TYPED TABLE { id INT64, name STRING } =
{ id: 10001, name: 'Alice' },
{ id: 10002, name: 'Bob' }
RETURN typeof(t) AS t_type
'''
Return:
+-------------------------------+
| t_type |
+-------------------------------+
| TABLE {id INT64, name STRING} |
+-------------------------------+