Fix truediv binary#672
Merged
Merged
Conversation
sfc-gh-mraba
approved these changes
Apr 17, 2026
sfc-gh-mraba
left a comment
Collaborator
There was a problem hiding this comment.
I believe tests for true div require adjustment.
sfc-gh-mraba
approved these changes
Apr 20, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Please answer these questions before submitting your pull requests. Thanks!
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-2503709: visit_truediv_binary does not have backward compatibility #618
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
This PR restores backward-compatible SQL compilation for true division (/) when force_div_is_floordiv=True by delegating visit_truediv_binary() to SQLAlchemy’s base implementation, which preserves the expected CAST(... AS NUMERIC) behavior. Additional tests were needed because this was a compiler-level regression in generated SQL, so runtime result checks alone would not catch it.
The coverage was added to the existing compiler tests in tests/test_compiler.py (test_division_operator_with_force_div_is_floordiv_default_true and test_division_operator_with_denominator_expr_force_div_is_floordiv_default_true), which already verify nearby / and // behavior for both force_div_is_floordiv=True and False. This is not a new breaking change; it restores the intended behavior of the existing compatibility path while leaving force_div_is_floordiv=False unchanged.