FrankChen021 opened a new pull request, #20629:
URL: https://github.com/apache/druid/pull/20629
### Description
Integer and long query context parameters accept a human-readable number as
a string, such as `'100K'`, `'1MiB'` or `'1 MiB'`:
```sql
SET maxSubqueryRows = '100K';
SET maxScatterGatherBytes = '1 MiB';
SET priority = '-2K';
```
- A string that isn't a plain number is parsed as a human-readable number,
and the parameter's type range still applies; for example, `'2GiB'` is out of
range for an integer parameter.
- Unlike runtime properties, these values can be negative, such as `'-2K'`,
for parameters that allow negative values. `HumanReadableBytes.parse(String,
boolean allowNegative)` is added for this; `parse(String)` still rejects
negative numbers.
- `HumanReadableBytes.parse` now accepts spaces between the number and the
unit, such as `1 MiB`. This also applies to runtime properties, such as
`druid.processing.buffer.sizeBytes=1 MiB`. Spaces within the number or the
unit, or after the minus sign, are rejected.
An invalid value reports the accepted forms:
> Query context parameter [maxRowsQueuedForOrdering] should be in integer
format, or a human-readable number such as '10 K' or '256 MiB', but got [abc]
#### Release note
Integer and long query context parameters accept human-readable numbers,
such as `SET maxSubqueryRows = '100K'` or `SET maxScatterGatherBytes = '1
MiB'`, including negative ones such as `'-2K'` where the parameter allows them.
Human-readable numbers in runtime properties can now have a space between the
number and the unit, such as `1 MiB`.
<hr>
##### Key changed/added classes in this PR
* `QueryContextParameter`
* `HumanReadableBytes`
<hr>
This PR has:
- [x] been self-reviewed.
- [x] added documentation for new or modified features or behaviors.
- [x] a release note entry in the PR description.
- [x] added unit tests or modified existing tests to cover new code paths,
ensuring the threshold for code coverage is met.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]