Skip to content

[feature request] disallow creating partition field with name that conflicts with schema field when its not identity transform #2272

Closed

Activity

  1. kevinjqliu commented on Aug 5, 2025

    @kevinjqliu
    ContributorAuthor

    pyiceberg has _check_and_add_partition_name

    def _check_and_add_partition_name(schema: Schema, name: str, source_id: int, partition_names: Set[str]) -> None:
    try:
    field = schema.find_field(name)
    except ValueError:
    field = None
    if source_id is not None and field is not None and field.field_id != source_id:
    raise ValueError(f"Cannot create identity partition from a different field in the schema {name}")
    elif field is not None and source_id != field.field_id:
    raise ValueError(f"Cannot create partition from name that exists in schema {name}")
    if not name:
    raise ValueError("Undefined name")
    if name in partition_names:
    raise ValueError(f"Partition name has to be unique: {name}")
    partition_names.add(name)

  2. rutb327 commented on Aug 7, 2025

    @rutb327
    Contributor

    I would like to work on this!

  3. added this to the PyIceberg 0.10.0 milestone on Aug 11, 2025
  4. added a commit that references this issue on Aug 20, 2025
  5. kevinjqliu commented on Aug 20, 2025

    @kevinjqliu
    ContributorAuthor

    For future reference, there are 3 cases to test

    • update schema
    • update partition
    • create table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions