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

Append index for CSV #41

Merged
merged 5 commits into from
Jan 16, 2024

Conversation

friendlymatthew
Copy link
Collaborator

Fixes #39

The problem

To append a new index file, ReadIndexFile is called. ReadIndexFile proceeds to build the IndexFile from the data generated by NewIndexFile. To append new data that exists in ReadIndexFile but not in NewIndexFile, we call Synchronize. The problem is for CSV files, we need to pass in the headers from ReadIndexFile.

The solution

  1. Extract headers from data passed in from ReadIndexFile.

We could have spliced the data from 0 -> f.EndByteOffsets[0]. But since we want to support a schemaless design, if the headers change, we want to catch for this. So we need to use csvReader to parse the header.

  1. Pass headers to Synchronize

Synchronize gets called in two different places:

 1. Index file creation, here we can strip the head line and treat it as our header
 2. Read index file, which needs explicit header data passed

Next steps

  • write more tests, the existing append index file test passes
  • clean up, remove debug comments

@friendlymatthew friendlymatthew marked this pull request as ready for review January 16, 2024 22:14
@friendlymatthew friendlymatthew merged commit 2b9420b into kevmo314:main Jan 16, 2024
2 checks passed
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.

Fix csv test case: should append data range for given Index
2 participants