You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/12/07 23:37:55 UTC

[GitHub] [arrow] wjones127 commented on a change in pull request #11892: ARROW-14644: [C++][R] open_dataset doesn't ignore BOM in csv file

wjones127 commented on a change in pull request #11892:
URL: https://github.com/apache/arrow/pull/11892#discussion_r764441816



##########
File path: cpp/src/arrow/dataset/file_csv.cc
##########
@@ -85,7 +86,13 @@ Result<std::unordered_set<std::string>> GetColumnNames(
 
   RETURN_NOT_OK(
       parser.VisitLastRow([&](const uint8_t* data, uint32_t size, bool quoted) -> Status {
-        util::string_view view{reinterpret_cast<const char*>(data), size};
+        // Skip BOM when reading column names (ARROW-14644)
+        ARROW_ASSIGN_OR_RAISE(auto data_no_bom, util::SkipUTF8BOM(data, size));
+        int32_t offset = data_no_bom - data;
+        DCHECK_GE(offset, 0);
+        size = size - offset;

Review comment:
       Thanks, I wasn't sure what the best way to explicitly cast was. Those changes work locally on my Mac; hopefully will work in Windows builds.




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org