rok commented on code in PR #55433:
URL: https://github.com/apache/arrow/pull/55433#discussion_r4501961095


##########
cpp/src/arrow/filesystem/test_util.cc:
##########
@@ -811,7 +811,11 @@ void 
GenericFileSystemTest::TestGetFileInfoSelector(FileSystem* fs) {
   ASSERT_OK_AND_ASSIGN(info, fs->GetFileInfo("AB"));
   AssertFileInfo(info, "AB", FileType::Directory, first_dir_time);
   ASSERT_OK_AND_ASSIGN(info, fs->GetFileInfo("AB/CD/ghi"));
-  AssertFileInfo(info, "AB/CD/ghi", FileType::File, first_file_time, 15);
+  AssertFileInfo(info, "AB/CD/ghi", FileType::File, 15);
+  // A single-file call may return a less precise mtime than a selector call,
+  // so compare seconds (e.g. S3 Last-Modified header only has seconds)
+  ASSERT_EQ(std::chrono::floor<std::chrono::seconds>(info.mtime()),
+            std::chrono::floor<std::chrono::seconds>(first_file_time));

Review Comment:
   How about only flooring when units don't match?
   
   ```suggestion
     // aws-sdk-cpp >= 1.11.900 keeps ms in S3 listings, but HeadObject only 
has seconds
     if (info.mtime() == std::chrono::floor<std::chrono::seconds>(info.mtime()) 
&&
         first_file_time == 
std::chrono::floor<std::chrono::milliseconds>(first_file_time)) {
       first_file_time = 
std::chrono::floor<std::chrono::seconds>(first_file_time);
     }
     AssertFileInfo(info, "AB/CD/ghi", FileType::File, first_file_time, 15);
   ```



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