Description
I am encountering a ParseException error when trying to parse a SQL query that involves lambda expressions and struct transformations using JSQLParser. The specific error message is as follows:
net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "->" "->" at line 1, column x. Was expecting one of: ")" "." "::" "^"
The SQL query that causes the issue is:
SELECT array_sort(array_agg(named_struct('depth', events_union.depth, 'eventtime',events_union.eventtime)), ((left, right) -> case when(left.eventtime, left.depth) <(right.eventtime, right.depth) then -1 when(left.eventtime, left.depth) >(right.eventtime, right.depth) then 1 else 0 end)) as col1 FROM your_table;
Here's a sample dataset for your_table to illustrate the issue:
eventtime depth state hits
2024-07-01 10:00:00 5 1 [10, 20]
2024-07-01 10:01:00 3 2 [15, 25]
2024-07-01 10:00:00 7 0 [5, 10]
2024-07-01 10:02:00 4 1 [30, 40]
Please provide support for lambda expressions and struct transformations in Spark SQL queries.