fix: guard against null metadata in checkCurrentMetadataLocation - #17548
Open
waterWang wants to merge 1 commit into
Open
fix: guard against null metadata in checkCurrentMetadataLocation#17548waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
uros-b
reviewed
Aug 8, 2026
uros-b
left a comment
Member
There was a problem hiding this comment.
@waterWang Please note that @superdiaodiao was already working on this in #17464.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When
checkCommitStatusis called during a CREATE TABLE operation (wherebase == null),refresh()returnsnullbecause the table does not yet exist in the metastore. The subsequent call tometadata.metadataFileLocation()throws aNullPointerException, which is swallowed by.suppressFailureWhenFinished(), resulting in a misleadingCommitStateUnknownExceptionthat tells the user to perform unnecessary manual remediation.Fix
Add a null check after
refresh(). Ifrefresh()returns null, the table does not exist in the catalog, so the commit could not have landed — returnfalseimmediately.Root cause
HiveTableOperations.doRefresh()swallowsNoSuchObjectExceptionwhencurrentMetadataLocation()is null (the CREATE TABLE case), leavingcurrentMetadata == nullwithshouldRefresh = false. The subsequentrefresh()→current()call returnsnull, whichcheckCurrentMetadataLocationthen dereferences.Testing
The existing test coverage for
checkCommitStatusonly covers the update path (table already exists). A CREATE TABLE failure path is not covered byTestHiveCommits. This fix adds a defensive null guard that is trivially correct — the only valid return value when the table metadata is null isfalse(commit did not land).Closes #17462