Skip to content

[Bug] [Python] Branch schema operations incorrectly use the main branch #8828

Description

@zhoulii

Search before asking

  • I searched in the issues and found nothing similar.

Paimon version

1.4

Compute Engine

python sdk

Minimal reproduce step

  1. With FileSystemCatalog:
fs_catalog.alter_table(
    Identifier("db", "table", branch="dev"),
    [SchemaChange.add_column("branch_col", AtomicType("STRING"))],
)

Reload the main and dev tables. The new column is incorrectly added to main instead of only to dev.

  1. Create a table and a branch named dev. With RESTCatalog, load the branch table:
table = catalog.get_table(Identifier("db", "table", branch="dev"))

assert table.current_branch() == "dev"
assert table.schema_manager.branch == "dev"

The second assertion fails because schema_manager.branch is main.

What doesn't meet your expectations?

Schema operations should use the branch specified by Identifier. Altering a filesystem branch should not modify the main branch and a REST branch table should read schemas from that branch. Currently, both operations can incorrectly use the main branch.

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions