HaochengLIU commented on code in PR #34984:
URL: https://github.com/apache/arrow/pull/34984#discussion_r1163461925


##########
cpp/src/arrow/dataset/dataset_writer.cc:
##########
@@ -308,11 +309,24 @@ class DatasetWriterDirectoryQueue {
   }
 
   Result<std::string> GetNextFilename() {
-    auto basename = 
::arrow::internal::Replace(write_options_.basename_template,
-                                               kIntegerToken, 
ToChars(file_counter_++));
+    std::optional<std::string> basename;
+    if (write_options_.basename_template_functor == nullptr) {
+      basename = ::arrow::internal::Replace(write_options_.basename_template,
+                                            kIntegerToken, 
ToChars(file_counter_++));
+    } else {
+      basename = ::arrow::internal::Replace(

Review Comment:
   I realize after using the suggested code, it allows users to pass in a 
basename_template_functor which applies on `basename_template` rather than 
`{i}`, it will make "ValidateBasenameTemplate(...)" obsolete.  I suggest we 
keep the existing code



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