Data Type

Overview

Data type is a basic attribute of data and used to distinguish different types of data. Data of different types occupies different storage space and supports different operations. Data is stored in data tables in the database. Each column of a data table defines the data type. During storage, data must be stored according to data types.

Similar to the open source community, StreamSQL of the Huawei big data platform supports both native data types and complex data types.

Native Data Types

Table 1 lists native data types supported by Stream SQL.

Table 1 Native data types

Data Type

Description

Storage Space

Value Range

VARCHAR

Character with a variable length

-

-

BOOLEAN

Boolean

-

TRUE/FALSE

TINYINT

Signed integer

1 byte

–128 to 127

SMALLINT

Signed integer

2 bytes

–32768 to 32767

INT

Signed integer

4 bytes

–2147483648 to 2147483647

INTEGER

Signed integer

4 bytes

–2147483648 to 2147483647

BIGINT

Signed integer

8 bytes

–9223372036854775808 to 9223372036854775807

REAL

Single-precision floating point

4 bytes

-

FLOAT

Single-precision floating point

4 bytes

-

DOUBLE

Double-precision floating-point

8 bytes

-

DECIMAL

Data type of valid fixed places and decimal places

-

-

DATE

Date type in the format of yyyy-MM-dd, for example, 2014-05-29

-

DATE does not contain time information. Its value ranges from 0000-01-01 to 9999-12-31.

TIME

Time type in the format of HH:MM:SS

For example, 20:17:40

-

-

TIMESTAMP(3)

Timestamp of date and time

For example, 1969-07-20 20:17:40

-

-

INTERVAL timeUnit [TO timeUnit]

Time interval

For example, INTERVAL '1:5' YEAR TO MONTH, INTERVAL '45' DAY

-

-

Complex Data Types

Table 2 lists complex data types supported by Stream SQL.

Table 2 Complex data types

Data Type

Description

ARRAY

A group of ordered fields that are must be of the same data type

MAP

A group of unordered key/value pairs. Keys must be of the native data type, whereas values can be of the native data type or complex data type. All keys or values in a map must be of the same data type.