Revert "Revert "[fix](csv-reader) fix column split error when there is escape character (#34364)""
This reverts commit d127d67ebe989484bbdf340a4de5b79ded56eecc.
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user