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

Specify a "default" parser #221

Closed
Jolanrensen opened this issue Nov 4, 2024 · 2 comments
Closed

Specify a "default" parser #221

Jolanrensen opened this issue Nov 4, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Jolanrensen
Copy link

While we can specify a parser per index or column name, we cannot specify a "default" parser for when we do not know how many columns the file will have or which names the columns will get.

It may be beneficial to be able to call

.putParserForName("colA", Parsers.DOUBLE)
.defaultParser(Parsers.STRING)

which will read the CSV in such a way that colA will be parsed using the double parser and all other columns will be parsed as String. This would essentially disable the column type inference.

@Jolanrensen Jolanrensen added the enhancement New feature or request label Nov 4, 2024
@kosak
Copy link
Contributor

kosak commented Nov 8, 2024

I think this will do what you're asking. Kindly let me know if it works for your use case; it not we can try to provide something.

.putParserForName("colA", Parsers.DOUBLE)
.parsers(Collections.singletonList(Parsers.STRING))

@Jolanrensen
Copy link
Author

That seems to work! Thank you very much :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants