Skip to content

Commit 20735a1

Browse files
committed
address comments
1 parent 3ee94c5 commit 20735a1

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/snowflake/snowpark/_internal/type_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def convert_sf_to_sp_type(
307307
if column_type_name == "REAL":
308308
return DoubleType()
309309
if (column_type_name == "FIXED" or column_type_name == "NUMBER") and scale == 0:
310-
return LongType(precision=precision)
310+
return LongType(_precision=precision)
311311
raise NotImplementedError(
312312
"Unsupported type: {}, precision: {}, scale: {}".format(
313313
column_type_name, precision, scale

src/snowflake/snowpark/types.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,15 +371,23 @@ def _fill_ast(self, ast: proto.DataType) -> None:
371371
# Numeric types
372372
class _IntegralType(_NumericType):
373373
def __init__(self, **kwargs) -> None:
374-
self._precision = kwargs.get("precision", None)
374+
self._precision = kwargs.get("_precision", None)
375+
376+
if kwargs:
377+
raise TypeError(
378+
f"{self.__class__.__name__}() does not accept any arguments, please construct it without parameters."
379+
)
375380

376381
def __eq__(self, other):
377382
def filtered(d: dict) -> dict:
378383
return {k: v for k, v in d.items() if k != "_precision"}
379384

380-
return isinstance(other, self.__class__) and filtered(
381-
self.__dict__
382-
) == filtered(other.__dict__)
385+
if context._is_snowpark_connect_compatible_mode:
386+
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
387+
else:
388+
return isinstance(other, self.__class__) and filtered(
389+
self.__dict__
390+
) == filtered(other.__dict__)
383391

384392
def __hash__(self):
385393
return hash(repr(self))

0 commit comments

Comments
 (0)