Skip to content

Commit db7b8e5

Browse files
remove unused helper methods in SqlType
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 7664e44 commit db7b8e5

File tree

3 files changed

+0
-280
lines changed

3 files changed

+0
-280
lines changed

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

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -55,50 +55,6 @@ class SqlType:
5555
NULL = "null"
5656
USER_DEFINED_TYPE = "user_defined_type"
5757

58-
@classmethod
59-
def is_numeric(cls, sql_type: str) -> bool:
60-
"""Check if the SQL type is a numeric type."""
61-
return sql_type.lower() in (
62-
cls.BYTE,
63-
cls.SHORT,
64-
cls.INT,
65-
cls.LONG,
66-
cls.FLOAT,
67-
cls.DOUBLE,
68-
cls.DECIMAL,
69-
)
70-
71-
@classmethod
72-
def is_boolean(cls, sql_type: str) -> bool:
73-
"""Check if the SQL type is a boolean type."""
74-
return sql_type.lower() == cls.BOOLEAN
75-
76-
@classmethod
77-
def is_datetime(cls, sql_type: str) -> bool:
78-
"""Check if the SQL type is a date/time type."""
79-
return sql_type.lower() in (cls.DATE, cls.TIMESTAMP, cls.INTERVAL)
80-
81-
@classmethod
82-
def is_string(cls, sql_type: str) -> bool:
83-
"""Check if the SQL type is a string type."""
84-
return sql_type.lower() in (cls.CHAR, cls.STRING)
85-
86-
@classmethod
87-
def is_binary(cls, sql_type: str) -> bool:
88-
"""Check if the SQL type is a binary type."""
89-
return sql_type.lower() == cls.BINARY
90-
91-
@classmethod
92-
def is_complex(cls, sql_type: str) -> bool:
93-
"""Check if the SQL type is a complex type."""
94-
sql_type = sql_type.lower()
95-
return (
96-
sql_type.startswith(cls.ARRAY)
97-
or sql_type.startswith(cls.MAP)
98-
or sql_type.startswith(cls.STRUCT)
99-
or sql_type == cls.USER_DEFINED_TYPE
100-
)
101-
10258

10359
class SqlTypeConverter:
10460
"""

tests/unit/test_conversion.py

Lines changed: 0 additions & 158 deletions
This file was deleted.

tests/unit/test_sea_conversion.py

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -12,84 +12,6 @@
1212
from databricks.sql.backend.sea.conversion import SqlType, SqlTypeConverter
1313

1414

15-
class TestSqlType:
16-
"""Test suite for the SqlType class."""
17-
18-
def test_is_numeric(self):
19-
"""Test the is_numeric method."""
20-
assert SqlType.is_numeric(SqlType.BYTE)
21-
assert SqlType.is_numeric(SqlType.SHORT)
22-
assert SqlType.is_numeric(SqlType.INT)
23-
assert SqlType.is_numeric(SqlType.LONG)
24-
assert SqlType.is_numeric(SqlType.FLOAT)
25-
assert SqlType.is_numeric(SqlType.DOUBLE)
26-
assert SqlType.is_numeric(SqlType.DECIMAL)
27-
28-
# Test with uppercase
29-
assert SqlType.is_numeric("INT")
30-
assert SqlType.is_numeric("DECIMAL")
31-
32-
# Test non-numeric types
33-
assert not SqlType.is_numeric(SqlType.STRING)
34-
assert not SqlType.is_numeric(SqlType.BOOLEAN)
35-
assert not SqlType.is_numeric(SqlType.DATE)
36-
37-
def test_is_boolean(self):
38-
"""Test the is_boolean method."""
39-
assert SqlType.is_boolean(SqlType.BOOLEAN)
40-
assert SqlType.is_boolean("BOOLEAN")
41-
42-
# Test non-boolean types
43-
assert not SqlType.is_boolean(SqlType.STRING)
44-
assert not SqlType.is_boolean(SqlType.INT)
45-
46-
def test_is_datetime(self):
47-
"""Test the is_datetime method."""
48-
assert SqlType.is_datetime(SqlType.DATE)
49-
assert SqlType.is_datetime(SqlType.TIMESTAMP)
50-
assert SqlType.is_datetime(SqlType.INTERVAL)
51-
assert SqlType.is_datetime("DATE")
52-
assert SqlType.is_datetime("TIMESTAMP")
53-
54-
# Test non-datetime types
55-
assert not SqlType.is_datetime(SqlType.STRING)
56-
assert not SqlType.is_datetime(SqlType.INT)
57-
58-
def test_is_string(self):
59-
"""Test the is_string method."""
60-
assert SqlType.is_string(SqlType.STRING)
61-
assert SqlType.is_string(SqlType.CHAR)
62-
assert SqlType.is_string("STRING")
63-
assert SqlType.is_string("CHAR")
64-
65-
# Test non-string types
66-
assert not SqlType.is_string(SqlType.INT)
67-
assert not SqlType.is_string(SqlType.BOOLEAN)
68-
69-
def test_is_binary(self):
70-
"""Test the is_binary method."""
71-
assert SqlType.is_binary(SqlType.BINARY)
72-
assert SqlType.is_binary("BINARY")
73-
74-
# Test non-binary types
75-
assert not SqlType.is_binary(SqlType.STRING)
76-
assert not SqlType.is_binary(SqlType.INT)
77-
78-
def test_is_complex(self):
79-
"""Test the is_complex method."""
80-
assert SqlType.is_complex(SqlType.ARRAY)
81-
assert SqlType.is_complex(SqlType.MAP)
82-
assert SqlType.is_complex(SqlType.STRUCT)
83-
assert SqlType.is_complex(SqlType.USER_DEFINED_TYPE)
84-
assert SqlType.is_complex("ARRAY<int>")
85-
assert SqlType.is_complex("MAP<string,int>")
86-
assert SqlType.is_complex("STRUCT<name:string,age:int>")
87-
88-
# Test non-complex types
89-
assert not SqlType.is_complex(SqlType.STRING)
90-
assert not SqlType.is_complex(SqlType.INT)
91-
92-
9315
class TestSqlTypeConverter:
9416
"""Test suite for the SqlTypeConverter class."""
9517

0 commit comments

Comments
 (0)