HuaHuaY commented on code in PR #51286:
URL: https://github.com/apache/arrow/pull/51286#discussion_r4312210703


##########
cpp/src/arrow/csv/chunker.cc:
##########
@@ -262,6 +290,21 @@ class Lexer {
   const ParseOptions& options_;
   const BulkFilterType bulk_filter_;
   State state_ = FIELD_START;
+
+ private:
+  struct Empty {};
+
+  static auto InitDelimiterMatcher(const ParseOptions& options) {
+    if constexpr (SpecializedOptions::multi_delimiter) {
+      return 
internal::StreamingDelimiterMatcher(internal::GetDelimiter(options));
+    } else {
+      return Empty{};
+    }
+  }
+
+  [[no_unique_address]]
+  std::conditional_t<SpecializedOptions::multi_delimiter,
+                     internal::StreamingDelimiterMatcher, Empty> 
delimiter_matcher_;

Review Comment:
   It's because `optional` incurs memory overhead even when it’s not needed. 
But either is fine for me. I will modify it.



-- 
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]

Reply via email to