OmniSciDB  95562058bd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
foreign_storage::ParquetS3FileSystem Class Reference

#include <ParquetS3FileSystem.h>

Static Public Member Functions

static std::shared_ptr
< arrow::fs::FileSystem > 
create (const ForeignServer *foreign_server, const UserMapping *user_mapping)
 

Detailed Description

Definition at line 31 of file ParquetS3FileSystem.h.

Member Function Documentation

static std::shared_ptr<arrow::fs::FileSystem> foreign_storage::ParquetS3FileSystem::create ( const ForeignServer foreign_server,
const UserMapping *  user_mapping 
)
inlinestatic

Definition at line 33 of file ParquetS3FileSystem.h.

References foreign_storage::OptionsContainer::options.

35  {
36  static bool is_initialized = false;
37  if (!is_initialized) {
38  // Arrow requires its own S3 initialization (which does an AWS SDK initialization)
39  // before any S3 related call can be made. However, S3Archive also does an
40  // AWS SDK initialization. Both classes do not work if their own initialization
41  // is not done. When both initializations are done, AWS SDK does not correctly
42  // clean up before the second initialization. The following ensures that is done.
43  // TODO: Figure out a way to have a single AWS SDK initialization that works for
44  // both Arrow and S3Archive.
45  Aws::CleanupEnumOverflowContainer();
46  is_initialized = true;
47  }
48 
49  arrow::fs::EnsureS3Initialized();
50  auto s3_options = arrow::fs::S3Options::Anonymous();
51  if (user_mapping) {
52  const auto options = user_mapping->getUnencryptedOptions();
53  if (options.find(UserMapping::S3_ACCESS_KEY) != options.end() &&
54  options.find(UserMapping::S3_SECRET_KEY) != options.end()) {
55  s3_options = arrow::fs::S3Options::FromAccessKey(
56  options.find(UserMapping::S3_ACCESS_KEY)->second,
57  options.find(UserMapping::S3_SECRET_KEY)->second);
58  }
59  }
60  s3_options.region =
61  foreign_server->options.find(ForeignServer::AWS_REGION_KEY)->second;
62  auto fs_result = arrow::fs::S3FileSystem::Make(s3_options);
63  if (!fs_result.ok()) {
64  throw std::runtime_error{"An error occurred when setting up S3 connection. " +
65  fs_result.status().message()};
66  }
67  return fs_result.ValueOrDie();
68  }

The documentation for this class was generated from the following file: