Repository navigation
Conversation
Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>
Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>
JingsongLi
left a comment
There was a problem hiding this comment.
[P2] Let explicit time travel override the configured default on a resolved branch.
On Spark 3.5.9 I created dev with snapshot 1 containing 2 and a later tag review_tag containing 2,3. I set the requested table's branch=dev and scan.snapshot-id=1 in SQLConf. The new ordinary read correctly returns [2]. An explicit SELECT id FROM rr_time_travel VERSION AS OF 'review_tag' then fails with must set only one key in [scan.snapshot-id,scan.tag-name,scan.watermark]. Removing the configured snapshot makes the same query return [2,3].
With the base SparkCatalog and OptionUtils restored on the same Spark classpath, the explicit query also returns [2,3] with that SQLConf set. Spark passes the explicit version separately in extraOptions. Please clear competing default time-travel selectors when applying an explicit SQL version or timestamp, while keeping the scoped defaults for ordinary reads. The 27 existing options tests passed.
Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>
Akash3121
left a comment
There was a problem hiding this comment.
Thanks @QuakeWang for the updates! Both the default-branch (main) identifier handling and the interaction between branch resolution, session scan selectors, and explicit VERSION AS OF / TIMESTAMP AS OF time travel look clean and well-tested. LGTM!
Purpose
Spark resolved the branch using the requested table name, then looked up options again using the branch-qualified name. With
branch=devandscan.snapshot-id=1configured for the same table, the second lookup lost the snapshot option and returned rows from a later snapshot.Resolve options once against the requested identifier, load the selected branch, and apply the remaining options to that table. Match identifier components literally so names such as
sales(v2)and$audit_logwork with table-scoped settings.Tests
Added SQL coverage for branch selection, audit logs, and reading the first of two snapshots on
dev. All 27 targeted tests passed on both Spark 3.5.9 and 4.1.4.