JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

4.1 Parser fails on H2 Ordered Aggregate Functions

Open manticore-projects opened this issue 4 years ago • 2 comments

Just stumpled over this:


-- LISTAGG 3: fails to parse
SELECT LISTAGG(ID, ', ') WITHIN GROUP (ORDER BY ID) OVER (ORDER BY ID);

-- ARRAY_AGG 2: fails to deparse correctly
SELECT ARRAY_AGG(NAME ORDER BY ID) FILTER (WHERE NAME IS NOT NULL);

-- ARRAY_AGG 3 fails to deparse correctly
SELECT ARRAY_AGG(ID ORDER BY ID) OVER (ORDER BY ID);

net.sf.jsqlparser.JSQLParserException: Encountered unexpected token: "BY" "BY" at line 1, column 65.

I will look into this and try to craft a PR when I find some time.

manticore-projects avatar Apr 28 '21 05:04 manticore-projects

The second and third SQL is now parsed and deparsed successfully.

wumpz avatar May 01 '21 20:05 wumpz

To the first one: I was not aware that additional to this "within group" an over clause is valid.

wumpz avatar May 01 '21 20:05 wumpz

Should be address by PR #1666.

manticore-projects avatar Nov 22 '22 00:11 manticore-projects