fix(connector): Enable NDV stats collection for Iceberg in native mode#27207
Merged
tdcmeehan merged 1 commit intoprestodb:masterfrom Feb 26, 2026
Merged
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRe-enables collection of all supported column statistics, including NDV, for Iceberg tables in native execution by aligning Iceberg metadata behavior with the base statistics metadata provider. Sequence diagram for statistics collection in Iceberg native executionsequenceDiagram
actor QueryEngine
participant IcebergHiveMetadata
participant ConnectorSystemConfig
participant BaseStatisticsMetadata as BaseStatisticsMetadata
participant TableStatisticsMetadata
QueryEngine->>IcebergHiveMetadata: getStatisticsCollectionMetadata(session, tableMetadata)
IcebergHiveMetadata->>ConnectorSystemConfig: isNativeExecution(session)
ConnectorSystemConfig-->>IcebergHiveMetadata: nativeExecutionFlag
Note over IcebergHiveMetadata: Previously skipped base stats when nativeExecutionFlag was true
IcebergHiveMetadata->>BaseStatisticsMetadata: getStatisticsCollectionMetadata(session, tableMetadata)
BaseStatisticsMetadata-->>IcebergHiveMetadata: baseColumnStatistics
IcebergHiveMetadata-->>QueryEngine: TableStatisticsMetadata(supportedStatistics, tableStatistics)
Updated class diagram for IcebergHiveMetadata statistics metadataclassDiagram
class IcebergHiveMetadata {
+TableStatisticsMetadata getStatisticsCollectionMetadata(ConnectorSession session, TableMetadata tableMetadata)
}
class ConnectorSession
class TableMetadata
class ColumnStatisticMetadata
class TableStatisticType
class TableStatisticsMetadata {
+TableStatisticsMetadata(Set~ColumnStatisticMetadata~ columnStatistics, Set~TableStatisticType~ tableStatistics, List~ColumnStatisticMetadata~ groupedColumns)
}
class ConnectorSystemConfig {
+boolean isNativeExecution(ConnectorSession session)
}
IcebergHiveMetadata --> ConnectorSystemConfig : uses
IcebergHiveMetadata --> TableStatisticsMetadata : creates
IcebergHiveMetadata --> ColumnStatisticMetadata : aggregates
IcebergHiveMetadata --> TableStatisticType : aggregates
IcebergHiveMetadata --> ConnectorSession : parameter
IcebergHiveMetadata --> TableMetadata : parameter
TableStatisticsMetadata --> ColumnStatisticMetadata : contains
TableStatisticsMetadata --> TableStatisticType : contains
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Since NDV stats are now enabled for native execution, check whether
connectorSystemConfig.isNativeExecution()(and any related branching) is still used elsewhere inIcebergHiveMetadataand remove any dead code or config flags that are no longer needed.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Since NDV stats are now enabled for native execution, check whether `connectorSystemConfig.isNativeExecution()` (and any related branching) is still used elsewhere in `IcebergHiveMetadata` and remove any dead code or config flags that are no longer needed.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
e586e89 to
f13bba8
Compare
tdcmeehan
approved these changes
Feb 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.
Description
This change enables the collection of these NDV stats for Iceberg tables in Prestissimo.
Motivation and Context
We disabled collection of NDV stats for Iceberg tables in Prestissimo because the sketch theta functions were not implemented. Now the functions are implemented as part of PR #25685.
Impact
No impact
Test Plan
There is an existing test in TestPrestoNativeIcebergGeneralQueries.java
Summary by Sourcery
Enhancements: