-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Issue Description
BadQueryRequestException is currently used when a bad query is passed by client. When we classify BadQueryRequestException for QueryException, it's reported as QueryException.QUERY_EXECUTION_ERROR (200). The issue is QueryException.QUERY_EXECUTION_ERROR code is too generic which doesn't really tell much about the nature of this failure.
BadQueryRequestException Usage
List of BadQueryRequestException uses. They are all client side bad queries such as
Illegal function name:
Expect 2 arguments for function:
Nested query is not supported without gapfill
Examples
SELECT "job_id" FROM job_board WHERE "company_id" = '___nothing_will_match_this_fake_value___';Assuming company_id is a numeric type, this will error with something like
200 QueryExecutionError:
org.apache.pinot.spi.exception.BadQueryRequestException:
java.lang.IllegalArgumentException: Cannot convert value: '___nothing_will_match_this_fake_value___' to type: LONG/INT/etc.
How to reproduce
Pick an integration test like OfflineClusterIntegrationTest, and try a new test case function
@Test()
public void tempTest()
throws Exception {
String sqlQuery =
"SELECT AirlineID, COUNT(*) FROM mytable WHERE AirlineID = 'some_bogus_here' "
+ "GROUP BY AirlineID";
JsonNode result = postQuery(sqlQuery);
assertNoError(result);
}Suggested Fix
In org/apache/pinot/core/query/executor/ServerQueryExecutorV1Impl.java, we can classify this as QueryException.QUERY_VALIDATION_ERROR instead of generic QueryException.QUERY_EXECUTION_ERROR to indicate this is a client side error.