apache/pinot

Query 500 on `select col, count(*) from table` missing `group by` (query mistake)

Open

#7.868 geöffnet am 4. Dez. 2021

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Java (1.234 Forks)batch import
help wanted

Repository-Metriken

Stars
 (4.937 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 7h) (186 gemergte PRs in 30 T)

Beschreibung

While writing some adhoc queries, I found the controller query console was throwing a 500 and I was scratching my head about the error until I realized the query was incorrect. I'm not sure if Pinot often 500s on invalid queries, or this is a corner case, but certainly making sure a helpful error is returned is better that informs the user their query is invalid.

For example, I was trying

select $segmentName, count(*)
from table
where $segmentName = 'bar'

Mind, the same error happened when I used actual columns rather than the virtual column.

And it was raising the following exception

java.io.IOException: Failed : HTTP error code : 500
	at org.apache.pinot.controller.api.resources.PinotQueryResource.sendPostRaw(PinotQueryResource.java:305)
	at org.apache.pinot.controller.api.resources.PinotQueryResource.sendRequestRaw(PinotQueryResource.java:343)
	at org.apache.pinot.controller.api.resources.PinotQueryResource.getQueryResponse(PinotQueryResource.java:225)
	at org.apache.pinot.controller.api.resources.PinotQueryResource.handlePostSql(PinotQueryResource.java:137))

Contributor Guide