-
Notifications
You must be signed in to change notification settings - Fork 39
Add validation for import/export integer params to make sure they are positive #2727
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
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.
Pull Request Overview
This PR adds runtime checks to ensure that integer parameters for import/export commands are strictly positive.
- Introduces
validatePositiveValue
utility and updates import/export commands to use it. - Adds corresponding tests in
CommandLineInputUtilsTest
. - Defines new error codes in
CoreError
for each validation failure.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
data-loader/cli/src/main/java/com/scalar/db/dataloader/cli/util/CommandLineInputUtils.java | Added validatePositiveValue method and Javadoc |
data-loader/cli/src/test/java/com/scalar/db/dataloader/cli/util/CommandLineInputUtilsTest.java | Added tests covering positive, zero, and negative cases |
data-loader/cli/src/main/java/com/scalar/db/dataloader/cli/command/dataimport/ImportCommand.java | Hooked up positive-value checks for import options |
data-loader/cli/src/main/java/com/scalar/db/dataloader/cli/command/dataexport/ExportCommand.java | Hooked up positive-value checks for export options |
core/src/main/java/com/scalar/db/common/error/CoreError.java | Added new error codes for invalid parameter values |
Comments suppressed due to low confidence (2)
data-loader/cli/src/main/java/com/scalar/db/dataloader/cli/util/CommandLineInputUtils.java:57
- The Javadoc for
validatePositiveValue
is missing a@param error
tag and the closing tag* @*/
is incorrect. Replace* @*/
with*/
and add@param error the CoreError to report when the value is not positive
.
* @*/
core/src/main/java/com/scalar/db/common/error/CoreError.java:914
- All four new error constants share the same code "0205", which can cause collisions in error handling. Assign unique codes for each distinct error.
DATA_LOADER_INVALID_DATA_CHUNK_SIZE(
d48368a
to
84c6544
Compare
84c6544
to
d549568
Compare
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! 👍
… data-loader/imprv/add-params-validation
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.
Left a minor comment. Other than that, LGTM! Thank you!
data-loader/cli/src/main/java/com/scalar/db/dataloader/cli/util/CommandLineInputUtils.java
Outdated
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!
Thank you.
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. Thank you.
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, thank you!
Description
This PR adds validation for import/export integer params to make sure they are positive. Intentionally, we don't allow
data chunk size
to be set to0
, which means the file is loaded in memory before importing as the current implementation. PTAL. Thank you.Related issues and/or PRs
NA
Changes made
Checklist
Additional notes (optional)
NA
Release notes
NA