Data Type
TINYINT Data Type
Length: Signed integer with a length of 1 byte.
Range: [128, 127]
Conversion: Doris can automatically convert this type to a larger integer or floating point type. Use the CAST () function to convert it to CHAR.
Example:
mysql> select cast(100 as char);
+------------------------+
| CAST(100 AS CHARACTER) |
+------------------------+
| 100 |
+------------------------+
1 row in set (0.00 sec)
SMALLINT Data Type
Length: Signed integer with a length of 2 bytes.
Range: [-32768, 32767]
Conversion: Doris can automatically convert this type to a larger integer or floating point type. Use the CAST () function to convert it to TINYINT, CHAR.
Example:
mysql> select cast(10000 as char);
+--------------------------+
| CAST(10000 AS CHARACTER) |
+--------------------------+
| 10000 |
+--------------------------+
1 row in set (0.01 sec)
mysql> select cast(10000 as tinyint);
+------------------------+
| CAST(10000 AS TINYINT) |
+------------------------+
| 16 |
+------------------------+
1 row in set (0.00 sec)
INT Data Type
Length: Signed integer with a length of 4 bytes.
Range: [-2147483648, 2147483647]
Conversion: Doris can automatically convert this type to a larger integer or floating point type. Use the CAST () function to convert it to TINYINT, SMALLINT, CHAR.
For example:
mysql> select cast(111111111 as char);
+------------------------------+
| CAST(111111111 AS CHARACTER) |
+------------------------------+
| 111111111 |
+------------------------------+
1 row in set (0.01 sec)
BIGINT Data Type
Length: Signed integer with a length of 8 bytes.
Range: [-9223372036854775808, 9223372036854775807]
Conversion: Doris can automatically convert this type to a larger integer or floating point type. Use the CAST () function to convert it to TINYINT, SMALLINT, INT, CHAR.
Example:
mysql> select cast(9223372036854775807 as char);
+----------------------------------------+
| CAST(9223372036854775807 AS CHARACTER) |
+----------------------------------------+
| 9223372036854775807 |
+----------------------------------------+
1 row in set (0.01 sec)
LARGEINT Data Type
Length: Signed integer with a length of 16 bytes.
Range: [-2^127, 2^127-1]
Conversion: Doris can automatically convert this type to a floatingpoint type. Use the CAST () function to convert it to TINYINT, SMALLINT, INT, BIGINT, CHAR
Example:
mysql> select cast(922337203685477582342342 as double);
+------------------------------------------+
| CAST(922337203685477582342342 AS DOUBLE) |
+------------------------------------------+
| 9.223372036854776e23 |
+------------------------------------------+
1 row in set (0.05 sec)
FLOAT Data Type
Length: Floating point type with a length of 4 bytes.
Range: 3.40E+38 ~ +3.40E+38。
Conversion: Doris can automatically convert FLOAT type to DOUBLE type. Users can use CAST () to convert it to TINYINT, SMALLINT, INT, BIGINT, STRING, TIMESTAMP.
DOUBLE Data Type
Length: Floating point type with length of 8 bytes.
Range: 1.79E+308 ~ +1.79E+308。
Conversion: Doris does not automatically convert DOUBLE types to other types. Users can use CAST () to convert it to TINYINT, SMALLINT, INT, BIGINT, STRING, TIMESTAMP. Users can use index symbols to describe the DOUBLE type or obtain it through STRING conversion.
DECIMAL Data Type
DECIMAL[M, D]
Decimal type to ensure the accuracy. M represents the total number of valid digits, and D represents the maximum number of digits after the decimal point. The range of M is [1,27], and the range of d is [1,9]. In addition, M must be greater than or equal to the value of D. The default value is decimal[10,0].
precision: 1 - 27
scale: 0 - 9
Example:
- The default value is decimal(10, 0)
mysql> CREATE TABLE testTable1 (k1 bigint, k2 varchar(100), v decimal SUM) DISTRIBUTED BY RANDOM BUCKETS 8;
Query OK, 0 rows affected (0.09 sec)
mysql> describe testTable1;
+-------+----------------+------+-------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------------+------+-------+---------+-------+
| k1 | bigint(20) | Yes | true | N/A | |
| k2 | varchar(100) | Yes | true | N/A | |
| v | decimal(10, 0) | Yes | false | N/A | SUM |
+-------+----------------+------+-------+---------+-------+
3 rows in set (0.01 sec)
-
Display the value range of the specified decimal.
CREATE TABLE testTable2 (k1 bigint, k2 varchar(100), v decimal(8,5) SUM) DISTRIBUTED BY RANDOM BUCKETS 8;
Query OK, 0 rows affected (0.11 sec)
mysql> describe testTable2;
+-------+---------------+------+-------+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+---------------+------+-------+---------+-------+ | k1 | bigint(20) | Yes | true | N/A | | | k2 | varchar(100) | Yes | true | N/A | | | v | decimal(8, 5) | Yes | false | N/A | SUM | +-------+---------------+------+-------+---------+-------+ 3 rows in set (0.00 sec)
DATE Data Type
Range: ['10000101', '99991231']. The default print format is ‘YYYY-MM-DD’.
DATETIME Data Type
Range: ['10000101 00:00:00', '99991231 00:00:00']. The default print format is ‘YYYY-MM-DD HH:MM:SS’.
CHAR Data Type
Range: Char[(length)], a fixed-length string, whose length ranges from 1 to 255 and is 1 by default.
Conversion: Users can convert CHAR type to TINYINT, SMALLINT, INT, BIGINT, LARGEINT, DOUBLE, DATE or DATETIME type through CAST function.
Example:
mysql> select cast(1234 as bigint);
+----------------------+
| CAST(1234 AS BIGINT) |
+----------------------+
| 1234 |
+----------------------+
1 row in set (0.01 sec)
VARCHAR Data Type
Range: Char(length), a variable length string with a length range of 1~65535 characters.
Conversion: Users can convert CHAR type to TINYINT, SMALLINT, INT, BIGINT, LARGEINT, DOUBLE, DATE or DATETIME type through the CAST function.
Example:
mysql> select cast('2011-01-01' as date);
+----------------------------+
| CAST('2011-01-01' AS DATE) |
+----------------------------+
| 2011-01-01 |
+----------------------------+
1 row in set (0.01 sec)
mysql> select cast('2011-01-01' as datetime);
+--------------------------------+
| CAST('2011-01-01' AS DATETIME) |
+--------------------------------+
| 1/1/2011 12:00:00 AM |
+--------------------------------+
1 row in set (0.01 sec)
mysql> select cast(3423 as bigint);
+----------------------+
| CAST(3423 AS BIGINT) |
+----------------------+
| 3423 |
+----------------------+
1 row in set (0.01 sec)
HLL Data Type
The HLL (HyperLogLog) type is a binary type. The HLL type can only be used for aggregation table, and the aggregation type must be specified as HLL_UNION.
The HLL type is mainly used for pre-aggregation of data in inaccurate and fast deduplication scenarios.
The HLL column can only be queried or used through the matching hll_union_agg, hll_cardinality, and hll_hash.
BITMAP Data Type
The BITMAP type is a binary type. The BITMAP type can only be used for aggregation table, and the aggregation type must be specified as BITMAP_UNION.
The BITMAP type is mainly used for pre-aggregation of data in precise deduplication scenarios. Also, it can also be used to store user IDs in user portrait scenes.
The BITMAP column can only be queried and used through the supporting BITMAP feature.