Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Status

Current stateUnder Discussion

...

We will not introduce a data structure interface/class for every data type, but will use Java primitive types as much as possible for performance purposes. The mappings from Flink Table/SQL data types to the internal data structures are listed in the following table:


Data Types

Internal Data Structures

BOOLEAN

boolean

CHAR / VARCHAR / STRING

StringData

BINARY / VARBINARY / BYTES

byte[]

DECIMAL

DecimalData

TINYINT

byte

SMALLINT

short

INTEGER

int

BIGINT

long

FLOAT

float

DOUBLE

double

DATE

int (number of days since epoch)

TIME

int (number of milliseconds of the day)

TIMESTAMP

TimestampData

TIMESTAMP WITH LOCAL TIME  ZONE

TimestampData

INTERVAL YEAR TO MONTH

int (number of months)

INTERVAL DAY TO MONTH

long (number of milliseconds)

ROW

RowData

ARRAY

ArrayData

MAP / MULTISET

MapData

RAW

RawValueData


Note: Currently, Blink planner only supports TIME(0) and interval of MONTH and SECOND(3). In the future, we may need something like `TimestampData` to represent more information about these types. That means we may introduce `IntervalData` and `TimeData` in the future. But we still can keep backward compatibility to allow users to use the primitive types if the precision is compact at that time.

...