Skip to content

Commit

Permalink
fix(sqlglot): handle new nullable type field
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Aug 19, 2024
1 parent c15cc61 commit 20ad9d5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ibis/backends/sql/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,12 +1056,14 @@ class ClickHouseType(SqlglotType):
def from_ibis(cls, dtype: dt.DataType) -> sge.DataType:
typ = super().from_ibis(dtype)
# nested types cannot be nullable in clickhouse
if dtype.nullable and not (
dtype.is_map() or dtype.is_array() or dtype.is_struct()
typ.args["nullable"] = False
if (
dtype.nullable
and not (dtype.is_map() or dtype.is_array() or dtype.is_struct())
and typ.args["this"] != typecode.NULLABLE
):
return sge.DataType(this=typecode.NULLABLE, expressions=[typ])
else:
return typ
return typ

@classmethod
def _from_sqlglot_NULLABLE(cls, inner_type: sge.DataType) -> dt.DataType:
Expand Down

0 comments on commit 20ad9d5

Please sign in to comment.