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

check column availability before reading #281

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

adviksh
Copy link

@adviksh adviksh commented Feb 8, 2024

I've really enjoyed using fst — the read/write and compression are wonderful. Sometimes I create problems for myself when I try to read a column that doesn't exist in a dataset. For example:

library(fst)
test_df = data.frame(a = 1)
write_fst(test_df, 'test.fst')
read_fst('test.fst', columns='b')

produces the error:

 *** caught bus error ***
address 0x0, cause 'invalid alignment'

Traceback:
 1: fstretrieve(file_name, columns, from, to)
 2: read_fst("test.fst", columns = "b")

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

I'm running fst version 0.9.8 and fstcore version 0.9.18.

I'm proposing a fix that checks the requested columns against those found by metadata_fst(), and throws an error if the user requests a column not present in the file.

Apologies if this is already in the works! I did a quick scan of open issues but didn't see something like this.

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.

1 participant