zapr-oss / druidry

Java based Druid Query Generator library
Apache License 2.0
193 stars 89 forks source link

DruidJerseyClient cannot handle Query Timeout #187

Open mounikanakkala opened 8 months ago

mounikanakkala commented 8 months ago

Hello,

We are using Druidry in our system and we are facing trouble as we cannot get QueryTimeoutException.

For testing, We sent a POST request to <druidurl>/druid/v2 with body containing groupby query with a timeout. When the query does timeout, we get a 504 Gateway Timeout error response from Druid which looks like the following

{"error":"Query timeout","errorMessage":"url[<druidurl>/druid/v2/] timed out","errorClass":"org.apache.druid.query.QueryTimeoutException","host":"<druidurl>"}

On Druid UI, for the same query with timeout, the response looks like the following

Error: Query timeout
Sequence iterator timed out waiting for data
org.apache.druid.query.QueryTimeoutException

However, when we are passing that query to zapr/druidry DruidJerseyClient, it handles only 500 error as shown here. As a result, it doesn't catch the 504 error and considers it as a successful scenario and goes to reading the response here. This leads to the library giving a confusing error that readEntity could not parse the message from Druid.

We want to be able to handle Query timeout gracefully as query timeout is a feature provided by Druid. Also, we want to be able to differentiate between Druid query failure vs timeout as they are two different things.

Can we please add QueryTimeoutException as well?