ok, things seem to work with one required change. ...
# daft-dev
g
ok, things seem to work with one required change. newer versions of pyiceberg require that the name of partition field is not the same as the name of a field in the schema. currently,
_partition_fields_to_pyiceberg_spec
sets the
name
to the same name as the source field.
Copy code
source_field = iceberg_schema.find_field(pf.field.name)
            iceberg_partition_fields.append(
                PyIcebergPartitionField(
                    source_id=source_field.field_id,
                    field_id=1000 + idx,
                    transform=transform,
                    name=pf.field.name,
                )
            )
we could (1) try to create a unique name automatically or (2) allow user to pass the name.
Copy code
ValueError: Cannot create partition with a name that exists in schema: a
lighter weight change might be something like below and internal name is not exposed?
Copy code
source_field = iceberg_schema.find_field(pf.field.name)
            field_id = len(iceberg_schema.fields) + idx
            name = f"__pyiceberg_partition_field_{pf.field.name}_{field_id}"
            iceberg_partition_fields.append(
                PyIcebergPartitionField(
                    source_id=source_field.field_id,
                    field_id=field_id,
                    transform=transform,
                    name=name,
                )
            )