Fix float inference to use DoubleParameter (64-bit) instead of FloatP…#742
Conversation
…arameter (32-bit) Signed-off-by: Shubhambhusate <bhusates6@gmail.com>
|
Issue link: #741 |
|
Hi @msrathore-db Can you please review the PR |
Adding @jprakash-db for review as he has more context on the same |
|
Hi @jprakash-db Can you please review this PR? |
gopalldb
left a comment
There was a problem hiding this comment.
A minor comment on test, will also let Jothi also take a look
|
Overall LGTM. |
|
Hi @jprakash-db Do we have any ETA for the PR to be merged, and the fix will be available? |
|
@Shubhambhusate Looks like the creds are not available in this forked branch to run the e2e. Let me run them manually and I will update the status here |
|
@Shubhambhusate We have merged it , thanks for the contribution |
|
Hi @jprakash-db Thanks for merging it. Could you please let me know when the fix will be available to the user? |
|
@Shubhambhusate We are going to cut a release in this week tentatively, so you can expect by coming Monday |
|
Thanks for the update. |
…arameter (32-bit)
What type of PR is this?
Description
dbsql_parameter_from_primitive() in src/databricks/sql/parameters/native.py currently maps Python's float type to FloatParameter, which binds values as Databricks SQL FLOAT (32-bit single-precision). However, Python's float is a 64-bit IEEE 754 double-precision number, so this mapping silently truncates precision.
This PR changes the inference to use DoubleParameter instead, which binds values as Databricks SQL DOUBLE (64-bit) and correctly preserves the full precision of Python floats.
Before (buggy):
After (fixed):
How is this tested?
All 55 unit tests in tests/unit/test_parameters.py pass, including test_inference[DoubleParameter-Primitive.FLOAT].
Manually verified that parameterized queries with raw Python floats now preserve full 64-bit precision when inserted into DOUBLE columns.
Related Tickets & Documents