This topic describes the data types supported by Realtime Compute and how to convert between different data types.

Data types supported by Realtime Compute

Data type Description Value range
VARCHAR String with variable length Maximum length: 4 MB.
BOOLEAN Logical value. Valid values: TRUE, FALSE, and UNKNOWN.
TINYINT Tiny integer with a length of one byte. -128 to 127.
SMALLINT Small integer with a length of two bytes. -32768 to 32767
INT Integer with a length of four bytes. -2147483648 to 2147483647.
BIGINT Big integer with a length of eight bytes. -9223372036854775808 to 9223372036854775807.
FLOAT Floating point number with a length of four bytes. Accurate to 6 decimal places.
DECIMAL Decimal type. Example: The value of DECIMAL(5,2) is 123.45.
DOUBLE Floating point number with a length of eight bytes. Accurate to 15 decimal places.
DATE Date type. Example: DATE'1969-07-20'.
TIME Time Example: TIME '20:17:40'.
TIMESTAMP Timestamp that contains both date and time Example: TIMESTAMP '1969-07-20 20:17:40'.
VARBINARY Binary data type. This type corresponds to the byte[] array.

Data type conversion

Example

  • Test data
    var1 (VARCHAR) big1 (BIGINT)
    1000 323
  • Test statements
    cast (var1 as bigint) as AA;
    cast (big1 as varchar) as BB;
  • Test results
    AA (BIGINT) BB (VARCHAR)
    1000 323