Skip to content

[ENH] Add support for Decimal types #1054

@randerzander

Description

@randerzander

A simple test of querying data which has decimal columns fails:

>>> import cudf
>>> df  = cudf.DataFrame({"id": [0, 1, 2]}
>>> ddf = dd.from_cudf(df, npartitions=1)
>>> ddf["id"] = ddf["id"].astype(Decimal64Dtype(10, 2))

>>> from dask_sql import Context
>>> c = Context()
>>> c.create_table("ddf", ddf)
>>> c.sql("select sum(id) from ddf").compute()

Trace:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
    c.sql("select sum(id) from ddf").compute()
  File "/raid/rgelhausen/conda/envs/pynds3/lib/python3.10/site-packages/dask_sql/context.py", line 515, in sql
    rel, _ = self._get_ral(sql)
  File "/raid/rgelhausen/conda/envs/pynds3/lib/python3.10/site-packages/dask_sql/context.py", line 817, in _get_ral
    schemas = self._prepare_schemas()
  File "/raid/rgelhausen/conda/envs/pynds3/lib/python3.10/site-packages/dask_sql/context.py", line 777, in _prepare_schemas
    sql_data_type = python_to_sql_type(data_type)
  File "/raid/rgelhausen/conda/envs/pynds3/lib/python3.10/site-packages/dask_sql/mappings.py", line 113, in python_to_sql_type
    raise NotImplementedError(
NotImplementedError: The python type decimal64 is not implemented (yet)

Metadata

Metadata

Assignees

Labels

datafusionRelated to work in DataFusionenhancementNew feature or requestpythonAffects Python API

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions