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

feat: Expose length of Iterators #692

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

c-thiel
Copy link
Collaborator

@c-thiel c-thiel commented Nov 9, 2024

In iceberg-rust we currently have quite a few Iterators over fields without a lightweight option to determine length. In Lakekeeper we have some places where we need to know the length of fields - especially for the Iterators used in TableMetadata. Using xx_iter().count() isn't nice.

It would be great if we could expose the len in a more straightforward way, either by explicit methods or by using ExactSizeIterator as proposed in this PR.

Let me know what you think!

@c-thiel c-thiel changed the title feat: Expose length of Iterators via ExactSizeIterator feat: Expose length of Iterators Nov 9, 2024
@c-thiel
Copy link
Collaborator Author

c-thiel commented Nov 10, 2024

Alternatively we could expose the Hashmaps directly? Those would provide a few more accessors than any proxy type

Copy link
Contributor

@liurenjie1024 liurenjie1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @c-thiel for this!

@liurenjie1024
Copy link
Contributor

Alternatively we could expose the Hashmaps directly? Those would provide a few more accessors than any proxy type

I'm not a big fan of exposing concrete underlying data structures directly. I think we have provided enough look up methods such as get by id, is there any cases that can't be satisfied?

@liurenjie1024 liurenjie1024 merged commit 213f84e into apache:main Nov 11, 2024
16 checks passed
@c-thiel
Copy link
Collaborator Author

c-thiel commented Nov 11, 2024

I think we are good for now, thanks!

twuebi pushed a commit to lakekeeper/iceberg-rust that referenced this pull request Nov 11, 2024
ZENOTME pushed a commit to risingwavelabs/iceberg-rust that referenced this pull request Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants