Repository navigation
Backport(v1.19): parser_csv: fix the fast engine for quoted values that contain the delimiter and an escaped quote (#5667) - #5700
Merged
Conversation
…limiter and an escaped quote (#5667) With parser_engine fast, a quoted value that has both the delimiter and an escaped "" came out wrong. The join of split pieces started only when the first piece had exactly one quote, and it stopped at the first piece ending with a quote. So "" before the delimiter ended the value early and pushed the rest into the next keys. The joined value also kept "" escaped. Lines without two consecutive double quotes still use the existing field handling. In other lines, a piece that starts with a quote and has an odd quote count may start a quoted field that spans several pieces. The parser checks the pieces by byte offsets, so long and multibyte lines stay linear. If it finds a well-formed field, it joins the pieces once and unescapes doubled quotes. Otherwise the starting piece is handled as before. Fixes #5666 Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com> Co-authored-by: Shizuo Fujita <fujita@clear-code.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Watson1978
approved these changes
Nov 30, 2026
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.
Which issue(s) this PR fixes:
Backport #5667
Fixes #5666
What this PR does / why we need it:
With
parser_engine fast, a quoted value that has both the delimiter and an escaped""came out wrong. The joining of split pieces only kicked in when the first piece had exactly one quote and stopped at the first piece ending with a quote, so""before a comma ended the value early and pushed the rest into the next keys. The joined value also never got""unescaped.Lines without two consecutive double quotes use the existing field-handling logic. In other lines, a split piece that starts with a quote and has an odd quote count is a candidate for a quoted field spanning multiple pieces. The parser uses byte offsets to check the pieces. If it finds a well-formed field, it joins the pieces once and unescapes doubled quotes. Otherwise it falls back to the existing handling for the starting piece. The tests cover valid escaped quotes, the full records for three malformed inputs, long lines, and a quoted value that has the delimiter but no escaped quote.
Docs Changes:
None
Release Note:
parser_csv: fix the fast engine for quoted values that contain the delimiter and an escaped quote