improve row number estimation#30
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the algorithm for guessing byte offsets when fetching rows at random positions in a CSV file, specifically addressing issue #26 related to handling serial rows more efficiently.
Key Changes:
- Replaced the
isStored()andguessByteOffset()methods in theEstimatorclass with more comprehensivegetStatus(),getFirstMissingRow(), andgetLastMissingRowNumber()methods - Updated the fetch logic in
csvDataFrameto use the new methods, avoiding unnecessary fetches when rows are already cached - Enhanced the algorithm to better estimate byte offsets, particularly for scenarios where average row size had been overestimated
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
src/cache.ts |
Refactored Estimator class to replace isStored() and guessByteOffset() with new methods (getStatus(), getFirstMissingRow(), getLastMissingRowNumber()) that provide more detailed information about row status and byte offsets |
src/dataframe.ts |
Updated fetch logic to use new estimator methods, eliminating the previous loop-based approach for determining which rows need to be fetched and improving the initial state detection |
test/cache.test.ts |
Updated and expanded tests to cover the new estimator methods, including edge cases for complete caches, empty caches, and rows stored at various positions |
test/dataframe.test.ts |
Updated test expectations to reflect improved byte offset estimation behavior for serial rows |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…erial-rows' into 26-improve-guess-by-offset-for-serial-rows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #26