Skip to content

Commit

Permalink
fix(datafusion): handle timestamp types
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Apr 13, 2024
1 parent 609c15f commit f762aae
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ibis/backends/sql/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,23 @@ class DataFusionType(PostgresType):
unknown_type_strings = {
"utf8": dt.string,
"float64": dt.float64,
"float32": dt.float32,
}

@classmethod
def _from_sqlglot_TIMESTAMP(cls, scale, tz) -> dt.Timestamp:
scales = {"SECOND": 0, "MILLISECOND": 3, "MICROSECOND": 6, "NANOSECOND": 9}

assert tz is not None

tz = tz.this.this

return dt.Timestamp(
scale=scales[scale.this.this],
timezone=None if tz == "NONE" else tz,
nullable=cls.default_nullable,
)


class MySQLType(SqlglotType):
dialect = "mysql"
Expand Down

0 comments on commit f762aae

Please sign in to comment.