Error with some aggregate functions


On our QSERV setup The following query

select max(filterID) from Filter


ERROR 4110 (Proxy): Query processing error: QI=?: Failed to instantiate query: ParseException:lsst::qserv::parser::AggregateWindowedFunctionAdapter*::onExit messsage:“Unhandled exit”, in or around query segment: ‘max(filterID)’, with adapter stack:lsst::qserv::parser::RootAdapter const*, lsst::qserv::parser::DmlStatementAdapter const*, lsst::qserv::parser::SimpleSelectAdapter const*, lsst::qserv::parser::QuerySpecificationAdapter const*, lsst::qserv::parser::SelectElementsAdapter const*, lsst::qserv::parser::SelectFunctionEle

I’m pretty sure queries like this worked in the past. Possibly unrelated but recently we reported a problem with the use of OR and brackets and a new parser was released that fixed this issue but I’m wondering if there were knock on effects. Same issue with SUM, though COUNT(*) works but COUNT(filterID) does not

We are probably not running the latest release so apologies if this issue has been fixed already but it would be good to get confirmation.

Hi Mike,

tl;dr is: Thanks for reporting this. I’ll confirm today and get a fix in asap. We are making changes to the qserv query parser and appreciate you reporting issues as they come up.

If you want to give me a list of queries that you run regularly I’d be happy to include them in the parser unit tests. I think it would help me to make sure we have that query coverage in our tests and to not break queries on you so often in the future :grin:

The longer bit is: we have replaced the older parser framework & related code with a more modern parser framework (IE we are moving from antlr version 2 to antlr version 4) which requires a complete rewrite of the code that uses the framework (it’s that much better, honestly!). When I pulled the switch to make qserv use the new parser code I thought all the unit and integration tests that we run with qserv had been changed to use the new parser code, but I recently discovered a batch of query analysis tests that were still using the old parser code. Many of those not-yet-tested queries can not be handled yet by the new parser code and I’ve been working hard to get support for them implemented. So I’ll make sure your query (or a similar one) is included in that list and make it high priority.


The fix for this query is checked in (DM-16015) and should be included in the next weekly build.
More query coverage fixes should be going in next week.

Hi Nate