Skip to content

fix(catalog/glue): case insensitive type match - #480

Merged
zeroshade merged 2 commits into
apache:mainfrom
vbekiaris:table-type-check
Jul 8, 2025
Merged

zeroshade merged 2 commits into
apache:mainfrom
vbekiaris:table-type-check

Conversation

@vbekiaris

Copy link
Copy Markdown
Contributor

table_type and database_type key values are now
compared against "ICEBERG" string in case-insensitive way
(similar to how PyIceberg and Java implementations work).

Fixes #479

table_type and database_type key values are now
compared against "ICEBERG" string in case-insensitive
way (similar to how PyIceberg and Java implementations
work).
Comment thread catalog/glue/glue.go Outdated
}

if tblRes.Table.Parameters[tableTypePropsKey] != glueTypeIceberg {
if strings.ToUpper(tblRes.Table.Parameters[tableTypePropsKey]) != glueTypeIceberg {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any particular reason to use ToUpper here and EqualFold below instead of just using EqualFold in both cases?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no particular reason - changed in 9b918b6

@zeroshade
zeroshade merged commit ad83ccd into apache:main Jul 8, 2025
@vbekiaris

Copy link
Copy Markdown
Contributor Author

thanks @zeroshade for the quick review!

prafulla-kiran added a commit to prafulla-kiran/iceberg-go that referenced this pull request Jun 25, 2026
PR apache#480 made the Glue table_type check case-insensitive in getTable
and filterTableListByType so iceberg-go would accept the lowercase
"iceberg" value produced by PyIceberg and the AWS Glue Iceberg REST
endpoint (issue apache#479).

PR apache#537 (optimistic locking) later introduced a third call site,
convertGlueToIceberg, with a strict != comparison against "ICEBERG".
LoadTable -> getTable now passes case-insensitively but the subsequent
convertGlueToIceberg rejects the same table, reproducing the symptom
from apache#479 ("table X.Y is not an iceberg table" on a valid table).

This brings convertGlueToIceberg in line with the other two sites and
matches the case-insensitive behaviour in PyIceberg and the Java
implementation. Adds TestGlueConvertGlueToIcebergCaseInsensitive
mirroring the existing TestGlueGetTableCaseInsensitive.
prafulla-kiran added a commit to prafulla-kiran/iceberg-go that referenced this pull request Jun 25, 2026
PR apache#480 made the Glue table_type check case-insensitive in getTable
and filterTableListByType so iceberg-go would accept the lowercase
"iceberg" value produced by PyIceberg and the AWS Glue Iceberg REST
endpoint (issue apache#479).

PR apache#537 (optimistic locking) later introduced a third call site,
convertGlueToIceberg, with a strict != comparison against "ICEBERG".
LoadTable -> getTable now passes case-insensitively but the subsequent
convertGlueToIceberg rejects the same table, reproducing the symptom
from apache#479 ("table X.Y is not an iceberg table" on a valid table).

This brings convertGlueToIceberg in line with the other two sites and
matches the case-insensitive behaviour in PyIceberg and the Java
implementation. Adds TestGlueConvertGlueToIcebergCaseInsensitive
mirroring the existing TestGlueGetTableCaseInsensitive.
laskoviymishka pushed a commit that referenced this pull request Jun 26, 2026
#1269)

Fixes #1267 (related: #479, regressed by #537).

### Summary

`convertGlueToIceberg` is the only remaining case-sensitive `table_type`
check in `catalog/glue/glue.go` — the other two sites (`getTable`,
`filterTableListByType`) already use `strings.EqualFold` since #480.
This brings the third site in line so `LoadTable` accepts Glue tables
written by PyIceberg or via the AWS Glue Iceberg REST endpoint (both
emit lowercase `iceberg`), matching the case-insensitive semantics of
the PyIceberg and Java Glue implementations.

### Why

`LoadTable` → `getTable` now passes case-insensitively but the
subsequent `convertGlueToIceberg` rejects the same table, reproducing
the symptom from #479 (`table X.Y is not an iceberg table` on a valid
Iceberg table). Originally flagged by @tommika in a comment on #479.

### Change

- One-line fix at `catalog/glue/glue.go:703`: `!=` →
`!strings.EqualFold(...)`.
- New unit test `TestGlueConvertGlueToIcebergCaseInsensitive` mirroring
the existing `TestGlueGetTableCaseInsensitive`, covering `ICEBERG`,
`iceberg`, `IcEbErG`, and a non-Iceberg negative case. Verified by
reverting the fix and confirming the new test fails.

### Test plan

- [x] `go test ./catalog/glue/` passes
- [x] `golangci-lint run ./catalog/glue/...` clean
- [x] New test fails without the fix, passes with it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"table X.Y is not an iceberg table" on a valid iceberg table

2 participants