Skip to content

Commit

Permalink
No need to dlsym EnsureS3Finalized we can call it directly (#13819)
Browse files Browse the repository at this point in the history
Previously I didn't realize that the `ARROW_S3` define was provided to consumers via `arrow/util/config.h`. We can remove the dlopen hack and just guard the entire S3 logic.

Authors:
  - Robert Maynard (https://github.com/robertmaynard)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Vukasin Milovanovic (https://github.com/vuule)
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #13819
  • Loading branch information
robertmaynard authored Aug 7, 2023
1 parent a8ef4d4 commit 7eb4071
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions cpp/tests/io/arrow_io_source_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <arrow/filesystem/filesystem.h>
#include <arrow/io/api.h>
#include <arrow/util/config.h>

#include <fstream>
#include <memory>
Expand Down Expand Up @@ -87,19 +88,16 @@ TEST_F(ArrowIOTest, S3FileSystem)
ASSERT_EQ(1, tbl.tbl->num_columns()); // Only single column specified in reader_options
ASSERT_EQ(244, tbl.tbl->num_rows()); // known number of rows from the S3 file
}

#ifdef ARROW_S3
if (!s3_unsupported) {
// Verify that we are using Arrow with S3, and call finalize
// https://github.com/apache/arrow/issues/36974
// This needs to be in a separate conditional to ensure we call
// finalize after all arrow_io_source instances have been deleted.
void* whole_app = dlopen(NULL, RTLD_LAZY);
decltype(arrow::fs::EnsureS3Finalized)* close_s3_func = nullptr;

close_s3_func = reinterpret_cast<decltype(close_s3_func)>(
dlsym(whole_app, "_ZN5arrow2fs17EnsureS3FinalizedEv"));
if (close_s3_func) { EXPECT_TRUE(close_s3_func().ok()); }
dlclose(whole_app);
[[maybe_unused]] auto _ = arrow::fs::EnsureS3Finalized();
}
#endif
}

CUDF_TEST_PROGRAM_MAIN()

0 comments on commit 7eb4071

Please sign in to comment.