-
Notifications
You must be signed in to change notification settings - Fork 294
Closed
Description
Problem statement
TableMetadataBuilder
is useful in modifying/creating TableMetadata
, and is a core data structure of transaction api. There are already some efforts to create one using derived builder, see #62 and #229. While it's easy to implement, I have some concerns about this approach. There are some problems with this approach:
- Not easy to review. it's quite easy to forget that we have changed builder api when we do modification to
TableMetadata
. - Not easy to customize. I've checked the builder in java api, and it has a lot of customization in each method with validations.
The reason I want to be careful with TableMetadataBuilder
is that it's a core data structure in iceberg, and we should not expose apis which be misused to construct inconsistent TableMetadata
.
Proposal
I want to propose to implement TableMetadataBuilder
in a similar approach like java api, rather than using derived builder directly, such as following:
pub struct TableMetadataBuilder(TableMetadata);
impl TableMetadataBuilder {
pub fn add_schema(mut self, schema: Schema) -> Result<Self> {
// Check if schema validity
}
pub fn add_unbound_partition_spec(mut self, spec: UnboundPartitionSpec) -> Result<Self> {
// Binding partition spec
}
pub fn build(self) -> Result<TableMetadata> {}
}
JanKaul and Li0k
Metadata
Metadata
Assignees
Labels
No labels