diff --git a/datafusion_iceberg/src/planner.rs b/datafusion_iceberg/src/planner.rs index 50d476c0..7830162d 100644 --- a/datafusion_iceberg/src/planner.rs +++ b/datafusion_iceberg/src/planner.rs @@ -122,13 +122,18 @@ impl ExtensionPlanner for CreateIcebergTablePlanner { .enumerate() .map(|(i, x)| { let (column, transform) = parse_transform(x)?; + let name = if let Transform::Identity = &transform { + column.clone() + } else { + column.clone() + "_" + &transform.to_string() + }; Ok::<_, Error>(PartitionField::new( schema .get_name(&column) .ok_or(Error::NotFound("Column".to_owned(), column.clone()))? .id, 1000 + i as i32, - &(column + "_" + &transform.to_string()), + &name, transform, )) }) diff --git a/datafusion_iceberg/src/table.rs b/datafusion_iceberg/src/table.rs index dd4948af..e2c088c2 100644 --- a/datafusion_iceberg/src/table.rs +++ b/datafusion_iceberg/src/table.rs @@ -463,7 +463,7 @@ async fn table_scan( .map(|field| { let struct_field = schema.fields().get(*field.source_id() as usize).unwrap(); Ok(Field::new( - field.name().clone(), + field.name().clone() + "__partition", (&struct_field .field_type .tranform(field.transform()) @@ -484,7 +484,7 @@ async fn table_scan( for partition_field in table.metadata().default_partition_spec().unwrap().fields() { schema_builder.with_struct_field(StructField { id: *partition_field.field_id(), - name: partition_field.name().clone(), + name: partition_field.name().clone() + "__partition", field_type: schema .fields() .get(*partition_field.source_id() as usize)