Lindorm SQL supports 14 data types for use in table definitions. This page lists each type with its storage size, Java mapping, and compatibility with Lindorm engines and indexes.
Applicable engines
The data types described here apply to LindormTable, LindormTSDB, and the columnar storage engine.
Supported data types
Boolean
| Data type | Java type | Size | Description |
|---|
| BOOLEAN | java.lang.Boolean | 1 byte | Stores true or false. |
Integer types
All integer types store exact numeric values. The value range is based on the value length and whether the values are signed.
| Data type | Java type | Size |
|---|
| TINYINT | java.lang.Byte | 1 byte |
| SMALLINT | java.lang.Short | 2 bytes |
| INTEGER | java.lang.Integer | 4 bytes |
| BIGINT | java.lang.Long | 8 bytes |
Floating-point types
FLOAT and DOUBLE store approximate numeric values. For financial data such as payment amounts, use DECIMAL instead.
| Data type | Java type | Size | Description |
|---|
| FLOAT | java.lang.Float | 4 bytes | Stores approximate numeric values. The value range and precision depend on the value length, the precision and scale parameters, and whether the values are signed. |
| DOUBLE | java.lang.Double | 8 bytes | Stores approximate numeric values. The value range and precision depend on the value length, the precision and scale parameters, and whether the values are signed. All DOUBLE values in SQL statements must be expressed in scientific notation. |
Exact numeric type
| Data type | Java type | Size | Description |
|---|
| DECIMAL(precision, scale) | java.lang.BigDecimal | Variable | Stores exact decimal values. The number of bytes increases with precision. Use DECIMAL for high-precision data such as payment amounts; use FLOAT or DOUBLE for data where approximate values are acceptable, such as monitoring data. |
Parameters:
String types
| Data type | Java type | Description |
|---|
| VARCHAR | java.lang.String | Variable-length string. Chinese characters are supported. |
| CHAR(N) | java.lang.String | Fixed-length string of N characters. Chinese characters are supported. |
Binary types
| Data type | Java type | Description |
|---|
| BINARY(N) | byte[] | Fixed-length binary value of N bytes. If the input is shorter than N bytes, the system pads trailing zeroes. If the input exceeds N bytes, the system truncates the extra bytes. |
| VARBINARY | byte[] | Variable-length binary value. If used as a primary key column, it must be the last primary key column. |
Date and time types
| Data type | Java type | Range | Description |
|---|
| DATE | java.sql.Types#DATE | — | Stores date values only — time is discarded. DATE values are prone to errors during time zone conversion because the stored date is interpreted relative to the connection's time zone. Avoid this type when time zone correctness matters. See Background information. |
| TIME | java.sql.Types#TIME | — | Stores time values. See Background information. |
| TIMESTAMP | java.sql.Types#TIMESTAMP | Up to 9999-12-31 23:59:59 in Lindorm (up to 2038-01-19 03:14:07 in MySQL) | Stores timestamp values. See Background information. |
Important The maximum TIMESTAMP value differs between MySQL and Lindorm. MySQL caps at 2038-01-19 03:14:07, while Lindorm supports values up to 9999-12-31 23:59:59.
Engine compatibility
The following table shows which data types each engine supports.
〇 = supported; N = not supported.
| Data type | LindormTable | LindormTSDB | Columnar storage engine |
|---|
| BOOLEAN | 〇 | 〇 | 〇 |
| TINYINT | 〇 | N | 〇 |
| SMALLINT | 〇 | N | 〇 |
| INTEGER | 〇 | N | 〇 |
| BIGINT | 〇 | 〇 | 〇 |
| FLOAT | 〇 | N | 〇 |
| DOUBLE | 〇 | 〇 | 〇 |
| DECIMAL(precision, scale) | 〇 | N | 〇 |
| VARCHAR | 〇 | 〇 | 〇 |
| CHAR(N) | 〇 | 〇 | 〇 |
| BINARY(N) | 〇 | N | 〇 |
| VARBINARY | 〇 | N | 〇 |
| DATE | 〇 | N | 〇 |
| TIME | 〇 | N | N |
| TIMESTAMP | 〇 | 〇 | 〇 |
Index compatibility
To accelerate queries on raw data in LindormTable, you can create secondary indexes for point lookups, search indexes for full-text and multidimensional queries, or columnar indexes for analytical workloads. The following table shows which data types each index type supports.
〇 = supported; N = not supported.
| Data type | Secondary index | Search index | Columnar index |
|---|
| BOOLEAN | 〇 | 〇 | 〇 |
| TINYINT | 〇 | 〇 | 〇 |
| SMALLINT | 〇 | 〇 | 〇 |
| INTEGER | 〇 | 〇 | 〇 |
| BIGINT | 〇 | 〇 | 〇 |
| FLOAT | 〇 | 〇 | 〇 |
| DOUBLE | 〇 | 〇 | 〇 |
| DECIMAL(precision, scale) | 〇 | N | 〇 |
| VARCHAR | 〇 | 〇 | 〇 |
| CHAR(N) | 〇 | 〇 | 〇 |
| BINARY(N) | 〇 | 〇 | 〇 |
| VARBINARY | 〇 | 〇 | 〇 |
| DATE | 〇 | N | 〇 |
| TIME | 〇 | N | N |
| TIMESTAMP | 〇 | 〇 (requires LindormTable 2.6.5 or later) | 〇 |