-
Notifications
You must be signed in to change notification settings - Fork 609
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
feat: unbind expression #4536
Comments
For those backends that have
|
I like the idea, also it's kinda a prerequisite to properly serialize a bound expression. Lowering a Something like the following could work (haven't tried it): import ibis.expr.analysis as an
def unbind(op):
if isinstance(op, ops.DatabaseTable):
return ops.UnboundTable(name=op.name, schema=op.schema)
else:
return op
unbound_node = an.substitute(unbind, bound_node) |
Calling `unbind()` on an expression returns an equivalent expression but with all references to backend-specific tables, e.g. `AlchemyTable`, `PandasTable`... translated into `UnboundTable`. Should help with serialization of expressions and ease execution of expressions across backends. Resolves ibis-project#4536
Calling `unbind()` on an expression returns an equivalent expression but with all references to backend-specific tables, e.g. `AlchemyTable`, `PandasTable`... translated into `UnboundTable`. Should help with serialization of expressions and ease execution of expressions across backends. Resolves ibis-project#4536
Calling `unbind()` on an expression returns an equivalent expression but with all references to backend-specific tables, e.g. `AlchemyTable`, `PandasTable`... translated into `UnboundTable`. Should help with serialization of expressions and ease execution of expressions across backends. Resolves #4536
I've run into the situation a few times where I have an existing Ibis expression that I pass to some function and it would work except that I am not using unbound tables and so that operation fails.
This just happened to me with @kszucs 's decompiler PR, but also happens when using Ibis-substrait.
I also think that, outside of those possibly uncommon use-cases, often we have a schema already defined in a backend somewhere and we want the equivalent unbound table -- this isn't terribly hard to do, but it's annoying if you don't notice until you are several steps deep.
So, how about an
unbind()
for Expressions that returns the same expression but withUnboundTable
in place ofDatabaseTable
Then
con.execute(expr.unbind()) == expr.execute()
Some other thoughts / ideas / edge-cases:
What to do with
memtable
? Should it return the unbound expression AND the data underlying the memtable?Should all of the backends return either data or sufficient metadata to reload the table in question?
(That should probably be behind a feature flag, I think, or the
execute(expr.unbind())
thing falls down.cc @saulpw @cpcloud
The text was updated successfully, but these errors were encountered: