Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
From ARRAY Type, accessing the 0-index array entry is not permitted. However, with a VARCHAR ARRAY, the accessor allows it, resulting in surprising empty string and/or nulls handed up to parent expressions. This should instead throw a SQLException.
> select * from test1; +----+-----------------------+ | A | B | +----+-----------------------+ | 1 | ['a', 'b', 'c'] | | 2 | ['w', 'x', 'y', 'z'] | +----+-----------------------+ 2 rows selected (0.451 seconds) > select a, b[0] from test1; +----+-------------------+ | A | ARRAY_ELEM(B, 0) | +----+-------------------+ | 1 | | | 2 | | +----+-------------------+ 2 rows selected (0.032 seconds) > select a, length(b[0]) from test1; +----+---------------------------+ | A | LENGTH(ARRAY_ELEM(B, 0)) | +----+---------------------------+ | 1 | null | | 2 | null | +----+---------------------------+ 2 rows selected (0.048 seconds)