array()

SinceVersion 1.2.0

array()

description

Syntax

1. ARRAY<T> array(T, ...)

construct an array with variadic elements and return it, T could be column or literal

notice

Only supported in vectorized engine

example

1. mysql> set enable_vectorized_engine=true;

3. mysql> select array("1", 2, 1.1);
4. +----------------------+
5. | array('1', 2, '1.1') |
6. +----------------------+
7. | ['1', '2', '1.1']    |
8. +----------------------+
9. 1 row in set (0.00 sec)

12. mysql> select array(null, 1);
13. +----------------+
14. | array(NULL, 1) |
15. +----------------+
16. | [NULL, 1]      |
17. +----------------+
18. 1 row in set (0.00 sec)

20. mysql> select array(1, 2, 3);
21. +----------------+
22. | array(1, 2, 3) |
23. +----------------+
24. | [1, 2, 3]      |
25. +----------------+
26. 1 row in set (0.00 sec)

28. mysql>  select array(qid, creationDate, null) from nested  limit 4;
29. +------------------------------------+
30. | array(`qid`, `creationDate`, NULL) |
31. +------------------------------------+
32. | [1000038, 20090616074056, NULL]    |
33. | [1000069, 20090616075005, NULL]    |
34. | [1000130, 20090616080918, NULL]    |
35. | [1000145, 20090616081545, NULL]    |
36. +------------------------------------+
37. 4 rows in set (0.01 sec)

keywords

ARRAY,ARRAY,CONSTRUCTOR