element_at

    Syntax

    Returns an element of an array located at the input position. If there is no element at the position, return NULL.

    position is 1-based and support negtive number.

    positive position example:

    negtive example:

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