sdd commented on code in PR #771: URL: https://github.com/apache/iceberg-rust/pull/771#discussion_r1885410880
########## crates/iceberg/src/spec/partition.rs: ########## @@ -55,69 +52,43 @@ impl PartitionField { } } -/// Partition spec that defines how to produce a tuple of partition values from a record. -/// `PartitionSpec` is bound to a specific schema. -#[derive(Debug, PartialEq, Eq, Clone)] -pub struct BoundPartitionSpec { - /// Identifier for PartitionSpec - spec_id: i32, - /// Details of the partition spec - fields: Vec<PartitionField>, - /// The schema this partition spec is bound to - schema: SchemaRef, - /// Type of the partition spec - partition_type: StructType, -} - -/// Reference to [`SchemalessPartitionSpec`]. -pub type SchemalessPartitionSpecRef = Arc<SchemalessPartitionSpec>; +/// Reference to [`PartitionSpec`]. +pub type PartitionSpecRef = Arc<PartitionSpec>; /// Partition spec that defines how to produce a tuple of partition values from a record. /// Schemaless partition specs are never constructed manually. They occur when a table is mutated /// and partition spec and schemas are updated. While old partition specs are retained, the bound /// schema might not be available anymore as part of the table metadata. #[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] #[serde(rename_all = "kebab-case")] -pub struct SchemalessPartitionSpec { +pub struct PartitionSpec { /// Identifier for PartitionSpec spec_id: i32, /// Details of the partition spec fields: Vec<PartitionField>, } -impl BoundPartitionSpec { - /// Create partition spec builder +impl PartitionSpec { + /// Create a new partition spec builder with the given schema. pub fn builder(schema: impl Into<SchemaRef>) -> PartitionSpecBuilder { PartitionSpecBuilder::new(schema) } - /// Get a new unpatitioned partition spec - pub fn unpartition_spec(schema: impl Into<SchemaRef>) -> Self { - Self { - spec_id: DEFAULT_PARTITION_SPEC_ID, - fields: vec![], - schema: schema.into(), - partition_type: StructType::new(vec![]), - } - } - - /// Spec id of the partition spec - pub fn spec_id(&self) -> i32 { - self.spec_id - } - /// Fields of the partition spec pub fn fields(&self) -> &[PartitionField] { &self.fields } - /// The schema this partition spec is bound to - pub fn schema(&self) -> &Schema { - &self.schema + /// Spec id of the partition spec + pub fn spec_id(&self) -> i32 { + self.spec_id } - /// The schema ref this partition spec is bound to - pub fn schema_ref(&self) -> &SchemaRef { - &self.schema + /// Get a new unpatitioned partition spec Review Comment: Small typo - should be `unpartitioned`, not `unpatitioned` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org