Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.16.0
-
None
-
None
Description
Use of array in drill is not friendly
SELECT (split('a,b,c',','))[0]; /*NOK */ Error: SYSTEM ERROR: ClassCastException: org.apache.drill.common.expression.FunctionCall cannot be cast to org.apache.drill.common.expression.SchemaPath /* outer SELECT needed*/ SELECT x[0] FROM (SELECT split('a,b,c',',') x); /* OK */
And access last element of an array is worse
SELECT x[repeated_count(x) - 1] AS lasteltidx FROM (SELECT split('a,b,c',',') x); Error: SYSTEM ERROR: ClassCastException: org.apache.calcite.rex.RexCall cannot be cast to org.apache.calcite.rex.RexLiteral /* while */ SELECT x[2] lastelt, (repeated_count(x) - 1) AS lasteltidx FROM (SELECT split('a,b,c',',') x); +---------+------------+ | lastelt | lasteltidx | +---------+------------+ | c | 2 | +---------+------------+