fix(account_parameter): cast FLOAT-typed parameters to a Python float - #76
Merged
Merged
Conversation
SHOW PARAMETERS reports INITIAL_REPLICATION_SIZE_LIMIT_IN_TB (and other decimal-valued parameters) with type FLOAT, not NUMBER. _cast_param_value had no branch for it, so it fell through to the raw-string default and stayed a str, while the YAML-declared value parses to a Python float. Comparing "10.0" != 10.0 made plan propose the same UPDATE on every run, even though both sides render identically in the diff table.
Review of PR #76No issues found. The change adds a
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
snowcap applyreported a phantom~ UPDATEforINITIAL_REPLICATION_SIZE_LIMIT_IN_TBon every run, with the diff table showing identical10.0->10.0.Root cause:
SHOW PARAMETERS IN ACCOUNTreports this parameter'stypecolumn asFLOAT(confirmed live), notNUMBER._cast_param_valueonly handledBOOLEAN/NUMBER/STRING, so it fell through to theelse: return raw_valuebranch and the fetched value stayed a raw string ("10.0"). The YAML-declared value parses via PyYAML into a Pythonfloat(10.0). The diff inblueprint.pycompares these with a plain!=, so"10.0" != 10.0registers as a real change, while the printed table stringifies both sides independently for display, hiding the type mismatch._cast_param_valueis the single shared function behind every SHOW-PARAMETERS-driven fetch (account, warehouse, table, task, and user parameters), so this fixes the same latent bug class for any FLOAT-typed parameter across all of those, not just this one.Fix
Added a
FLOATbranch to_cast_param_valuethat parses the raw string to a Pythonfloat, mirroring the existingNUMBERbranch's error handling.Test plan
test_float/test_invalid_float_raisestoTestCastParamValue, and an end-to-endTestFetchAccountParametertest reproducing the exact reported repro (SHOW PARAMETERS row typedFLOAT).'10.0' == 10.0assertion error) and pass after.python -m pytest tests/ --ignore=tests/integration(2218 passed, 1 skipped, 1 xfailed).make lint(black, codespell, ruff) andmake typecheck(mypy) pass on tracked files.