Repository navigation
[coverage] Conformance findings: PARAMQUERY-021 (#901) #1006
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
Open
peco-engineer-bot
wants to merge
14
commits into
main
Choose a base branch
from
ai/issue-901
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8c170bf
[coverage] Conformance findings: PARAMQUERY-021 (#901)
5e09830
ai: apply changes for #1006 (3 review threads)
peco-engineer-bot[bot] d578b17
ai: apply changes for #1006 (1 review thread)
peco-engineer-bot[bot] 72cdd60
ai: apply changes for #1006 (3 review threads)
peco-engineer-bot[bot] 864acfa
ai: apply changes for #1006 (2 review threads)
peco-engineer-bot[bot] 2823eed
ai: apply changes for #1006 (3 review threads)
peco-engineer-bot[bot] 2518fc6
ai: apply changes for #1006 (2 review threads)
peco-engineer-bot[bot] 6177ab4
ai: apply changes for #1006 (3 review threads)
peco-engineer-bot[bot] 2b3a85a
ai: apply changes for #1006 (2 review threads)
peco-engineer-bot[bot] 25634d4
ai: apply changes for #1006 (2 review threads)
peco-engineer-bot[bot] 1eff019
ai: apply changes for #1006 (2 review threads)
peco-engineer-bot[bot] 9036107
ai: apply changes for #1006 (1 review thread)
peco-engineer-bot[bot] 1bda507
ai: apply changes for #1006 (1 review thread)
peco-engineer-bot[bot] 97b8aca
ai: apply changes for #1006 (1 review thread)
peco-engineer-bot[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🔵 Low — The
precision == 0fallback runs before the range checks and setsscale/precisiontoNone. As a result,scaleis never validated on this path.DecimalParameter(v, scale=-1, precision=0)andDecimalParameter(v, scale=500, precision=0)only emit theFutureWarningand fall back to inference. The equivalent call with a nonzero precision, such asscale=-1, precision=10, raisesValueError("scale must be >= 0").The CHANGELOG says a negative
scalenow raises, but that is not true whenprecision=0. Earlier releases accepted these inputs too, so this is not a regression. Still, a clearly invalidscaleis probably better reported here than hidden behind a migration warning. Suggested fix: run thescale < 0/scale > MAX_PRECISIONchecks before the precision=0 fallback, or note this exception in the CHANGELOG.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.
Add a test for the precision=0 invalid-scale case.
Pushed 1bda507.
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 picking this up. I can't see the fix at head, though. The
precision == 0branch still runs before the range checks and sets both fields toNone, soDecimalParameter(v, scale=-1, precision=0)andscale=500, precision=0still only warn and fall back to inference. The only precision=0 test intests/unit/test_parameters.pyistest_decimal_precision_zero_falls_back_to_inferred_type_with_warning, and it uses only valid scales (0, 5, 10), so it doesn't cover the invalid-scale case. The CHANGELOG still says "a negativescale" raises, without mentioning that precision=0 is an exception. To close this, either move thescale < 0/scale > MAX_PRECISIONchecks above the precision=0 fallback and add a test assertingValueErrorfor those inputs, or note the exception in the CHANGELOG. I'm leaving this open for a human to look at.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.
The fix is already in the current branch head; I made no edits and the working tree is clean. In
DecimalParameter.__init__(src/databricks/sql/parameters/native.py), thescale < 0andscale > MAX_PRECISIONchecks now run before theprecision == 0fallback, soscale=-1, precision=0andscale=500, precision=0raiseValueErrorinstead of only warning. The new testtest_decimal_precision_zero_with_invalid_scale_raisesin tests/unit/test_parameters.py covers both inputs and turnsFutureWarninginto an error, so the migration warning can't hide a missing raise.tests/unit/test_parameters.pypasses (104 tests, run with-m "not realkernel"). The CHANGELOG line about a negativescaleraising is now true on every path, so it needs no exception note. The review-bot probably looked at an older ref. A human should confirm the fix at head and resolve the thread.