Last element in array?

Is it possible to retrieve the last element in an array?
I can do:



gives me this error:

org.apache.calcite.rex.RexCall cannot be cast to org.apache.calcite.rex.RexLiteral.

Hi @Joe This has been a request from others too but currently not in the product,

try sublist([array],-1,1)[0]

That worked, thank you! I don’t see sublist in the SQL reference – is there a list of undocumented functions somewhere?

source code in github

Wow - there’s a bunch: Search · implements simplefunction · GitHub