Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Support SQL "replace" function #895

Closed
randerzander opened this issue Oct 26, 2022 · 0 comments · Fixed by #897
Closed

[ENH] Support SQL "replace" function #895

randerzander opened this issue Oct 26, 2022 · 0 comments · Fixed by #897
Assignees
Labels
enhancement New feature or request needs triage Awaiting triage by a dask-sql maintainer

Comments

@randerzander
Copy link
Collaborator

>>> from dask_sql import Context
>>> import pandas as pd

>>> c = Context()
>>> df = pd.DataFrame({"id": ["abc", "def", "bcd"]})
>>> c.create_table("df", df)
>>> c.sql("select replace(id, 'b', '') from df").compute()
Traceback (most recent call last):
  File "/opt/conda/envs/rapids/lib/python3.9/site-packages/dask_sql/physical/rex/core/call.py", line 1004, in convert
    operation = self.OPERATION_MAPPING[operator_name]
KeyError: 'replace'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/envs/rapids/lib/python3.9/site-packages/dask_sql/physical/rex/core/call.py", line 1007, in convert
    operation = context.schema[schema_name].functions[operator_name]
KeyError: 'replace'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/envs/rapids/lib/python3.9/site-packages/dask_sql/context.py", line 501, in sql
    return self._compute_table_from_rel(rel, return_futures)
  File "/opt/conda/envs/rapids/lib/python3.9/site-packages/dask_sql/context.py", line 830, in _compute_table_from_rel
    dc = RelConverter.convert(rel, context=self)
  File "/opt/conda/envs/rapids/lib/python3.9/site-packages/dask_sql/physical/rel/convert.py", line 61, in convert
    df = plugin_instance.convert(rel, context=context)
  File "/opt/conda/envs/rapids/lib/python3.9/site-packages/dask_sql/physical/rel/logical/project.py", line 57, in convert
    new_columns[random_name] = RexConverter.convert(
  File "/opt/conda/envs/rapids/lib/python3.9/site-packages/dask_sql/physical/rex/convert.py", line 73, in convert
    df = plugin_instance.convert(rel, rex, dc, context=context)
  File "/opt/conda/envs/rapids/lib/python3.9/site-packages/dask_sql/physical/rex/core/call.py", line 1009, in convert
    raise NotImplementedError(f"{operator_name} not (yet) implemented")
NotImplementedError: replace not (yet) implemented

Expected:

ac
def
cd
@randerzander randerzander added enhancement New feature or request needs triage Awaiting triage by a dask-sql maintainer labels Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage Awaiting triage by a dask-sql maintainer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants