Skip to Content
CypherData TypesOverview

Overview

Basic data types

Flavius support the following data types:

Data TypeAliasDescriptionStorage SizeMin ValueMax Value
BOOLEANBOOLBoolean1 ByteN/AN/A
BIGINT-64-bit signed integer8 Bytes-92233720368547758089223372036854775807
DOUBLE-Double precision floating point number8 Bytes-1.7976931348623157E+3081.7976931348623157E+308
VARCHAR-UTF-8 valid stringN/AN/AN/A
TIME-Time with nanosecond precision8 Bytes’00:00:00.000000000''23:59:59.999999999’
DATE-Date in the format ‘YYYY-MM-DD’4 Bytes’0001-01-01''9999-12-31’
DATETIME-Date + Time with nanosecond precision8 Bytes’1677-09-21T00:12:44.999999999''2262-04-11T23:47:16.854775807’
TIMESTAMP-Date + Time with nanosecond precision + timezone8 Bytes’1677-09-21T00:12:44.999999999+0000''2262-04-11T23:47:16.854775807+0000’

Structured data types

Flavius support the following structured data types:

Data TypeAliasDescriptionExample
ARRAYLISTCollection of values of the same type[1, 2, 3], ['a', 'b', 'c'], [true, false]
STRUCT-Collection of values of different types{name: 'John', age: 30, active: true}

Graph specific data types

Flavius support the following graph specific data types:

Data TypeAliasDescriptionExample
Vertex-Vertex/Node structure, has two built in fields, __id__ of BIGINT type to represent the internal id of this node, __label__ of VARCHAR type describing the associated node label.{name:'John', age: 30, active: true, __id__ : 12345, __label__ : }
Edge-Edge/Relationship structure, has three built-in fields: __srcid__ of BIGINT type representing the source vertex ID, __dstid__ of BIGINT type representing the destination vertex ID, and __label__ of VARCHAR type describing the edge label{__srcid__: 1, __dstid__: 2, __label__: "KNOWS", since: "2023"}

Casting

Casting rules

Flavius supports implicit and explicit type casting between different data types. The following table shows the supported type casting operations:

From TypeTo TypeImplicitExplicitNotes
BOOLEANVARCHARConverts to ‘true’ or ‘false’ string
BOOLEANBIGINTConverts to 1 (true) or 0 (false)
BOOLEANDOUBLEConverts to 1.0 (true) or 0.0 (false)
BIGINTBOOLEANConverts to false (0) or true (other values)
BIGINTDOUBLEMay lose precision
BIGINTVARCHARConverts to string representation
DOUBLEBOOLEANConverts to false (0.0) or true (other values)
DOUBLEBIGINTMay lose precision
DOUBLEVARCHARConverts to string representation
VARCHARBOOLEANOnly ‘true’/‘false’ (case-insensitive)
VARCHARBIGINTMust be valid integer string
VARCHARDOUBLEMust be valid numeric string
VARCHARDATEMust be in format ‘YYYY-MM-DD’
VARCHARTIMEMust be in format ‘HH:MM:SS[.nnnnnnnnn]‘
VARCHARDATETIMEMust be in format ‘YYYY-MM-DD HH:MM:SS[.nnnnnnnnn]‘
VARCHARTIMESTAMPMust be in format ‘YYYY-MM-DD HH:MM:SS[.nnnnnnnnn][+-]HH:MM’ or ‘YYYY-MM-DD HH:MM:SS[.nnnnnnnnn][Z]’ , example: 2024-12-23 23:49:23+0800
TIMEVARCHARConverts to ‘YYYY-MM-DD’ format
DATEVARCHARConverts date to string in ‘YYYY-MM-DD’ format
DATEDATETIMEAdds default time component ‘00:00:00.000000000’ to date
DATETIMESTAMPAdds default time ‘00:00:00.000000000’ and UTC timezone to date
DATETIMEVARCHARConverts datetime to string in ‘YYYY-MM-DD[ T]HH:MM:SS[.nnnnnnnnn]’ format
DATETIMEDATEExtracts date part only
DATETIMETIMESTAMPAdds UTC timezone
TIMESTAMPVARCHARConverts timestamp to string in ‘YYYY-MM-DD[ T]HH:MM:SS[.nnnnnnnnn][Z]’ format
TIMESTAMPDATEExtracts date part only
TIMESTAMPDATETIMERemoves timezone information

Explicit casting by CAST expression

Syntax

CAST(<value> AS <type>)

Example:

-- Convert string to date CAST('2023-01-01' AS DATE); -- Convert boolean to integer CAST(true AS BIGINT); -- Convert datetime to timestamp CAST('2023-01-01 12:00:00' AS TIMESTAMP); -- Convert array of strings to array of integers CAST(['1', '2', '3'] AS ARRAY<BIGINT>);
Last updated on