zhang-arvin opened a new pull request, #18261:
URL: https://github.com/apache/iceberg/pull/18261

   Fixes #18256.
   
   `ResolveBranch` pins the target branch during analysis and rewrites the 
relation identifier so that further refreshes keep pointing at the branch. The 
two `PathIdentifier` cases that do the rewrite had no coverage: nothing under 
`spark/*/spark-extensions/src/test` referenced the rule, and the only tests 
combining a path load with a branch were the negative assertions in 
`TestSnapshotSelection`.
   
   This adds `TestResolveBranch` for Spark 4.1 and 4.2, covering a path read, a 
path read that carries a metadata selector, and a write to a branch on a table 
loaded by path.
   
   One thing worth flagging about the reachability of the rule: for a path load 
the branch selector is already applied by `IcebergSource` while the path 
identifier is built, so `table.branch` equals the requested branch by the time 
the rule runs and the rule returns the relation unchanged. The case that 
actually reaches the rewrite is a branch taken from the session WAP branch 
(`spark.wap.branch`), which the read tests use. A metadata-table path such as 
`<location>#files` is likewise left untouched. The tests assert the observed 
behavior of all three, rather than the assumed identifiers, and the read test 
asserts the rewritten `<location>#branch_<name>` identifier plus the branch 
pinned on `SparkTable`.
   
   No production behavior change; test-only.
   
   ---
   **AI Disclosure**
   - Model: deepseek-v4.1-flash
   - Platform/Tool: Hermes Agent (Nous Research)
   - Human Oversight: partially reviewed
   - Prompt Summary: Add JUnit test coverage for ResolveBranch PathIdentifier 
branch-selector rewriting on path-loaded tables
   
   Testing performed locally:
   - `./gradlew :iceberg-spark:iceberg-spark-extensions-4.2_2.13:test --tests 
"org.apache.iceberg.spark.extensions.TestResolveBranch"` — 3 tests, 0 failures 
(verified via the JUnit XML report).
   - `./gradlew spotlessCheck` — passed.
   
   The 4.1 test source is identical to the 4.2 one; the 4.1 test task was not 
executed locally because this checkout only enables the 4.2 Spark version by 
default.


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