manuzhang opened a new issue, #18256:
URL: https://github.com/apache/iceberg/issues/18256

   ### Feature Request / Improvement
   
   `ResolveBranch` pins the target branch during analysis and rewrites the 
relation identifier so later refreshes still point at the branch. For 
path-based tables it has two dedicated cases:
   
   ```scala
   case path: PathIdentifier if path.location.contains("#") =>
     new PathIdentifier(path.location + "," + branchSelector)
   case path: PathIdentifier =>
     new PathIdentifier(path.location + "#" + branchSelector)
   case _ =>
     Identifier.of(ident.namespace :+ ident.name, branchSelector)
   ```
   
   Neither `PathIdentifier` case has any test coverage. Nothing under 
`spark/*/spark-extensions/src/test` references `ResolveBranch`, and the only 
existing tests that combine a path load with `SparkReadOptions.BRANCH` are 
negative ones in `TestSnapshotSelection` asserting `"Cannot time travel in 
branch"`. So the behavior that is actually exercised today is the 
catalog-identifier `case _`.
   
   That leaves three things unverified for tables loaded by path:
   
   1. Reading a branch through `.option("branch", ...)` resolves to a 
`SparkTable` pinned to that branch, with the identifier rewritten to 
`<location>#branch_<name>`.
   2. When the location already carries a metadata selector, the branch 
selector is appended with a comma rather than a second `#`, giving 
`<location>#files,branch_<name>`.
   3. Writing through `.option("branch", ...)` appends to the branch and leaves 
the main table unchanged.
   
   The comma-vs-hash distinction in particular is easy to break in a refactor 
and would surface only as a confusing path-parsing error at refresh time.
   
   Proposal: add a `TestResolveBranch` under `spark-extensions` covering the 
read, metadata-selector, and write paths against a `HadoopTables` table. This 
is test-only; no production behavior change is intended.
   
   ### Query engine
   
   Spark
   
   ### Willingness to contribute
   
   - [x] I can contribute this improvement independently
   
   ---
   **AI Disclosure**
   - Model: Claude Opus 5
   - Platform/Tool: Claude Code
   - Human Oversight: partially reviewed
   - Prompt Summary: file an issue describing the missing `ResolveBranch` 
path-identifier test coverage in the Spark extensions.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to