ZMZ91 commented on code in PR #13838:
URL: https://github.com/apache/arrow/pull/13838#discussion_r966770782
##########
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:
I see the code in file_csv runs before the csv reader. And as the comment
says it's to `Grab the first block and use it to determine the schema and
create a reader.`
--
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]