Updated on 2022-11-18 GMT+08:00

About CarbonData Table

Overview

In CarbonData, data is stored in entities called tables. CarbonData tables are similar to RDBMS tables. RDBMS data is stored in a table consisting of rows and columns. CarbonData tables store structured data, and have fixed columns and data types.

Supported Data Types

CarbonData tables support the following data types:

  • Int
  • String
  • BigInt
  • Smallint
  • Char
  • Varchar
  • Boolean
  • Decimal
  • Double
  • TimeStamp
  • Date
  • Array
  • Struct
  • Map

The following table describes supported data types and their respective values range.

Table 1 CarbonData data types

Data Type

Value Range

Int

4-byte signed integer ranging from -2,147,483,648 to 2,147,483,647.

NOTE:

If a non-dictionary column is of the int data type, it is internally stored as the BigInt type.

String

100,000 characters

NOTE:

If the CHAR or VARCHAR data type is used in CREATE TABLE, the two data types are automatically converted to the String data type.

If a column contains more than 32,000 characters, add the column to the LONG_STRING_COLUMNS attribute of the tblproperties table during table creation.

BigInt

64-bit value ranging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

SmallInt

–32,768 to 32,767

Char

A to Z and a to z

Varchar

A to Z, a to z, and 0 to 9

Boolean

true or false

Decimal

The default value is (10,0) and maximum value is (38,38).

NOTE:

When query with filters, append BD to the number to achieve accurate results. For example, select * from carbon_table where num = 1234567890123456.22BD.

Double

64-bit value ranging from 4.9E-324 to 1.7976931348623157E308

TimeStamp

The default format is yyyy-MM-dd HH:mm:ss.

Date

The DATE data type is used to store calendar dates. The default format is yyyy-MM-DD.

Array<data_type>

N/A

NOTE:

Currently, only two layers of complex types can be nested.

Struct<col_name: data_type COMMENT col_comment, ...>

Map<primitive_type, data_type>