You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "yushesp (via GitHub)" <gi...@apache.org> on 2026/04/09 18:33:39 UTC
[PR] Spark: Fix NullPointerException in FastForwardBranchProcedure [iceberg]
yushesp opened a new pull request, #15928:
URL: https://github.com/apache/iceberg/pull/15928
The procedure dereferenced `table.snapshot(from)` without a null check after committing the fast-forward, which could produce a bare NullPointerException with no error msg.
This change replaces the unchecked dereference with a `Preconditions.checkState` guard that surfaces a exception that includes the branch name. Also eliminates the redundant double-lookup of the "before" snapshot by storing it in a local Snapshot variable.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Spark: Fix NPE in FastForwardBranchProcedure [iceberg]
Posted by "yushesp (via GitHub)" <gi...@apache.org>.
yushesp commented on code in PR #15928:
URL: https://github.com/apache/iceberg/pull/15928#discussion_r3070712442
##########
spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/procedures/FastForwardBranchProcedure.java:
##########
@@ -82,12 +84,18 @@ public InternalRow[] call(InternalRow args) {
return modifyIcebergTable(
tableIdent,
table -> {
- Long snapshotBefore =
- table.snapshot(from) != null ? table.snapshot(from).snapshotId() : null;
+ Snapshot snapshotBefore = table.snapshot(from);
table.manageSnapshots().fastForwardBranch(from, to).commit();
Review Comment:
Good point, got a NPE but looks like it was due to a different issue. After a successful commit the ref is guaranteed to resolve. I'll go ahead and close this PR out.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Spark: Fix NPE in FastForwardBranchProcedure [iceberg]
Posted by "singhpk234 (via GitHub)" <gi...@apache.org>.
singhpk234 commented on code in PR #15928:
URL: https://github.com/apache/iceberg/pull/15928#discussion_r3070608835
##########
spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/procedures/FastForwardBranchProcedure.java:
##########
@@ -82,12 +84,18 @@ public InternalRow[] call(InternalRow args) {
return modifyIcebergTable(
tableIdent,
table -> {
- Long snapshotBefore =
- table.snapshot(from) != null ? table.snapshot(from).snapshotId() : null;
+ Snapshot snapshotBefore = table.snapshot(from);
table.manageSnapshots().fastForwardBranch(from, to).commit();
Review Comment:
if the commit passes why would the fastforward not pass ?
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Spark: Fix NPE in FastForwardBranchProcedure [iceberg]
Posted by "yushesp (via GitHub)" <gi...@apache.org>.
yushesp closed pull request #15928: Spark: Fix NPE in FastForwardBranchProcedure
URL: https://github.com/apache/iceberg/pull/15928
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org