-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
fix: Add reset-mode flag for CSV parser #11288
Conversation
@srebhan tanks for looking into this. test.conf
cpu.csv
weather.csv
output
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_amd64.tar.gz, and windows_amd64.zip. 👍 This pull request doesn't change the Telegraf binary size 📦 Click here to get additional PR build artifactsArtifact URLs |
Can you please try again? |
Works for me |
resolves #11257, resolves #10678
This PR adds a flag to allow the CSV parser to be reset on every call to
Parse
. This is required as, dependent on the input processing, the CSV parser needs to either keep track of the state (e.g. when parsing linewise) or needs to drop the state (e.g. when reading whole files). In the first case, you should setcsv_reset_mode = "none"
(default), while in the second case you should setcsv_reset_mode = "always"
.Please note: Reset-mode
"always"
is ignored forParseLine
(which is not used in our codebase) as this implicitly requires keeping track of the state if used with skipped-rows, headers and/or metadata.