emkornfield commented on a change in pull request #12504:
URL: https://github.com/apache/arrow/pull/12504#discussion_r814309331
##########
File path: cpp/src/arrow/csv/writer.cc
##########
@@ -265,24 +279,41 @@ class QuotedColumnPopulator : public ColumnPopulator {
Status UpdateRowLengths(int32_t* row_lengths) override {
const StringArray& input = *casted_array_;
- int row_number = 0;
- row_needs_escaping_.resize(casted_array_->length());
- VisitArrayDataInline<StringType>(
- *input.data(),
- [&](arrow::util::string_view s) {
- // Each quote in the value string needs to be escaped.
- int64_t escaped_count = CountQuotes(s);
- // TODO: Maybe use 64 bit row lengths or safe cast?
- row_needs_escaping_[row_number] = escaped_count > 0;
- row_lengths[row_number] += static_cast<int32_t>(s.length()) +
- static_cast<int32_t>(escaped_count +
kQuoteCount);
- row_number++;
- },
- [&]() {
- row_needs_escaping_[row_number] = false;
- row_lengths[row_number] +=
static_cast<int32_t>(null_string_->size());
- row_number++;
- });
+
+ row_needs_escaping_.resize(casted_array_->length(), false);
+
+ if (NoQuoteInArray(input)) {
Review comment:
It is surprising the fast path helps here. is that because the visitor
can now generate simd for the fast path?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]