Skip to content

Commit 94ff1e5

Browse files
committed
feat: Impl InMemoryCatalog's UpdateTable
1 parent f48e2e6 commit 94ff1e5

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

src/iceberg/catalog/memory/in_memory_catalog.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
#include <algorithm>
2323
#include <iterator>
24-
#include <mutex>
2524
#include <memory>
25+
#include <mutex>
2626

2727
#include "iceberg/table.h"
2828
#include "iceberg/table_identifier.h"

src/iceberg/table_metadata.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,19 +292,17 @@ Result<std::unique_ptr<TableMetadata>> TableMetadataUtil::Read(
292292
}
293293

294294
Status TableMetadataUtil::Write(FileIO& io, const TableMetadata* base,
295-
TableMetadata* metadata) {
296-
ICEBERG_CHECK(metadata != nullptr, "The metadata is nullptr.");
297-
295+
TableMetadata& metadata) {
298296
int version = -1;
299297
if (base != nullptr && !base->metadata_file_location.empty()) {
300298
// parse current version from location
301299
version = ParseVersionFromLocation(base->metadata_file_location);
302300
}
303301

304302
ICEBERG_ASSIGN_OR_RAISE(std::string new_file_location,
305-
NewTableMetadataFilePath(*metadata, version + 1));
306-
ICEBERG_RETURN_UNEXPECTED(Write(io, new_file_location, *metadata));
307-
metadata->metadata_file_location = std::move(new_file_location);
303+
NewTableMetadataFilePath(metadata, version + 1));
304+
ICEBERG_RETURN_UNEXPECTED(Write(io, new_file_location, metadata));
305+
metadata.metadata_file_location = std::move(new_file_location);
308306
return {};
309307
}
310308

src/iceberg/table_metadata.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -490,14 +490,13 @@ struct ICEBERG_EXPORT CodecTypeUtil {
490490
/// \return The file extension of the codec.
491491
static std::string CodecTypeToFileExtension(MetadataFileCodecType codec);
492492

493-
inline static constexpr std::string_view kTableMetadataFileSuffix = ".metadata.json";
494-
inline static constexpr std::string_view kCompGzipTableMetadataFileSuffix =
493+
static constexpr std::string_view kTableMetadataFileSuffix = ".metadata.json";
494+
static constexpr std::string_view kCompGzipTableMetadataFileSuffix =
495495
".metadata.json.gz";
496-
inline static constexpr std::string_view kGzipTableMetadataFileSuffix =
497-
".gz.metadata.json";
498-
inline static constexpr std::string_view kGzipTableMetadataFileExtension = ".gz";
499-
inline static constexpr std::string_view kCodecTypeGzip = "GZIP";
500-
inline static constexpr std::string_view kCodecTypeNone = "NONE";
496+
static constexpr std::string_view kGzipTableMetadataFileSuffix = ".gz.metadata.json";
497+
static constexpr std::string_view kGzipTableMetadataFileExtension = ".gz";
498+
static constexpr std::string_view kCodecTypeGzip = "GZIP";
499+
static constexpr std::string_view kCodecTypeNone = "NONE";
501500
};
502501

503502
/// \brief Utility class for table metadata
@@ -521,7 +520,7 @@ struct ICEBERG_EXPORT TableMetadataUtil {
521520
/// \param io The FileIO instance for writing files
522521
/// \param base The base metadata (can be null for new tables)
523522
/// \param metadata The metadata to write, which will be updated with the new location
524-
static Status Write(FileIO& io, const TableMetadata* base, TableMetadata* metadata);
523+
static Status Write(FileIO& io, const TableMetadata* base, TableMetadata& metadata);
525524

526525
/// \brief Delete removed metadata files based on retention policy.
527526
///

0 commit comments

Comments
 (0)