Skip to content

Commit

Permalink
Update reinterpret and timedelta to explicitly cast to int64 instead …
Browse files Browse the repository at this point in the history
…of int
  • Loading branch information
ayushdg committed Apr 26, 2022
1 parent 821ccde commit f18d16b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions dask_sql/mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,6 @@ def sql_to_python_type(sql_type: str) -> type:
if sql_type.startswith("CHAR(") or sql_type.startswith("VARCHAR("):
return pd.StringDtype()
elif sql_type.startswith("INTERVAL"):
interval_type = sql_type.split()[1].lower()
if interval_type in {"year", "quarter", "month"}:
# if sql_type is INTERVAL YEAR, Calcite will covert to months
return np.dtype("timedelta64[M]")
return np.dtype("<m8[ns]")

elif sql_type.startswith("TIMESTAMP(") or sql_type.startswith("TIME("):
Expand Down Expand Up @@ -304,7 +300,7 @@ def cast_column_to_type(col: dd.Series, expected_type: str):
col = da.trunc(col.fillna(value=np.NaN))

if current_timedelta_type and expected_integer:
res = col.astype(int)
res = col.astype(np.int64)
else:
res = col.astype(expected_type)

Expand Down
2 changes: 1 addition & 1 deletion dask_sql/physical/rex/core/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def div(self, lhs, rhs):
return result
else: # pragma: no cover
result = da.trunc(result)
result = result.astype(int)
result = result.astype(np.int64)
return result


Expand Down

0 comments on commit f18d16b

Please sign in to comment.