feat: IbisLazyFrame support#2000
Conversation
|
I want ibis support in narwhals and can help to get this landed. Ping me if you want a review or help! Cc for visibility @cpcloud, the maintainer of ibis |
|
thanks @NickCrews for your help! sure - we're in the middle of some large refactors so it may be prudent to wait a bit to avoid too many merge conflicts, but we will get to this |
|
|
Hey @rwhitten577 - we're done with the big refactors, so if it interests you to continue, we'd love to ship this 🚢 🚀 I'd suggest not worrying about doing anything different for selectors just yet (it looks to me like they call |
|
How would this land? (Just considering to be ready when ibis ships to Narwhals :) ) Something like this: NarwhalsFrame = from_native(ibis_frame) .. do narwhals operations |
|
yup,that's right! we'd just translate to the ibis api, so whatever backend is set there would be used |
|
Hey @MarcoGorelli, I will try to pick this back up in the next few weeks. I haven't looked through all the refactor changes yet, but do you think I'd be better off rebasing this old branch or are the changes significant enough where I'd want to start over and use duckdb or spark as an example? |
|
awesome, thanks @rwhitten577 ! i think it might be salvageable to continue from here, but still using |
b0763ae to
82c41f8
Compare
5b12e12 to
15e89c9
Compare
They were being typed as `Any` as they used `ibis.__init__.__getattr__`
Fixes bug introduced in (narwhals-dev@529c196)
dangotbanned
left a comment
There was a problem hiding this comment.
Thanks for all your work on this @rwhitten577!
With everything in (#2000 (review)) resolved - I'm approving ❤️
Definitely would need an approval from @MarcoGorelli or @FBruzzesi as well - but I'm happy with where this is at 🎉
There was a problem hiding this comment.
Amazing, thanks @rwhitten577 and @dangotbanned for reviewing!
Got some mostly minor comments. I've split out some follow-ups in #2525
The most important comments from my end are:
- not casting to string for numerical ops
- not repeatedly calling
.dropbut instead collecting the items to drop into a list first (injoin). In theory I think Ibis should be able to optimise this away, but I don't know if they do, so it's probably safer to just calldroponce with everything we need to drop
Once this is addressed, we can ship it
| context: _FullContext, | ||
| ) -> Self: | ||
| def func(df: IbisLazyFrame) -> list[ir.Column]: | ||
| return [df.native[name] for name in evaluate_column_names(df)] |
There was a problem hiding this comment.
can we just use col(name) here, like we do for spark-like / duckdb?
There was a problem hiding this comment.
We can only do getattr(col, name) where col == ibis._. This leads to test errors though where Ibis cannot determine the data type of a deferred value when done this way. Accessing from the native df is the only way I've found to reference the actual column with type info.
There was a problem hiding this comment.
cool, thanks for explaining
aiming for a full review today, hopefully we can ship it
MarcoGorelli
left a comment
There was a problem hiding this comment.
thanks @rwhitten577, and @dangotbanned for reviewing
happy with the code now, and we've opened issues with Ibis for missing features on their end
let's ship it! 2 approval gifs here as this was an extra-large one
|
Awesome! Thanks @dangotbanned and @MarcoGorelli for reviewing! |


What type of PR is this? (check all applicable)
Related issues
Checklist
If you have comments or can explain your changes, please do so below