-
Notifications
You must be signed in to change notification settings - Fork 70
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
generalize toListImpl to support conversions into lists and sequences #1046
base: master
Are you sure you want to change the base?
Conversation
f38649f
to
9781085
Compare
I am note entirely sure, if I correctly followed the pattern of separation between interface and implementation - Not that familiar with Kotlin. Let me know if you want some stuff changed / reorganized! |
Hi! It's a good improvement and contributions are welcome, so thank you for the interesting proposal :) I looked at the implementation and noticed that data is still converted eagerly for two reasons: |
The previous implementation already was based on iterating over rows, with this generalization, the user can now decide whether to eagerly convert a dataframe into a list, or use lazy transformations via a sequence.
9781085
to
4afa823
Compare
Nice to hear that :-) Oh yes - I just looked up the difference between Kotlin Iterable and Sequence - I thought they were both lazy 🤷🏼 - Now I understand ! Added to W.r.t. to making the inner / nested objects lazy: I don't think that would give the user a large benefit - at least not when converting into data classes which probably usually hold lists anyway: When the lazy outer conversion reaches a nested List object it has to convert that one eagerly anyway? That said: I could have a look into implementing that - but I am not sure if I would succeed 😁 |
In fact i also suggest to maybe not improve this further for now. If your dataframes are flat, without ColumnGroup or FrameColumn, it will work as you expect with Sequence. Here's what will happen if hierarchical data is involved:
Entire Example with FrameColumn:
Entire |
The previous implementation already was based on iterating over rows, with this generalization, the user can now decide whether to eagerly convert a Dataframe into a list, or use lazy transformations via a sequence.
Resolves: #1045