JingsongLi commented on PR #482:
URL: https://github.com/apache/paimon-rust/pull/482#issuecomment-4923352962

   I found one correctness issue with branch-qualified system tables.
   
   `system_tables::load` switches the loaded `Table` to the requested branch 
for branch-qualified system tables, but `$partitions` is special-cased. 
`provider_for_table` routes it to `partitions::build(catalog, identifier, 
table)`, where `identifier` is still the base table identifier. Later 
`PartitionsTable::scan` calls `catalog.list_partitions(&identifier)`, so the 
branch qualifier is lost.
   
   As a result, `SELECT * FROM t$branch_b1$partitions` returns partitions from 
the main branch instead of branch `b1`.
   
   I verified this locally with a partitioned table:
   1. write partition `id=1`
   2. create branch `b1`
   3. write partition `id=2` on main
   4. query `t$branch_b1$partitions`
   
   The result contains both main partitions (`[1, 1]`) instead of only the 
branch partition (`[1]`).
   
   Could you fix `$partitions` to respect the branch reference as well? Either 
use the branch-bound `Table` to list/scan partition entries, or pass a 
branch-qualified identifier to `catalog.list_partitions`. Please also add a 
regression test for `table$branch_b1$partitions`.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to