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

bug: ExtractHour from time is not mapped #519

Open
Tishj opened this issue Mar 1, 2023 · 1 comment
Open

bug: ExtractHour from time is not mapped #519

Tishj opened this issue Mar 1, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@Tishj
Copy link

Tishj commented Mar 1, 2023

What happened?

I am not sure if I'm just holding it wrong, but I am trying to test some substrait roundtripping and wanted to use Ibis to generate some json serialized substrait plans.

I ran the following code:

import ibis_substrait
from ibis_substrait.compiler.core import SubstraitCompiler
import ibis.expr.datatypes as dt

compiler = SubstraitCompiler()

t = ibis.table([("d", dt.time)], name="dates")
expr = t[getattr(t.d, "hour")()]

from google.protobuf import json_format

proto = compiler.compile(expr)

json_plan = json_format.MessageToJson(proto)
print(json_plan)

And I ran into an exception:

  File "/opt/homebrew/lib/python3.10/site-packages/ibis_substrait/compiler/core.py", line 75, in function_id
    op_name = IBIS_SUBSTRAIT_OP_MAPPING[op_type.__name__]
KeyError: 'ExtractHour'

What version of ibis-substrait are you using?

>>> ibis_substrait.__version__
'2.22.0'

What substrait consumer(s) are you using, if any?

Relevant log output

Traceback (most recent call last):
  File "ibis_extract.py", line 23, in <module>
    proto = compiler.compile(expr)
  File "/opt/homebrew/lib/python3.10/site-packages/ibis_substrait/compiler/core.py", line 96, in compile
    input=translate(expr.op(), expr=expr, compiler=self, **kwargs),
  File "/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/functools.py", line 889, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/opt/homebrew/lib/python3.10/site-packages/ibis_substrait/compiler/translate.py", line 824, in selection
    expressions=[
  File "/opt/homebrew/lib/python3.10/site-packages/ibis_substrait/compiler/translate.py", line 825, in <listcomp>
    translate(
  File "/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/functools.py", line 889, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/opt/homebrew/lib/python3.10/site-packages/ibis_substrait/compiler/translate.py", line 236, in _expr
    return translate(expr.op(), expr, compiler=compiler, **kwargs)
  File "/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/functools.py", line 889, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/opt/homebrew/lib/python3.10/site-packages/ibis_substrait/compiler/translate.py", line 524, in value_op
    function_reference=compiler.function_id(expr=expr),
  File "/opt/homebrew/lib/python3.10/site-packages/ibis_substrait/compiler/core.py", line 75, in function_id
    op_name = IBIS_SUBSTRAIT_OP_MAPPING[op_type.__name__]
KeyError: 'ExtractHour'
@Tishj Tishj added the bug Something isn't working label Mar 1, 2023
@gforsyth
Copy link
Member

gforsyth commented Mar 1, 2023

Thanks for raising this, @Tishj ! Yeah, looks like we forgot to add handling for timestamp extraction ops. I'll add that to the list!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: backlog
Development

No branches or pull requests

2 participants