FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix float inference to use DoubleParameter (64-bit) instead of FloatP… by Shubhambhusate · Pull Request #742 · databricks/databricks-sql-python · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion src/databricks/sql/parameters/native.py
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
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ def dbsql_parameter_from_primitive(
elif isinstance(value, str):
return StringParameter(value=value, name=name)
elif isinstance(value, float):
return FloatParameter(value=value, name=name)
return DoubleParameter(value=value, name=name)
elif isinstance(value, datetime.datetime):
return TimestampParameter(value=value, name=name)
elif isinstance(value, datetime.date):
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/test_parameters.py
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
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ def test_tspark_param_ordinal(self):
(BigIntegerParameter, Primitive.BIGINT),
(BooleanParameter, Primitive.BOOL),
(DateParameter, Primitive.DATE),
(FloatParameter, Primitive.FLOAT),
(DoubleParameter, Primitive.DOUBLE),
(DoubleParameter, Primitive.FLOAT),
Comment thread
Shubhambhusate marked this conversation as resolved.
(VoidParameter, Primitive.NONE),
(TimestampParameter, Primitive.TIMESTAMP),
(MapParameter, Primitive.MAP),
Expand All @@ -305,7 +306,7 @@ def test_tspark_param_ordinal(self):
def test_inference(self, _type: TDbsqlParameter, prim: Primitive):
"""This method only tests inferrable types.

Not tested are TinyIntParameter, SmallIntParameter DoubleParameter and TimestampNTZParameter
Not tested are TinyIntParameter, SmallIntParameter, FloatParameter and TimestampNTZParameter
"""

inferred_type = dbsql_parameter_from_primitive(prim.value)
Expand Down
Loading

Back | FazBrowse Home | New Git URL