Data Types
TimeBase on one hand is a schema-oriented time-series database, where the principle of introspection allows using classes of the selected language as schemas. On the other hand, you can take advantage of a sophisticated data modeling capabilities of the system, Luminary IDL, complex messaging format evolution and versioning, and the natural ability to store large volumes of time-series and heterogeneously structured messages.
You can use several ways of specifying field data types, as well as hints for encoding values for transmission and persistence. Main benefit of such a diversity is a more native representation of user's data model.
TimeBase supports special compressed encodings for small alphanumeric codes, which allows data items to appear as text, while it is internally stored in extremely compressed form. Examples of alphanumeric codes include exchange codes, currency codes, liquidity provider codes, or any similar codes the user wishes to define.
INTEGER
The INTEGER
data type represents a 64-bit numeric. INTEGERs can be constrained by specifying the minimum and maximum values. TimeBase offers a variety of encodings for the INTEGER data type.
info
Refer to Annotations for more information on data types mappings.
Encoding | # Bytes | Min | Max | Description |
---|---|---|---|---|
SIGNED (8) | 1 | -127 | 127 | A signed 8-bit value. |
SIGNED (16) | 2 | -32,767 | 32,767 | A signed 16-bit value. |
SIGNED (32) | 4 | -231 | 231 | A signed 32-bit value. |
SIGNED (48) | 6 | -247 | 247 | A signed 48-bit value. |
SIGNED (64) | 8 | -263 | 263 | A signed 64-bit value. This encoding can be omitted in field specifications, because it is the default for the INTEGER data type. |
UNSIGNED (30) | 1 .. 4 | 0 | 230 - 2 | A packed unsigned 30-bit value. The smaller the number, the less space it occupies. |
UNSIGNED (61) | 1 .. 8 | 0 | 261 - 2 | A packed unsigned 61-bit value. The smaller the number, the less space it occupies. |
INTERVAL | 1 .. 5 | 1 | 231 | A non-zero value between 1 and 231, with optimal encoding for representing time intervals in milliseconds. |
CLASS "epam.rtc.timebase.samples.IntegerMessage" 'Sample Integer Message' (
"int_c_8" 'Non-nullable INTEGER:INT8' INTEGER NOT NULL SIGNED (8),
"int_n_8" 'Nullable INTEGER:INT8' INTEGER SIGNED (8),
"int_c_16" 'Non-nullable INTEGER:INT16' INTEGER NOT NULL SIGNED (16),
"int_n_16" 'Nullable INTEGER:INT16' INTEGER SIGNED (16),
"int_c_32" 'Non-nullable INTEGER:INT32' INTEGER NOT NULL SIGNED (32),
"int_n_32" 'Nullable INTEGER:INT32' INTEGER SIGNED (32),
"int_c_64" 'Non-nullable INTEGER:INT64' INTEGER NOT NULL SIGNED (64),
"int_n_64" 'Nullable INTEGER:INT64' INTEGER SIGNED (64),
"puint_c_30" 'Non-nullable INTEGER:PUINT30' INTEGER NOT NULL UNSIGNED (30),
"puint_n_30" 'Nullable INTEGER:PUINT30' INTEGER UNSIGNED (30),
"puint_c_61" 'Non-nullable INTEGER:PUINT61' INTEGER NOT NULL UNSIGNED (61),
"puint_n_61" 'Nullable INTEGER:PUINT61' INTEGER UNSIGNED (61)
)
CHAR/VARCHAR
The CHAR
data type represents a single Unicode character. The VARCHAR
data type represents a variable size string (text). An empty string is different from the NULL
value.
info
Refer to Annotations for more information on data types mappings.
VARCHAR Encoding | Max Length | # Bytes | Description |
---|---|---|---|
UTF8 | 64,534 | 2 + length * (1 .. 4) | A Unicode string is up to 64,534 characters long, encoded in UTF8. This encoding can be omitted in field specifications, because it is the default for the VARCHAR data type. |
ALPHANUMERIC (n) | n | ~0.75 * n | This encoding is highly optimized for storing small alphanumeric codes, such as typical currency or exchange codes. Strings that can be represented by this encoding are limited in length to n and can only be composed of characters whose ASCII codes are between 0x20 and 0x5F, inclusively. This includes the space character, [A-Z], [0-9] and !"#$%&'()*+,-./:;<=>?@[\]^_. Note, that lower-case letters are not supported. |
ALPHANUMERIC | 10 | 8 | Equivalent to ALPHANUMERIC (10). |
Name | # Bytes |
---|---|
CHAR | 1 |
CLASS "epam.rtc.timebase.samples.VarcharMessage" 'Sample Varchar Message' (
"char_c" 'Non-nullable CHAR' CHAR NOT NULL,
"char_n" 'Nullable CHAR' CHAR,
"varchar_c_utf8" 'Non-nullable VARCHAR:UTF8' VARCHAR NOT NULL,
"varchar_n_utf8" 'Nullable CHAR:UTF8' VARCHAR,
"varchar_c_alpha10" 'Non-nullable VARCHAR:ALPHANUMERIC(10):long' VARCHAR NOT NULL,
"varchar_n_alpha10" 'Nullable VARCHAR:ALPHANUMERIC(10):long' VARCHAR,
"varchar_c_alpha5_s" 'Non-nullable VARCHAR:ALPHANUMERIC(5)' VARCHAR NOT NULL,
"varchar_n_alpha5_s" 'Nullable VARCHAR:ALPHANUMERIC(5)' VARCHAR
)
BINARY
The BINARY
data type can be used for storing arbitrary raw data.
Name | # Bytes |
---|---|
BINARY | Up to 4,194,304 bytes |
info
Refer to Annotations for more information on data types mappings.
CLASS "epam.rtc.timebase.samples.BinaryMessage" 'Sample Binary Message' (
"raw_data" BINARY
)
FLOAT
The FLOAT
data type represents a floating-point number. FLOAT can be constrained by specifying the the minimum and maximum values.
info
Refer to Annotations for more information on data types mappings.
Encoding | # Bytes | Range | Description |
---|---|---|---|
BINARY (32) IEEE32 | 4 | ±3.4 * 1038 | Single-precision number, encoded according to IEEE 754 binary32 format. |
BINARY (64) IEEE64 | 8 | ±1.8 * 10308 | Double-precision number, encoded according to IEEE 754 binary64 format. This encoding can be omitted in field specifications, because it is the default for the FLOAT data type. |
DECIMAL | 2 .. 9 | ±1.8 * 10308 | A decimal floating-point number, encoded with automatically chosen precision. This encoding works best with smaller decimal numbers, such as 24.25 or 1234.5556. |
DECIMAL (n) | 2 .. 9 | ±1.8 * 10308 | A decimal floating-point number, encoded with user-defined precision n, where n represents the number of fractional digits. This encoding works best with smaller decimal numbers, such as 24.25 or 1234.5556. Numbers are rounded at encoding time to the specified number of fractional decimal digits. n can be between 0 .. 14, inclusively. |
DECIMAL64 | 8 | ±0.000000000000000×10−383 to ±9.999999999999999×10384 | See DECIMAL(64) to learn more. Can be used by both LONG and DOUBLE data types. |
CLASS "epam.rtc.timebase.samples.FloatMessage" 'Sample Float Message' (
"float_c_32" 'Non-nullable FLOAT:IEEE32' FLOAT NOT NULL BINARY (32),
"float_n_32" 'Nullable FLOAT:IEEE32' FLOAT BINARY (32),
"float_c_64" 'Non-nullable FLOAT:IEEE64' FLOAT NOT NULL BINARY (64),
"float_n_64" 'Nullable FLOAT:IEEE64' FLOAT BINARY (64),
"float_c_dec" 'Non-nullable FLOAT:DECIMAL' FLOAT NOT NULL DECIMAL,
"float_n_dec" 'Nullable FLOAT:DECIMAL' FLOAT DECIMAL,
"float_c_dec2" 'Non-nullable FLOAT:DECIMAL(2)' FLOAT NOT NULL DECIMAL (2),
"float_n_dec2" 'Nullable FLOAT:DECIMAL(2)' FLOAT DECIMAL (2),
"float_c_dec64" 'Non-nullable FLOAT:DECIMAL64' FLOAT NOT NULL DECIMAL64
"float_n_dec64" 'Nullable FLOAT:DECIMAL64' FLOAT DECIMAL64
)
BOOLEAN
info
Refer to Annotations for more information on data types mappings.
The BOOLEAN
data type represents a Boolean (logical) value, which is either TRUE
or FALSE
.
Name | # Bytes | Min | Max |
---|---|---|---|
BOOLEAN | 1 | 0 | 1 |
CLASS "epam.rtc.timebase.samples.BooleanMessage" 'Sample Boolean Message' (
"bool_c" 'Non-nullable BOOLEAN' BOOLEAN NOT NULL,
"bool_n" 'Nullable BOOLEAN' BOOLEAN
)
TIMESTAMP
info
Refer to Annotations for more information on data types mappings.
The TIMESTAMP
data type represents an absolute, time zone-independent, number of millisecond(nanoseconds) passed from 1/1/1970 UTC.
Encoding | # Bytes | Range | Description |
---|---|---|---|
MILLISECOND | 8 | Maximum date/time encoded is about 292,277,026,596 years | Milliseconds resolution |
NANOSECOND | 8 | Supported range of values: [1677-09-21 00:12:42, 2262-04-11 23:47:16] | Nanoseconds resolution |
CLASS "epam.rtc.timebase.samples.TimeMessage" 'Sample Time Message' (
"date_c" 'Non-nullable DATE with millisecond resolution' TIMESTAMP NOT NULL,
"date_n" 'Nullable DATE with millisecond resolution' TIMESTAMP,
"nanos_n" 'Non-nullable DATE with nanosecond resolution' TIMESTAMP NANOSECOND NOT NULL,
"nanos" 'Nullable DATE with nanosecond resolution' TIMESTAMP NANOSECOND
)
info
NANOSECOND Encoding supported from 5.6.63+ Releases
TIMEOFDAY
info
Refer to Annotations for more information on data types mappings.
The TIMEOFDAY
data type represents a time of day in a millisecond resolution.
Name | # Bytes | Min | Max |
---|---|---|---|
TIMEOFDAY | 8 | 0 | 86399999 |
CLASS "epam.rtc.timebase.samples.TimeMessage" 'Sample Time Message' (
"date_c" 'Non-nullable DATE' TIMESTAMP NOT NULL,
"date_n" 'Nullable DATE' TIMESTAMP,
"tod_c" 'Non-nullable TIMEOFDAY' TIMEOFDAY NOT NULL,
"tod_n" 'Nullable TIMEOFDAY' TIMEOFDAY
)
ENUM
info
Refer to Annotations for more information on data types mappings.
The ENUM
data type contains the list of indexes of predefined values.
Name | # Bytes | Min | Max |
---|---|---|---|
ENUM | 8 | 0 | 264 |
ENUM "epam.rtc.timebase.samples.SampleEnum" 'Sample Enum' (
"RED" = 1,
"GREEN" = 3,
"BLUE" = 4
)
CLASS "epam.rtc.timebase.samples.EnumMessage" 'Sample Enum Message' (
"enum_c" 'Non-nullable ENUM' "epam.rtc.timebase.samples.SampleEnum" NOT NULL,
"enum_n" 'Nullable ENUM' "epam.rtc.timebase.samples.SampleEnum"
)
ARRAY
info
Refer to Annotations for more information on data types mappings.
ARRAY
data type may contain all data types with the exception of CHAR
.
Name | # Bytes | Types |
---|---|---|
ARRAY | Up to 4,194,304 bytes | INTEGER, BINARY, FLOAT, BOOLEAN, TIMESTAMP, TIMEOFDAY, OBJECT, ARRAY, ENUM |
CLASS "epam.rtc.timebase.samples.SampleArrayMessage" 'Sample Array Message' (
"int_array_nullable" 'Integer Array (Nullable)' ARRAY(INTEGER),
"int_array" 'Integer Array' ARRAY(INTEGER NOT NULL),
"enum_array_nullable" 'ENUM Array (Nullable)' ARRAY("epam.rtc.timebase.samples.SampleEnum"),
"enum_array" 'ENUM Array' ARRAY("epam.rtc.timebase.samples.SampleEnum" NOT NULL),
"object_array_nullable" 'Object Array (Nullable)' ARRAY(OBJECT("epam.rtc.timebase.samples.CustomAttribute")),
"object_array" 'Object Array' ARRAY(OBJECT("epam.rtc.timebase.samples.CustomAttribute") NOT NULL) NOT NULL,
"poly_object_array" 'Polymorphic Object Array' ARRAY(OBJECT("epam.rtc.timebase.samples.CustomAttribute", "epam.rtc.timebase.samples.DeltaAttribute") NOT NULL) NOT NULL,
"nested_array" 'Nested Array' ARRAY(ARRAY(OBJECT("epam.rtc.timebase.samples.CustomAttribute", "epam.rtc.timebase.samples.DeltaAttribute")))
);
OBJECT
info
Refer to Annotations for more information on data types mappings.
OBJECT
defines a structure, consisting of a determined sequence of fields. Objects can include other objects, arrays of objects, arrays with unlimited nesting. Objects do not allow circular object references.
Name | # Bytes |
---|---|
OBJECT | Up to 4,194,304 bytes |
CLASS "epam.rtc.timebase.samples.SampleObjectMessage" 'Sample Object Message' (
"object" 'Object' "epam.rtc.timebase.samples.CustomAttribute" NOT NULL,
"object_nullable" 'Object (Nullable)' "epam.rtc.timebase.samples.CustomAttribute",
"poly_object" 'Polymorphic Object' OBJECT("epam.rtc.timebase.samples.CustomAttribute", "epam.rtc.timebase.samples.DeltaAttribute") NOT NULL,
);
NULL Values
Data Type | NULL Value |
---|---|
BOOLEAN | -1 |
BYTE | Byte.MIN_VALUE |
SHORT | Short.MIN_VALUE |
INTEGER | Integer.MIN_VALUE |
INT48 | -140737488355328L |
LONG | Long.MIN_VALUE |
PINTERVAL | 0 |
FLOAT | Float.NaN |
DOUBLE | Double.NaN |
DECIMAL | Decimal64Utils.NULL |
TIME_OF_DAY | -1 |
DURATION | Integer.MIN_VALUE |
TIMESTAMP | Long.MIN_VALUE |
ENUM | -1 |
ALPHANUMERIC | Long.MIN_VALUE |