All Data Types
Category |
Supported Types | Supported by Property |
---|---|---|
Numerical | int32、int64、uint32、uint64、float、double、decimal | Yes |
Textual | string、text | Yes |
Temporal | datetime、timestamp | Yes |
Spatial | point | Yes |
Binary | blob | Yes |
Boolean | bool | No |
Null | null | No |
Graph Data | NODE、EDGE、PATH | No |
List | list(with elements of the above types) | Yes but only when elements are numerical, textual or temporal except decimal |
Set | set(with elements of the above types except list) | Yes but only when elements are numerical, textual or temporal except decimal |
Object | object | No |
Tabular | TABLE | No |
Data Types of Property
Type | Description |
---|---|
int32 | 4 bytes, with sign |
uint32 | 4 bytes, no sign |
int64 | 8 bytes, with sign |
uint64 | 8 bytes, no sign |
float | 4 bytes, 6 significant digits |
double | 8 bytes, 15 significant digits |
decimal | Precision[1](1~65) and scale[2](0~30) should be specified |
string | The default type when creating property, length <= 60,000 bytes |
text | No limit on length |
datetime | Valid input formats yyyy-mm-dd hh:mm:ss and yyyy-mm-dd hh:mm:ss.ssssss , valid range from '1000-01-01 00:00:00.000000' to '9999-12-31 23:59:59.499999', stored as an uint64 |
timestamp | Valid input formats are yyyy-mm-dd hh:mm:ss , yyyy-mm-dd , yyyymmddhhmmss and yyyymmdd , stored as an uint32 that equals the number of seconds from '1970-01-01 00:00:00 UTC' onwards, the time zone could be set via RequestConfig of the desired SDK |
point | Geographical coordinates or 2D coordinates, where the key value is recorded as double |
blob | Binary format of file, image, audio and video, length subject to the max_rpc_msgsize (by default 4M) of the server setting |
list | int32[]、int64[]、uint32[]、uint64[]、float[]、double[]、string[]、text[]、datetime[]、timestamp[] |
set | set(int32)、set(int64)、set(uint32)、set(uint64)、set(float)、set(double)、set(string)、set(text)、set(datetime)、set(timestamp) |
[1]Precision is the sum of the lengths of integers and decimals, excluding the point
[2]Scale is the lenght of decimals
Data Types of RETURN
Type |
Data Structure |
---|---|
NODE | {id: , uuid: , schema: , values: {...}} |
EDGE | {uuid: , schema: , from: , from_uuid: , to: , to_uuid: , values: {...}} |
PATH | {length: , nodes: [...], edges: [...]} |
TABLE | {name: , headers: [...], rows: [...]} |
ATTR | Other than the above four types |
Examples:
The NODE structure of Alice in the above chart:
{
"id": "STU001",
"uuid": 1,
"schema": "student",
"values": {
"name": "Alice",
"age": 25
}
}
The EDGE structure in the above chart:
{
"uuid": 53,
"schema": "studyAt",
"from": "STU001",
"to": "UNV001",
"from_uuid": 1,
"to_uuid": 1001,
"values": {
"start": 2001,
"end": 2005
}
}
The PATH structure representing 'Alice studies at Oxford' in the above chart:
{
"length": 1,
"nodes": [{
"id": "STU001",
"uuid": 1,
"schema": "student",
"values": {
"name": "Alice",
"age": 25
}
}, {
"id": "UNV001",
"uuid": 1001,
"schema": "university",
"values": {
"name": "Oxford"
}
}],
"edges": [{
"uuid": 53,
"schema": "studyAt",
"from": "STU001",
"to": "UNV001",
"from_uuid": 1,
"to_uuid": 1001,
"values": {
"start": 2001,
"end": 2005
}
}]
}
Consider a tabular structure with alias group_stats:
| group_name | count |
|------------|-------|
| green | 5 |
| red | 1 |
| yellow | 2 |
The TABLE structure is:
{
"name": "group_stats",
"headers": ["group_name", "count"],
"rows": [
["green", 5],
["red", 1],
["yellow", 2]
]
}
Regarding how to specify a valid return format in RETURN clause, please read the table at the end of documentation RETURN.
About NULL
null
is produced when:
- inserting a new metadata (
insert()
、insert().overwrite()
), those properties not provided will benull
- creating a new property under a schema, this property of those metadata that already exist will be
null
- returning a non-existent property in a RETURN clause,
null
will be returned - no result found for a query (
find()
、khop()
、template) that uses prefix OPTIONAL, the metadata returned will benull
When null
participates in a conditional judgement and if:
- it is sure about the result, then return this result
- it is NOT sure about the result, then return
null
Expression | Result |
Explanation |
---|---|---|
null == 3 |
null |
It's not sure about the result of comparing null with 3, so return null. Same result returns for operators != , < , > , >= , <= |
null == null |
null |
It's not sure. Same result for operators != , < , > , >= , <= |
[1, null , 2] == [1, 3, 2] |
null |
It's not sure. Same result for operator != |
[1, null , 2] == [1, null , 2] |
null |
It's not sure. Same result for operator != |
[1, null , 2] == [1, null , 3] |
false | It's sure since 2 and 3 are different. Return true for operator != |
[1, null , 2] == [1, null , 2, 3] |
false | It's sure since lengths of two lists are different. Return true for operator != |
null <> [1, 3] |
null |
It's not sure. Same result for operator <=> |
1 IN [1, null , 2] |
true | It's sure since 1 does exist in the list. Returns false for operator NOT IN |
3 IN [1, null , 2] |
null |
It's not sure. Same result for operator NOT IN |
null IN [ ] |
false | It's sure since the list is empty. Returns true for operator NOT IN |
Any numerical computation (+
, -
, *
, /
, %
) participated by null
will return null
.
Any aggregation operation (count()
, sum()
, max()
, min()
, avg()
, stddev()
, collect()
) participated by null
will ignore the rows with null
.
Regarding functions and operators related with null
please read documentations coalesce(),ifnull(),IS NULL,IS NOT NULL.