Skip to content

Commit

Permalink
chore: thread nullable to decimal method
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Sep 15, 2024
1 parent 246e1ba commit 1f45c14
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ibis/backends/sql/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ def from_string(cls, text: str, nullable: bool | None = None) -> dt.DataType:
if dtype := cls.unknown_type_strings.get(text.lower()):
return dtype

if nullable is None:
nullable = cls.default_nullable

try:
sgtype = sg.parse_one(text, into=sge.DataType, read=cls.dialect)
except sg.errors.ParseError:
Expand Down Expand Up @@ -501,7 +504,9 @@ def from_string(cls, text: str, nullable: bool | None = None) -> dt.DataType:
if text.lower().startswith("vector"):
text = "vector"

return super().from_string(text, nullable=nullable)
return super().from_string(
text, nullable=nullable if nullable is not None else cls.default_nullable
)


class RisingWaveType(PostgresType):
Expand Down Expand Up @@ -752,7 +757,7 @@ def _from_sqlglot_DECIMAL(
if scale is None or int(scale.this.this) == 0:
return dt.Int64(nullable=nullable)
else:
return super()._from_sqlglot_DECIMAL(precision, scale)
return super()._from_sqlglot_DECIMAL(precision, scale, nullable=nullable)

@classmethod
def _from_sqlglot_ARRAY(
Expand Down

0 comments on commit 1f45c14

Please sign in to comment.