Syntax

    1. mysql> set enable_vectorized_engine=true;
    2. mysql> select k1, k2, array_join(k2, '_', 'null') from array_test order by k1;
    3. +------+-----------------------------+------------------------------------+
    4. | k1 | k2 | array_join(`k2`, '_', 'null') |
    5. +------+-----------------------------+------------------------------------+
    6. | 1 | [1, 2, 3, 4, 5] | 1_2_3_4_5 |
    7. | 2 | [6, 7, 8] | 6_7_8 |
    8. | 3 | [] | |
    9. | 4 | NULL | NULL |
    10. | 5 | [1, 2, 3, 4, 5, 4, 3, 2, 1] | 1_2_3_4_5_4_3_2_1 |
    11. | 7 | [4, 5, 6, NULL, NULL] | 4_5_6_null_null |
    12. +------+-----------------------------+------------------------------------+
    13. +------+-----------------------------------+------------------------------------+
    14. | k1 | k2 | array_join(`k2`, '_', 'null') |
    15. +------+-----------------------------------+------------------------------------+
    16. | 1 | ['a', 'b', 'c', 'd'] | a_b_c_d |
    17. | 2 | ['e', 'f', 'g', 'h'] | e_f_g_h |
    18. | 3 | [NULL, 'a', NULL, 'b', NULL, 'c'] | null_a_null_b_null_c |
    19. | 4 | ['d', 'e', NULL, ' '] | d_e_null_ |
    20. | 5 | [' ', NULL, 'f', 'g'] | _null_f_g |
    21. +------+-----------------------------------+------------------------------------+
    22. mysql> select k1, k2, array_join(k2, '_') from array_test order by k1;
    23. +------+-----------------------------+----------------------------+
    24. | k1 | k2 | array_join(`k2`, '_') |
    25. | 1 | [1, 2, 3, 4, 5] | 1_2_3_4_5 |
    26. | 2 | [6, 7, 8] | 6_7_8 |
    27. | 4 | NULL | NULL |
    28. | 5 | [1, 2, 3, 4, 5, 4, 3, 2, 1] | 1_2_3_4_5_4_3_2_1 |
    29. | 6 | [1, 2, 3, NULL] | 1_2_3 |
    30. | 7 | [4, 5, 6, NULL, NULL] | 4_5_6 |
    31. +------+-----------------------------+----------------------------+
    32. mysql> select k1, k2, array_join(k2, '_') from array_test01 order by k1;
    33. +------+-----------------------------------+----------------------------+
    34. | k1 | k2 | array_join(`k2`, '_') |
    35. +------+-----------------------------------+----------------------------+
    36. | 1 | ['a', 'b', 'c', 'd'] | a_b_c_d |
    37. | 2 | ['e', 'f', 'g', 'h'] | e_f_g_h |
    38. | 3 | [NULL, 'a', NULL, 'b', NULL, 'c'] | a_b_c |
    39. | 4 | ['d', 'e', NULL, ' '] | d_e_ |
    40. +------+-----------------------------------+----------------------------+