Skip to content

Commit b2ae83c

Browse files
move helper type name extractor out of class
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 82e9c4f commit b2ae83c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ def _convert_decimal(
5050
return result
5151

5252

53+
def _get_type_name(thrift_type_id: int) -> str:
54+
type_name = ttypes.TTypeId._VALUES_TO_NAMES[thrift_type_id]
55+
type_name = type_name.lower()
56+
if type_name.endswith("_type"):
57+
type_name = type_name[:-5]
58+
return type_name
59+
60+
5361
class SqlType:
5462
"""
5563
SQL type constants based on Thrift TTypeId values.
@@ -58,14 +66,6 @@ class SqlType:
5866
after normalize_sea_type_to_thrift processing (lowercase, without _TYPE suffix).
5967
"""
6068

61-
@staticmethod
62-
def _get_type_name(thrift_type_id: int) -> str:
63-
type_name = ttypes.TTypeId._VALUES_TO_NAMES[thrift_type_id]
64-
type_name = type_name.lower()
65-
if type_name.endswith("_type"):
66-
type_name = type_name[:-5]
67-
return type_name
68-
6969
# Numeric types
7070
TINYINT = _get_type_name(ttypes.TTypeId.TINYINT_TYPE)
7171
SMALLINT = _get_type_name(ttypes.TTypeId.SMALLINT_TYPE)

0 commit comments

Comments
 (0)