-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add broker setting to override default implicit query response limit #14452
base: master
Are you sure you want to change the base?
Add broker setting to override default implicit query response limit #14452
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A reasonable chunk of the diff is because of rename of:
_queryResponseLimit
->_queryResponseLimitOverride
DEFAULT_BROKER_QUERY_RESPONSE_LIMIT
->DEFAULT_BROKER_QUERY_RESPONSE_LIMIT_OVERRIDE
The logic is the same though ?
Also the semantics of DEFAULT_BROKER_QUERY_RESPONSE_LIMIT
has been changed.
Am I interpreting the diff correctly ?
I renamed the variables (but not setting keys) because, in my opinion, existing query response limit is badly named. It is not a default but rather an override because it applies even when sql command contains |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14452 +/- ##
============================================
+ Coverage 61.75% 63.99% +2.24%
- Complexity 207 1605 +1398
============================================
Files 2436 2703 +267
Lines 133233 148925 +15692
Branches 20636 22819 +2183
============================================
+ Hits 82274 95307 +13033
- Misses 44911 46624 +1713
- Partials 6048 6994 +946
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I understand the change now. Repeating to verify:
Current Behavior:
If pinot.broker.enable.query.limit.override
is set AND PinotQuery.limit
> pinot.broker.enable.query.limit
, then override the limit.
PR behavior
If pinot.broker.default.query.response.limit
is set AND no limit in query, then set limit.
Override logic continues to apply.
A couple of things that threw me off course are:
- Rename to OVERRIDE.
- New config param name has
default
in it and rest is the same. I assumed it had something to do with default override limit.
Current formula is : |
pinot-common/src/main/java/org/apache/pinot/common/request/PinotQuery.java
Outdated
Show resolved
Hide resolved
Got it. And the test cases test the new functionality only. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch @bziobrowski!
...rc/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java
Show resolved
Hide resolved
pinot-spi/src/main/java/org/apache/pinot/spi/utils/CommonConstants.java
Outdated
Show resolved
Hide resolved
...integration-tests/src/test/java/org/apache/pinot/integration/tests/BrokerQueryLimitTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
pinot-spi/src/main/java/org/apache/pinot/spi/utils/CommonConstants.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java
Outdated
Show resolved
Hide resolved
Can we merge this? |
public static final String CONFIG_OF_BROKER_DEFAULT_QUERY_LIMIT = | ||
"pinot.broker.default.query.limit"; | ||
|
||
public static final int DEFAULT_BROKER_QUERY_LIMIT_OVERRIDE = Integer.MAX_VALUE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the name consistent with config key, and make it next to CONFIG_OF_BROKER_QUERY_RESPONSE_LIMIT
(i.e. keep line 258 unchanged)
|
||
public static final int DEFAULT_BROKER_QUERY_LIMIT_OVERRIDE = Integer.MAX_VALUE; | ||
|
||
// -1 means no limit; value of 10 aligns limit with PinotQuery's defaults. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think v1 allows no limit. What is the behavior when limit is not set?
@@ -140,7 +140,9 @@ public abstract class BaseSingleStageBrokerRequestHandler extends BaseBrokerRequ | |||
protected final int _defaultHllLog2m; | |||
protected final boolean _enableQueryLimitOverride; | |||
protected final boolean _enableDistinctCountBitmapOverride; | |||
protected final int _queryResponseLimit; | |||
protected final int _queryResponseLimitOverride; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the variable name unchanged. This is not only for override, but actually the cap of the allowed limit
@@ -308,6 +313,10 @@ protected BrokerResponse handleRequest(long requestId, String query, SqlNodeAndO | |||
} | |||
} | |||
|
|||
if (isDefaultQueryResponseLimitEnabled() && !pinotQuery.isSetLimit()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will we ever hit this? In PinotQuery
thrift definition, limit has a default value 10. Will limit always be set?
By default single stage query engine (aka v1) uses implicit limit of 10 rows when no limit is set.
This PR adds
pinot.broker.default.query.limit
setting that allows for overriding it.It only applies when limit is not set explicitly in the query and value is greater of equal 0.
By default, the new setting is set to 10 to be consistent with previous default.