Updated on 2026-11-06 GMT+08:00

Primitive Data Types

Table 1 lists primitive data types that AI DataLake supports.

Table 1 Primitive data types

Data Type

Description

Storage Space

Value Range

OBS Table Support

Managed Table Support

INT

Signed integer

4 bytes

–2147483648 to 2147483647

Yes

Yes

STRING

String

-

-

Yes

Yes

FLOAT

Single-precision floating point

4 bytes

-

Yes

Yes

DOUBLE

Double-precision floating-point

8 bytes

-

Yes

Yes

DECIMAL(precision,scale)

Decimal exact numeric type. A data type with fixed significant digits and decimal places, e.g., 3.5. precision: indicates the maximum number of digits that can be represented. scale: indicates the number of digits in the fractional part.

-

1 <= precision <= 38<br>0 <= scale <= 38<br>If precision and scale are not specified, the default is decimal(10,0).

Yes

Yes

BOOLEAN

Boolean

1 byte

TRUE/FALSE

Yes

Yes

SMALLINT/SHORT

Signed integer

2 bytes

–32768 to 32767

Yes

Yes

TINYINT

Signed integer

1 byte

–128 to 127

Yes

No

BIGINT/LONG

Signed integer

8 bytes

–9223372036854775808 to 9223372036854775807

Yes

Yes

TIMESTAMP

Timestamp, representing date and time, in raw data format, e.g., 2021-05-19 22:22:11

-

-

Yes

Yes

TIMESTAMP_NTZ(p)

Timestamp without time zone, p is the fractional seconds precision (0-6), without time zone information

-

-

Yes

Yes

TIMESTAMP_LTZ(p)

Timestamp with time zone, p is the fractional seconds precision (0-6), with time zone information

-

-

Yes

Yes

CHAR

Fixed-length string

-

-

Yes

Yes

VARCHAR

Variable-length string

-

-

Yes

Yes

DATE

Date type, describes a specific year, month, and day, expressed in yyyy-mm-dd format, e.g., 2014-05-29

-

The DATE type does not include time. The range of dates that can be represented is 0000-01-01 to 9999-12-31.

Yes

Yes

VARIANT

Suitable for semi-structured data processing. Only supports Iceberg tables.

-

-

Yes

Yes

  • VARCHAR and CHAR are stored as the STRING type in practice.
  • FLOAT is a single-precision floating-point type, occupying 4 bytes of storage, with approximately 7 significant digits.
  • Spark Native already supports the VARIANT type.
  • Only v3 tables support the VARIANT data type.

INT

A signed integer with a storage space of 4 bytes, ranging from –2147483648 to 2147483647. When NULL, the default value is 0.

STRING

A string type.

FLOAT

A single-precision floating-point type with a storage space of 4 bytes. When NULL, the default value for calculation is 0.

Due to the limitations of how floating-point data is stored in computers, when comparing whether two floating-point data values are equal, direct comparison using a == b is not recommended due to precision issues. You are advised to use the method abs(a - b) <= EPSILON for comparison, where EPSILON is the allowable error range, typically 1.19209290E-07F. If the absolute difference between two floating-point numbers is within this range, they are considered equal.

DOUBLE

A double-precision floating-point type with a storage space of 8 bytes. When NULL, the default value for calculation is 0.

Due to the limitations of how floating-point data is stored in computers, when comparing whether two floating-point data values are equal, direct comparison using a == b is not recommended due to precision issues. You are advised to use the method abs(a - b) <= EPSILON for comparison, where EPSILON is the allowable error range, typically 2.2204460492503131E-16. If the absolute difference between two floating-point numbers is within this range, they are considered equal.

DECIMAL

Decimal(p,s) indicates that the total digit length is p, including p – s integer digits and s fractional digits. p indicates the maximum number of decimal digits that can be stored, including the digits to both the left and right of the decimal point. The value of p ranges from 1 to 38. s indicates the maximum number of decimal digits that can be stored to the right of the decimal point. The fractional digits must be values ranging from 0 to p. The fractional digits can be specified only after significant digits are specified. Therefore, the following inequality is concluded: 0 ≤ s ≤ p. For example, decimal (10,6) indicates that the value contains 10 digits, in which there are four integer digits and six fractional digits.

BOOLEAN

Boolean, which can be TRUE or FALSE.

SMALLINT/SHORT

Signed integer with a storage space of 2 bytes. Its value ranges from –32768 to 32767. When NULL, the default value for calculation is 0.

TINYINT

Signed integer with a storage space of 1 byte. Its value ranges from –128 to 127. When NULL, the default value for calculation is 0.

BIGINT/LONG

A signed integer with a storage space of 8 bytes, ranging from –9223372036854775808 to 9223372036854775807. Scientific notation is not supported. When NULL, the default value for calculation is 0.

TIMESTAMP

Legacy UNIX TIMESTAMP is supported, providing the precision up to the microsecond level. TIMESTAMP is defined by the difference between the specified time and UNIX epoch (UNIX epoch time: 1970-01-01 00:00:00) in seconds. Data types that can be implicitly converted to TIMESTAMP include STRING (must have the format yyyy-MM-dd HH:mm:ss[.ffffff]. The precision after the decimal point is optional).

CHAR

The length of CHAR is fixed, using a fixed-length string of the specified length. It is stored as the STRING type in practice.

VARCHAR

VARCHAR is declared with a length that indicates the maximum number of characters in a string. Similar to STRING, the spaces at the end of VARCHAR are meaningful and affect the comparison result. It is stored as the STRING type in practice.

DATE

The DATE type can only be explicitly cast to and from DATE, TIMESTAMP, and STRING, as shown in Table 2.

Table 2 cast function conversion

Explicit Conversion

Conversion Result

cast(date as date)

Same as value of DATE.

cast(timestamp as date)

The date (yyyy-mm-dd) is obtained from TIMESTAMP based on the local time zone and returned as the value of DATE.

cast(string as date)

If the STRING is in the yyyy-MM-dd format, the corresponding date (yyyy-mm-dd) is returned as the value of DATE. If the string does not have this format, NULL is returned.

cast(date as timestamp)

Timestamp that maps to the zero hour of the date (yyyy-mm-dd) specified by DATE is generated based on the local time zone and returned as the value of DATE.

cast(date as string)

A STRING in the yyyy-MM-dd format is generated based on the date (yyyy-mm-dd) specified by DATE and returned as the value of DATE.