pitrou commented on code in PR #13838:
URL: https://github.com/apache/arrow/pull/13838#discussion_r965746962


##########
cpp/src/arrow/dataset/file_csv.cc:
##########
@@ -196,6 +196,11 @@ static inline 
Future<std::shared_ptr<csv::StreamingReader>> OpenReaderAsync(
   auto reader_fut = DeferNotOk(input->io_context().executor()->Submit(
       [=]() -> Future<std::shared_ptr<csv::StreamingReader>> {
         ARROW_ASSIGN_OR_RAISE(auto first_block, 
input->Peek(reader_options.block_size));
+        auto size = first_block.length();
+        const uint8_t* data = reinterpret_cast<const 
uint8_t*>(first_block.data());
+        ARROW_ASSIGN_OR_RAISE(auto data_no_bom, util::SkipUTF8BOM(data, size));
+        size = size - static_cast<uint32_t>(data_no_bom - data);
+        first_block = util::string_view(reinterpret_cast<const 
char*>(data_no_bom), size);

Review Comment:
   Ok, but I still don't understand why you need BOM-handling code in the 
datasets layer while the CSV reader already has such code.
   
   Also, I see no tests being added here.



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