YADA icon indicating copy to clipboard operation
YADA copied to clipboard

nullpointerexception on unconventional query

Open christopheleroy opened this issue 6 years ago • 1 comments

On a big SELECT /union/ SELECT / union ... query, which the parser declares is unparseable (but works when executing "plain vanilla"), the query cannot be executed because I get:

java.lang.NullPointerException at com.novartis.opensource.yada.QueryManager.prepQueryForExecution(QueryManager.java:702) at com.novartis.opensource.yada.QueryManager.prepQueriesForExecution(QueryManager.java:857) at com.novartis.opensource.yada.QueryManager.processRequest(QueryManager.java:189) at com.novartis.opensource.yada.QueryManager.(QueryManager.java:137) at com.novartis.opensource.yada.Service.execute(Service.java:595)

QueryManager - line 702 is doing a:

yq.getType().equals(...)

yq.getTypes() returns null, because yq.type has not been set.

yq.type should probably default to some "UNDERTMINED" value that does not fail its '.equas()' or perhaps yq.getTypes() should never return null....

christopheleroy avatar Nov 22 '18 04:11 christopheleroy

everything works again when I surround my query with SELECT * FROM ( the original big union query) etc.

It would be really nice to upgrade the parser (it fails with 8.6.1. because there is a lot of postgres peculiarities) but a NullPointerException should never happen in QueryManager etc.

christopheleroy avatar Nov 22 '18 04:11 christopheleroy