fix(plugin-iceberg): Fix Iceberg ANALYZE failure when column names in metadata are not lowercase for Native catalogs#28209
Open
agrawalreetika wants to merge 1 commit into
prestodb:masterprestodb/presto:masterfrom
agrawalreetika:iceberg-analyze-nativeagrawalreetika/prestodb:iceberg-analyze-nativeCopy head branch name to clipboard
Open
fix(plugin-iceberg): Fix Iceberg ANALYZE failure when column names in metadata are not lowercase for Native catalogs#28209agrawalreetika wants to merge 1 commit intoprestodb:masterprestodb/presto:masterfrom agrawalreetika:iceberg-analyze-nativeagrawalreetika/prestodb:iceberg-analyze-nativeCopy head branch name to clipboard
agrawalreetika wants to merge 1 commit into
prestodb:masterprestodb/presto:masterfrom
agrawalreetika:iceberg-analyze-nativeagrawalreetika/prestodb:iceberg-analyze-nativeCopy head branch name to clipboard
Conversation
agrawalreetika
requested review from
a team,
ZacBlanco,
hantangwangd and
imjalpreet
as code owners
July 23, 2026 16:44
prestodb-ci
requested review from
a team and
NivinCS
and removed request for
a team
July 23, 2026 16:44
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR fixes Iceberg ANALYZE failures for Native catalogs by making column lookup in table statistics generation case-insensitive, so ANALYZE works with schemas whose column names are not stored in lowercase. Sequence diagram for Iceberg ANALYZE case-insensitive column lookupsequenceDiagram
participant PrestoAnalyzer
participant TableStatisticsMaker
participant IcebergTable
participant IcebergSchema
PrestoAnalyzer->>TableStatisticsMaker: writeTableStatistics
TableStatisticsMaker->>TableStatisticsMaker: generateNDVBlob
TableStatisticsMaker->>TableStatisticsMaker: getField(metadata, icebergTable, snapshot)
TableStatisticsMaker->>IcebergTable: schemas()
IcebergTable-->>TableStatisticsMaker: SchemaMap
TableStatisticsMaker->>IcebergSchema: caseInsensitiveFindField(metadata.getColumnName)
alt field found
IcebergSchema-->>TableStatisticsMaker: NestedField
TableStatisticsMaker-->>PrestoAnalyzer: statistics written
else field not found
TableStatisticsMaker->>TableStatisticsMaker: log.warn
TableStatisticsMaker-->>PrestoAnalyzer: PrestoException ICEBERG_INVALID_METADATA
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Pull request overview
Fixes ANALYZE failures for Iceberg tables (specifically when using Native catalogs like REST/Nessie/Hadoop) where the Iceberg schema stores column names with non-lowercase casing, but Presto’s stats collection references the columns using a different case.
Changes:
- Switch Iceberg schema field resolution in stats collection from case-sensitive
findFieldtocaseInsensitiveFindFieldto tolerate mixed/upper-case column names in Iceberg metadata.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
508
to
512
| return Optional.ofNullable(icebergTable.schemas().get(snapshot.schemaId())) | ||
| .map(schema -> schema.findField(metadata.getColumnName())) | ||
| .map(schema -> schema.caseInsensitiveFindField(metadata.getColumnName())) | ||
| .orElseThrow(() -> { | ||
| log.warn("failed to find column name %s in schema of table %s", metadata.getColumnName(), icebergTable.name()); | ||
| return new PrestoException(ICEBERG_INVALID_METADATA, format("failed to find column name %s in schema of table %s", metadata.getColumnName(), icebergTable.name())); |
agrawalreetika
force-pushed
the
iceberg-analyze-native
branch
from
July 24, 2026 05:00
7e42d7a to
59018e5
Compare
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.
ANALYZE on Iceberg tables using Native catalogs (REST, Nessie, Hadoop) failed with:
This occurred when Iceberg table metadata was written by an external engine (e.g., Spark, Flink, or other systems) that stored column names in non-lowercase form in the Iceberg schema. During
ANALYZE, Presto resolves column names viaschema.findField(columnName), which performs a case-sensitive lookup. If the schema stored a column as ID or Name but the stat collection referenced it as id or name, the lookup returned null, and the error was thrown.Description
Fix Iceberg ANALYZE failure when column names in metadata are not lowercase for Native catalogs
Motivation and Context
Fix Iceberg ANALYZE failure when column names in metadata are not lowercase for Native catalogs
Impact
Test Plan
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.
Summary by Sourcery
Bug Fixes: