Data Types
ArcadeDB supports several data types natively. Below is the complete table.
| Type | SQL type | Description | Java type | Minimum — Maximum | Auto-conversion from/to |
|---|---|---|---|---|---|
Boolean |
BOOLEAN |
Handles only the values True or False |
|
0 — 1 |
String |
Integer |
INTEGER |
32-bit signed Integers |
|
-2,147,483,648 — +2,147,483,647 |
Any Number, String |
Short |
SHORT |
Small 16-bit signed integers |
|
-32,768 — 32,767 |
Any Number, String |
Long |
LONG |
Big 64-bit signed integers |
|
-263 — +263-1 |
Any Number, String |
Float |
FLOAT |
Decimal numbers |
|
2-149 — (2-2-23)*2127 |
Any Number, String |
Double |
DOUBLE |
Decimal numbers with high precision |
|
2-1074 — (2-2-52)*21023 |
Any Number, String |
Datetime |
DATETIME |
Any date with the precision up to milliseconds. To know more about it, look at Managing Dates |
|
Date, Long, String |
|
String |
STRING |
Any string as alphanumeric sequence of chars |
|
||
Binary |
BINARY |
Can contain any value as byte array |
|
0 — 2,147,483,647 |
String |
Embedded |
EMBEDDED |
The Record is contained inside the owner. The contained record has no RID |
|
EmbeddedDocument |
|
Embedded list |
LIST |
The Records are contained inside the owner. The contained records have no RIDs and are reachable only by navigating the owner record |
|
0 — 41,000,000 items |
String |
Embedded map |
MAP |
The Records are contained inside the owner as values of the entries, while the keys can only be Strings. The contained records have no RIDs and are reachable only by navigating the owner Record |
|
0 — 41,000,000 items |
|
Link |
LINK |
Link to another Record. It’s a common one-to-one relationship |
|
1:-1 — 32767:263-1 |
String |
Byte |
BYTE |
Single byte. Useful to store small 8-bit signed integers |
|
-128 — +127 |
Any Number, String |
Decimal |
DECIMAL |
Decimal numbers without rounding |
|
Any Number, String |
|
Vector |
ARRAY_OF_? |
Vector of scalar types: SHORTS, INTEGERS, LONGS, FLOATS, DOUBLES. A full type is for example then ARRAY_OF_FLOATS |
Tuples |
Embedded types, like EMBEDDED (document), (embedded) LIST, and (embedded) MAP are non-scalar types.
|
A vector type can be either LIST OF SHORT|INTEGER|LONG|FLOAT|DOUBLE or ARRAY_OF_SHORTS|INTEGERS|LONGS|FLOATS|DOUBLES.
|
When serializing floating point types FLOAT and DOUBLE to JSON, NaN, Inf, and -Inf are cast to null.
|
Embedded MAP vs EMBEDDED Document
A MAP type and an EMBEDDED type are both a hierarchy of key-value pairs (think JSON);
but the EMBEDDED type needs to know which document type it is an instance of.
Hence, to embed a document, a document type needs to be declared beforehand,
such that upon embedding validity of constrains (if existing) can be checked.
The embedded type is taken from either of two places:
-
a
@typeproperty in the value’s top-level, naming an existing document type, or -
the property’s own declared embedded type, when the property was created with one (
CREATE PROPERTY Person.address EMBEDDED OF Address).
If the property declares an embedded type, a plain map is enough and you do not have to repeat @type:
person.set("address", Map.of("city", "Rome"));
A @type in the value still takes precedence where present, which is how you store a subtype of the declared one.
If neither is available, the value is rejected.