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.
|
An equality lookup (=, <>, IN) on a FLOAT or DOUBLE property converts the operand to the property’s type, with or without an index. A FLOAT holding 0.1 is therefore found by the double 0.10000000149011612 (what you get by reading the FLOAT back as a double), and a DOUBLE is found by the BigDecimal that rounds to it. Ordering (<, >) is unchanged and reads a FLOAT by its decimal value, so a value can satisfy both = and < against the same operand.
|
A write to a declared property is refused, with an error naming the property, when the value cannot be held by the type: a boolean, list, map or date for a numeric property, an empty string for a numeric property, a number outside the 64-bit range for a LONG (or a finite number that overflows a FLOAT or DOUBLE), an empty or digit-only string for a DATETIME, a string for a BINARY, a non-link value for a LINK, or an array for a STRING. A STRING holding a lone UTF-16 surrogate (for example "\uD83D", which cannot be encoded as UTF-8) is refused with a validation error instead of being stored as ? (since v26.10.1). Such a value is never stored as NULL, 0 or as a value of another type, with or without an index. A number written to a BOOLEAN is false only when it is 0.
|
A java.math.BigInteger written to a property with no declared type keeps its exact value: inside the 64-bit range it is stored as an INTEGER or LONG, outside it as a DECIMAL (it reads back as a BigDecimal with the same digits), never as a rounded DOUBLE.
|
Equality lookups give the same answer with or without an index. Two DECIMAL values are equal when they have the same numeric value, whatever their scale (19.9 equals 19.90). A DATETIME property is matched by a java.time.Instant, ZonedDateTime or OffsetDateTime of the same moment. A BOOLEAN property is matched by true/false as a string or by a number (0 is false, anything else is true); an operand that does not read as a boolean matches nothing.
|
When serializing floating point types FLOAT and DOUBLE to JSON, NaN, Inf, and -Inf are cast to null, wherever they appear, including inside lists and arrays (before v26.10.1 a non-finite value inside a list was written as 0) (since v26.10.1).
|
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.