Revert "Revert "[fix](csv-reader) fix column split error when there is escape character (#34364)""

This reverts commit d127d67ebe989484bbdf340a4de5b79ded56eecc.
This commit is contained in:
yiguolei
2024-05-07 18:03:56 +08:00
parent 561c6a752d
commit 4be589951b
2 changed files with 5 additions and 4 deletions

View File

@ -143,13 +143,12 @@ void EncloseCsvLineReaderContext::_on_normal(const uint8_t* start, size_t& len)
}
void EncloseCsvLineReaderContext::_on_pre_match_enclose(const uint8_t* start, size_t& len) {
bool should_escape = false;
do {
do {
if (start[_idx] == _escape) [[unlikely]] {
should_escape = !should_escape;
} else if (should_escape) [[unlikely]] {
should_escape = false;
_should_escape = !_should_escape;
} else if (_should_escape) [[unlikely]] {
_should_escape = false;
} else if (start[_idx] == _enclose) [[unlikely]] {
_state.forward_to(ReaderState::MATCH_ENCLOSE);
++_idx;

View File

@ -135,6 +135,7 @@ public:
inline void refresh_impl() {
_idx = 0;
_should_escape = false;
_result = nullptr;
_column_sep_positions.clear();
_state.reset();
@ -168,6 +169,7 @@ private:
const size_t _column_sep_len;
size_t _idx = 0;
bool _should_escape = false;
const std::string _column_sep;
std::vector<size_t> _column_sep_positions;