sunlishuo25 opened a new pull request, #68706:
URL: https://github.com/apache/doris/pull/68706
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary: `ParseUtil.analyzeDataVolume` accepts a numeric value that
fits in a `long`, then multiplies it by its unit without checking whether the
byte count still fits. For example, `analyzeDataVolume("8192PB")` returns
`Long.MIN_VALUE`, and `analyzeDataVolume("16385PB")` wraps to the smaller
positive value `1125899906842624` instead of rejecting the input.
Use `Math.multiplyExact` and translate overflow to the existing checked
`AnalysisException` invalid-data-volume contract. Add tests for the valid
maximum and first invalid value of every supported unit, omitted units, invalid
input, and positive overflow. The helper is used by data-volume analysis for
database quotas, outfile sizes, estimated partition sizes, and several session
variables; caller-specific exception handling is unchanged. No end-to-end SQL
behavior is claimed by the focused validation below.
### Release note
Reject data-volume values whose converted byte count exceeds
`Long.MAX_VALUE`.
### Check List (For Author)
- Test
- [ ] Regression test
- [x] Unit Test
- [ ] Manual test
- [ ] No need to test or manual test.
Standalone compilation of the real Doris source and added JUnit tests,
with no production stubs: 14/14 cases pass on this commit; the same tests have
11 failures on the base source. A separate AI review/test session added 87
cases (including a fixed-seed `BigInteger` oracle over 1,056 inputs): all 87
pass on this commit, with 17 failing on the base. Changed production and test
files pass the project's Checkstyle 9.3 rules.
These are focused helper tests, using JDK 21.0.12.1 with `javac --release
17`, JUnit 5.14.1, and Guava 33.2.1-jre. They do not validate the full Maven
reactor or all declared runtime dependencies. The shared harness includes Log4j
API 2.24.3, while the base POM declares 2.25.5; this helper does not use Log4j.
The official `run-fe-ut.sh` was attempted but stopped at its JDK 17 preflight.
JDK 17 and thirdparty `protoc` are absent locally. Full official FE/BE suites
and SQL/cluster regression tests have not run; CI validation remains
outstanding.
- Behavior changed:
- [ ] No.
- [x] Yes. Volumes that overflow during unit conversion now raise
`AnalysisException`; valid conversion results and signatures are unchanged.
- Does this need documentation?
- [x] No.
- [ ] Yes.
### Tooling disclosure
AI-assisted source analysis, implementation, tests, and PR drafting with
OpenAI Codex (GPT-6). The separate review and test session was also
AI-assisted, not human acceptance. The commit includes `Generated-by: OpenAI
Codex (GPT-6)`.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
--
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]