Skip to content

Commit fe44eb3

Browse files
Sreesh Maheshwarclaude
andcommitted
feat(io): expose FileIO configuration properties
Add FileIO::properties(), returning the FileIO's configuration by const reference. The default returns an empty map; ArrowS3FileIO returns the properties it was configured with. This lets an engine that performs its own I/O read the resolved configuration of a table's FileIO, matching the property surface other Iceberg implementations expose (Java FileIO.properties(), Rust config().props(), Python table.io.properties; Trino reads baseTable.io().properties()). Vended credentials returned in a table's config are part of that configuration and are surfaced here; structured storage-credentials remain on the separate SupportsStorageCredentials channel, as in Java. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 75bef3f commit fe44eb3

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

src/iceberg/arrow/s3/arrow_s3_file_io.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ class ArrowS3FileIO final : public FileIO, public SupportsStorageCredentials {
215215
return storage_credentials_;
216216
}
217217

218+
const std::unordered_map<std::string, std::string>& properties() const override {
219+
return default_properties_;
220+
}
221+
218222
SupportsStorageCredentials* AsSupportsStorageCredentials() override { return this; }
219223

220224
private:

src/iceberg/file_io.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <span>
2727
#include <string>
2828
#include <string_view>
29+
#include <unordered_map>
2930
#include <vector>
3031

3132
#include "iceberg/iceberg_export.h"
@@ -177,6 +178,15 @@ class ICEBERG_EXPORT FileIO {
177178

178179
/// \brief Return storage-credential support when implemented by this FileIO.
179180
virtual SupportsStorageCredentials* AsSupportsStorageCredentials() { return nullptr; }
181+
182+
/// \brief Return this FileIO's configuration properties.
183+
///
184+
/// Engines that access storage through their own I/O stack can read these to
185+
/// configure that access. The default returns an empty map.
186+
virtual const std::unordered_map<std::string, std::string>& properties() const {
187+
static const std::unordered_map<std::string, std::string> kEmpty;
188+
return kEmpty;
189+
}
180190
};
181191

182192
/// \brief Mix-in for FileIO implementations that route object paths to

src/iceberg/test/arrow_s3_file_io_test.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,21 @@ TEST_F(ArrowS3FileIOTest, StoresCredentials) {
156156
EXPECT_EQ(credentialed->credentials(), credentials);
157157
}
158158

159+
TEST_F(ArrowS3FileIOTest, PropertiesExposeFileIOConfiguration) {
160+
// REST servers typically return vended credentials in a table's config, which
161+
// becomes the FileIO's configuration; properties() exposes it to engines.
162+
auto result = MakeS3FileIO({{std::string(S3Properties::kClientRegion), "us-east-1"},
163+
{std::string(S3Properties::kAccessKeyId), "key"},
164+
{std::string(S3Properties::kSecretAccessKey), "secret"}});
165+
ASSERT_THAT(result, IsOk());
166+
167+
// No downcast needed: properties() is a FileIO method.
168+
const auto& properties = result.value()->properties();
169+
EXPECT_EQ(properties.at(std::string(S3Properties::kClientRegion)), "us-east-1");
170+
EXPECT_EQ(properties.at(std::string(S3Properties::kAccessKeyId)), "key");
171+
EXPECT_EQ(properties.at(std::string(S3Properties::kSecretAccessKey)), "secret");
172+
}
173+
159174
TEST_F(ArrowS3FileIOTest, RejectsCredentialPrefix) {
160175
auto result = MakeS3FileIO({});
161176
ASSERT_THAT(result, IsOk());

0 commit comments

Comments
 (0)