Numeric Types
| Type |
Description |
Literals or constructor function |
Decimal<precision> |
Signed 64-byte decimal number. A fixed number of bits that depend
on the specified precision are reserved for the decimal part. If you
do not specify the precision, it applies 4 digits by default to the
right of the decimal point. This type is suitable for monetary
calculations as it is not prone to rounding errors, unlike
Float. The character d
suffixes literals. |
1.23d |
Float |
Signed 64-bit floats. |
1.23, 1.23E-9 |
Integer |
Signed 64-bit integer. |
123 |
Date/Time Types
| Type |
Description |
Literals or constructor function |
Date |
A date (year, month, day). You can use the following properties
with this type:
year
month
quarter
weekOfYear
day
dayOfWeek
epochDay
|
Date.of |
DateTime |
A date-time with timezone and millisecond precision (year, month,
day, hour, minute, second, millisecond, timezone). You can use the
following properties with this type:
year
month
quarter
weekOfYear
day
dayOfWeek
epochDay
hour
minute
second
|
DateTime.of |
LocalDateTime |
A date-time with second precision (year, month, day, hour,
minute, second) and without timezone. You can use the following
properties with this type:
year
month
quarter
weekOfYear
day
dayOfWeek
epochDay
hour
minute
second
|
LocalDateTime.of |
Duration |
An amount of time expressed in seconds. You can use the
following property with this type:
seconds |
Duration.of |
Instant |
A timestamp representing the number of nanoseconds that have
elapsed since 00:00:00 UTC on 1 January 1970. |
Instant.ofEpochNano |
Period |
A span of time expressed in years, months, and days. You can
use the following properties with this type: |
Period.of |
Character Types
| Type |
Description |
Literals or constructor function |
String |
A sequence of characters. You can use the following property
with this type: length
|
"abc", "\u263A"
(unicode) |
TextMatch |
Represents the result of text matching functions. |
TextMatch.at |
Enum<"x", "y", ...> |
An enum specifies an explicit set of values a data can take. For
example, the type Enum<"low", "medium",
"high"> declares a variable or a parameter
accepting only three possible values: "low", "medium", or
"high".
The enum type has 2 properties:
ordinal: returns the index of the member.
For example, given a variable value: Enum<"low",
"medium", "high"> = "medium",
value.ordinal returns
1.
length: returns the string length of the
member. For example, given a variable value:
Enum<"low", "medium", "high"> = "medium",
value.length returns
6.
Enum has several benefits:
- Type safety: For example, given a list of type
List<Enum<"ON", "OFF">>, writing
list.indexOf("off") becomes
invalid.
- Code clarity: You can explicitly describe the set of values
accepted by a parameter.
- Performance: Internally, enums are encoded as ordinals
(integers), instead of strings.
- Enum timeseries: you can use enums in timeseries
TimeSeries<Enum<...>>.
|
|
Boolean Type
| Type |
Description |
Literals or constructor function |
Boolean |
Boolean |
true / false |
Binary Types
| Type |
Description |
Literals or constructor function |
Binary |
Opaque byte array. |
No constructor |
Geometry |
A vector geometry object (point, polygon, ...), represented in a
well-known binary format (WKB). |
Geo.fromWkt |
Collection Types
| Type |
Description |
Literals or constructor function |
Embedding (collection of floats) |
An embedding is a float vector (an array of 32-bits floats) that
encodes the meaning of a concept such as a word, a text, an image,
... Vectors that are "close" to each other normally represent
similar concepts in meaning. A similarity function gives
the proximity between two vectors. The Semantic Graph Index supports three similarity functions: cosine, dot product, and
Euclidean. |
Embedding.of |
List<E> |
An ordered collection. You can access elements by their
index. You can use the following properties with this
type: You can either use a trailing comma in a list. For example,
expressions accept the following kind of list: [
"John",
"Smith",
] Rationale: You can add or remove entries from a
list without the hassle of removing the trailing comma on the
last entry. |
["foo","bar"] |
Map<K, V> |
Key/value dictionary. You can use any type as either key or
value.
Map keys (that is, K) cannot be
NULL.
You can use the following properties with this type:
length
keys
values
entries
You can either use a trailing comma in a map. For example,
expressions accept the following kind of map: [
"John": 32,
"Jack": 24,
] Rationale: You can add or remove entries from a map
without the hassle of removing the trailing comma on the last
entry.
|
["foo" : p1.age, p2.name : 15] |
Set<E> |
Unordered collection with uniqueness guarantee. You can use the
following properties with this type: |
Set.of(["foo", "bar"]) |
TimeSeries<T> (collection of points) |
A timeseries is a series of data points (each data point is the
association of a timestamp and a numerical/string value) in time
order. You can use the following properties with this type: |
List.toTimeSeries |
Composite Types
| Type |
Description |
Literals or constructor function |
Item<pkg.class> |
Represents an item coming from an index unit. |
No constructor |
Range |
Represents two bounds, which can be inclusive or exclusive. A
bound can extend to a positive or a negative infinity. A range
supports the following types: Integer,
Decimal, Float,
Date, DateTime,
LocalDateTime,
Instant. You can use the following
properties with this type: |
0..10 // [0,10]
0..<10 // [0,10)
..10 // (-∞,10]
10.. // [10,∞)
|
Tuple<K1: V1, K2: V2, ...> |
An object that encapsulates values of multiple types. It must
contain an ordered list of entries.
Define each entry with a name (tuple names must not contain any
blank spaces) and a type.
For example, the type Tuple<firstname: String, age:
Integer> defines a tuple that encapsulates a
value of type String and a value of type
Integer, along with their first name and
age accessors.
You can either use a trailing comma in a tuple. For example,
expressions accept the following kind of tuple: {
firstName: "John",
lastName: "Doe",
}Rationale: You can add or remove entries from a
tuple without the hassle of removing the trailing comma on the
last entry.
|
{age: 15, name: "Francis"} |
JSON Type
| Type |
Description |
Literals or constructor function |
JSON |
Queries support a robust Json data processing, using the
JSON type and its associated operators:
- The
JSON.parse(String) function returns a
JSON value.
- Bracket notation access on a
JSON value:
JSON[field] and
JSON[index].
- Type checking and casting with
IS and
AS operators, to convert
JSON to Integer,
Float, Decimal,
String, and
Boolean.
- Json object and array utility methods
(
JSON.isArray(),
JSON.arrayLength(),
JSON.isObject(),
JSON.fieldNames()...)
|
JSON.parse("...")For more information, see
Json Manipulation. |
Other Types
| Type |
Description |
Literals or constructor function |
Any |
Any type. |
|
Comparable |
Any type that you can use to sort on (Integer,
Float, String,
Date, DateTime, and
Duration).
You typically use this type in a SORT or a
RANK operator.
|
|
Function<ParameterType1, ...,
ReturnType> |
Lambda function. |
foo => foo.age > 21 |
Null |
Type used forNULL value when required. |
NULL |
|