Repository navigation
Conversation
SqlCatalog::CreateTable previously always created V2 tables and rejected an explicit format-version table property as a reserved key, preventing callers from selecting the table format version during creation. Resolve the requested version in the shared TableMetadata::Make entry point, validate it before narrowing, and remove the control property before persisting table properties. Keep V2 as the default and preserve the explicit-version overload's reserved-property checks. Preserve the initial version through staged create transactions. Initialize SQL and in-memory catalog create builders from the first version update and replay subsequent upgrades in order, allowing staged tables to upgrade before their create transaction commits. Add parameterized coverage for supported and invalid versions, reserved properties, ordinary and staged creates, and staged V1/V2-to-V3 upgrades. Verify the version and properties after reload and in SQL metadata JSON.
e249217 to
47680bd
Compare
| static Result<std::unique_ptr<TableMetadata>> Make( | ||
| const iceberg::Schema& schema, const iceberg::PartitionSpec& spec, | ||
| const iceberg::SortOrder& sort_order, const std::string& location, | ||
| const std::unordered_map<std::string, std::string>& properties, int format_version); |
There was a problem hiding this comment.
Can we avoid a separate overload? Perhaps we can change it to std::optional<int>? How does the Java implementation deal with this?
There was a problem hiding this comment.
Java impl uses a public overload to read format-version from properties(defaulting to V2), filters out reserved properties, and delegates to a package-private overload taking an explicit int formatVersion, see [1].
We can follow Java here. But the overload with format_version was already public before this PR, so I'm not sure if we should make it private. WDYT?
There was a problem hiding this comment.
I think we can make breaking changes when necessary at any time before 1.0.
There was a problem hiding this comment.
Yeah, done the Java way.
Keep table creation through the public properties-based factory and make the explicit format-version overload an internal implementation detail. Remove direct tests of the private overload, retaining public entry point coverage for supported versions, invalid versions, and reserved properties.
SqlCatalog::CreateTable previously always created V2 tables and rejected an explicit format-version table property as a reserved key, preventing callers from selecting the table format version during creation.
Resolve the requested version in the shared TableMetadata::Make entry point, validate it before narrowing, and remove the control property before persisting table properties. Keep V2 as the default and preserve the explicit-version overload's reserved-property checks.
Preserve the initial version through staged create transactions. Initialize SQL and in-memory catalog create builders from the first version update and replay subsequent upgrades in order, allowing staged tables to upgrade before their create transaction commits.
Add parameterized coverage for supported and invalid versions, reserved properties, ordinary and staged creates, and staged V1/V2-to-V3 upgrades. Verify the version and properties after reload and in SQL metadata JSON.