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

Map BadQueryRequestException to QueryException.QUERY_VALIDATION_ERROR #14917

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

real-mj-song
Copy link
Contributor

@real-mj-song real-mj-song commented Jan 24, 2025

Description

Expand the usage of BadQueryRequestException when error cause is clear. Map it to QUERY_VALIDATION_ERROR instead of QUERY_VALIDATION_ERROR

Now BadQueryRequestException is thrown in the following cases:

  • when aggregation functions fail to extract numeric type from given value
  • when IllegalArgumentException is thrown in BaseCombineOperator.java
  • in QueryDispatcher reducer if TransferableBlock has query error(s) and one of them is QUERY_VALIDATION_ERROR. This is better than just RuntimeException

Detailed reasoning

Related to #14916

For some aggregation functions (sum/min/max), throws BadQueryRequestException instead of IllegalStateException because a non-numeric type is passed by client. An example of this is when the query is

SELECT SUM/MIN/MAX(Origin) FROM mytable WHERE AirlineID > 3000

This fails with IllegalStateException and is classified as QueryException.QUERY_EXECUTION_ERROR by default by constructor of ExceptionResultsBlock

@codecov-commenter
Copy link

codecov-commenter commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 41.66667% with 14 lines in your changes missing coverage. Please review.

Project coverage is 63.73%. Comparing base (59551e4) to head (ec7cec1).
Report is 1625 commits behind head on master.

Files with missing lines Patch % Lines
...requesthandler/MultiStageBrokerRequestHandler.java 0.00% 6 Missing ⚠️
...not/core/operator/combine/BaseCombineOperator.java 71.42% 1 Missing and 1 partial ⚠️
.../pinot/query/service/dispatch/QueryDispatcher.java 50.00% 1 Missing and 1 partial ⚠️
...y/aggregation/function/MaxAggregationFunction.java 0.00% 1 Missing ⚠️
...y/aggregation/function/MinAggregationFunction.java 0.00% 1 Missing ⚠️
...y/aggregation/function/SumAggregationFunction.java 0.00% 1 Missing ⚠️
...core/query/executor/ServerQueryExecutorV1Impl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #14917      +/-   ##
============================================
+ Coverage     61.75%   63.73%   +1.98%     
- Complexity      207     1469    +1262     
============================================
  Files          2436     2708     +272     
  Lines        133233   151557   +18324     
  Branches      20636    23405    +2769     
============================================
+ Hits          82274    96594   +14320     
- Misses        44911    47708    +2797     
- Partials       6048     7255    +1207     
Flag Coverage Δ
custom-integration1 100.00% <ø> (+99.99%) ⬆️
integration 100.00% <ø> (+99.99%) ⬆️
integration1 100.00% <ø> (+99.99%) ⬆️
integration2 0.00% <ø> (ø)
java-11 63.69% <41.66%> (+1.98%) ⬆️
java-21 63.62% <41.66%> (+1.99%) ⬆️
skip-bytebuffers-false 63.71% <41.66%> (+1.96%) ⬆️
skip-bytebuffers-true 63.60% <41.66%> (+35.87%) ⬆️
temurin 63.73% <41.66%> (+1.98%) ⬆️
unittests 63.73% <41.66%> (+1.98%) ⬆️
unittests1 56.31% <55.55%> (+9.42%) ⬆️
unittests2 34.00% <0.00%> (+6.27%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

4 participants