emkornfield commented on a change in pull request #11849:
URL: https://github.com/apache/arrow/pull/11849#discussion_r763443213



##########
File path: cpp/src/arrow/csv/writer.cc
##########
@@ -282,20 +358,36 @@ struct PopulatorFactory {
                   is_null_type<TypeClass>::value || 
is_temporal_type<TypeClass>::value,
               Status>
   Visit(const TypeClass& type) {
-    populator = new UnquotedColumnPopulator(pool, end_char, null_string);
+    // Determine what ColumnPopulator to use based on desired CSV quoting 
style.
+    switch (quoting_style) {
+        // These types are assumed not to produce any quotes, so we do not 
need to check
+        // and reject for potential quotes in the casted values in case the 
QuotingStyle
+        // is None.
+      case QuotingStyle::None:
+      case QuotingStyle::Needed:
+        populator = new UnquotedColumnPopulator(pool, end_char, null_string,
+                                                
/*reject_values_with_quotes=*/false);
+        break;
+      case QuotingStyle::AllValid:
+        populator = new QuotedColumnPopulator(pool, end_char, null_string);
+        break;
+    }
     return Status::OK();
   }
 
   char end_char;
   std::shared_ptr<Buffer> null_string;
+  QuotingStyle quoting_style;

Review comment:
       nit: const?




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