fix: use equalsIgnoreCase in isTableRename to match HMS behaviour #138
Merged
jamespfaulkner merged 1 commit intoJun 26, 2026
Merged
Conversation
HMS (HiveAlterHandler) uses equalsIgnoreCase when detecting renames, so a case-only name change (e.g. my_table → My_Table) is never treated as a rename in the metastore. GlueSync was using equals(), causing it to incorrectly enter doRenameOperation, which then failed with AlreadyExistsException because Glue is also case-insensitive and the lowercase table already existed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
javsanbel2
approved these changes
Jun 26, 2026
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.
Problem
ApiaryGlueSync.isTableRename()usedString.equals()to compare old and newtable names. This caused a case-only name change (e.g.
foo_bar_baz→Foo_Bar_Baz) to betreated as a genuine rename, triggering
doRenameOperationand anAlreadyExistsExceptionfrom Glue on every replay of the event.Why this happens
When a client calls
alter_tableon HMS with a newTableobject whosetableNamediffers from the stored name only in case, HMS does not treatit as a rename.
HiveAlterHandler.alterTable()lowercases the old table nameparameter (lines 135–136) and then uses
equalsIgnoreCasefor the renamecheck (lines 138–143):
HMS completes the alter_table as a metadata update without renaming. The
AlterTableEvent is then fired after alterHandler.alterTable() returns,
with the original newt object unchanged — so newt.getTableName() carries
the mixed-case name as provided by the caller.
ApiaryGlueSync received this event and compared names with equals(),
disagreeing with HMS's own equalsIgnoreCase check. It entered
doRenameOperation, called GlueTableService.create() with the mixed-case
name, and got AlreadyExistsException because Glue is also case-insensitive
and the lowercase table already existed.
Fix
Change isTableRename() to use equalsIgnoreCase(), aligning it with HMS's
own rename-detection logic. A case-only difference is now treated as a regular
metadata update (falls through to updateTable) rather than a rename.
This is a defensive fix in GlueSync. The root cause — egdl-hive-agent
constructing Table objects with mixed-case names derived from Avro record
names — should be addressed separately in that repo.
Test plan
that create, batchCreatePartition, and deleteTable are never called
when old and new table names differ only by case, and that updateTable
is called instead.
onAlterHiveTable_RenameOperationFailureIsMetered,
onAlterIcebergTable_RenameTableSkipsRenameOperation) all continue to pass.