ARRAY

SinceVersion 1.2.0

ARRAY

description

ARRAY<T>

An array of T-type items, it cannot be used as a key column. Now ARRAY can only used in Duplicate Model Tables.

SinceVersion 2.0

After version 2.0, it supports the use of non-key columns in Unique model tables.

T-type could be any of:

1. BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, LARGEINT, FLOAT, DOUBLE, DECIMAL, DATE,
2. DATEV2, DATETIME, DATETIMEV2, CHAR, VARCHAR, STRING

example

Create table example:

1. mysql> CREATE TABLE `array_test` (
2. `id` int(11) NULL COMMENT "",
3. `c_array` ARRAY<int(11)> NULL COMMENT ""
4. ) ENGINE=OLAP
5. DUPLICATE KEY(`id`)
6. COMMENT "OLAP"
7. DISTRIBUTED BY HASH(`id`) BUCKETS 1
8. PROPERTIES (
9. "replication_allocation" = "tag.location.default: 1",
10. "in_memory" = "false",
11. "storage_format" = "V2"
12. );

Insert data example:

1. mysql> INSERT INTO `array_test` VALUES (1, [1,2,3,4,5]);
2. mysql> INSERT INTO `array_test` VALUES (2, [6,7,8]), (3, []), (4, null);

Select data example:

1. mysql> SELECT * FROM `array_test`;
2. +------+-----------------+
3. | id   | c_array         |
4. +------+-----------------+
5. |    1 | [1, 2, 3, 4, 5] |
6. |    2 | [6, 7, 8]       |
7. |    3 | []              |
8. |    4 | NULL            |
9. +------+-----------------+

keywords

1. ARRAY