Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BadQueryRequestException QueryException error code classification #14916

Open
real-mj-song opened this issue Jan 24, 2025 · 0 comments
Open

BadQueryRequestException QueryException error code classification #14916

real-mj-song opened this issue Jan 24, 2025 · 0 comments

Comments

@real-mj-song
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants