Skip to content

Commit 3f1fd93

Browse files
use stronger typing in convert_value (object instead of Any)
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent cc86832 commit 3f1fd93

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

src/databricks/sql/backend/sea/utils/conversion.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import decimal
1010
import logging
1111
from dateutil import parser
12-
from typing import Any, Callable, Dict, Optional, Union
12+
from typing import Callable, Dict, Optional
1313

1414
logger = logging.getLogger(__name__)
1515

@@ -129,7 +129,7 @@ def convert_value(
129129
value: str,
130130
sql_type: str,
131131
**kwargs,
132-
) -> Any:
132+
) -> object:
133133
"""
134134
Convert a string value to the appropriate Python type based on SQL type.
135135
@@ -142,9 +142,6 @@ def convert_value(
142142
The converted value in the appropriate Python type
143143
"""
144144

145-
if value is None:
146-
return None
147-
148145
sql_type = sql_type.lower().strip()
149146

150147
if sql_type not in SqlTypeConverter.TYPE_MAPPING:

tests/unit/test_sea_conversion.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515
class TestSqlTypeConverter:
1616
"""Test suite for the SqlTypeConverter class."""
1717

18-
def test_convert_value_null(self):
19-
"""Test converting null values."""
20-
assert SqlTypeConverter.convert_value(None, SqlType.INT) is None
21-
assert SqlTypeConverter.convert_value(None, SqlType.STRING) is None
22-
assert SqlTypeConverter.convert_value(None, SqlType.BOOLEAN) is None
23-
2418
def test_convert_numeric_types(self):
2519
"""Test converting numeric types."""
2620
# Test integer types

0 commit comments

Comments
 (0)