Skip to content

Core: Refactor and use InternalData for partition stats - #12946

Merged
pvary merged 5 commits into
apache:mainfrom
ajantha-bhat:internaldata
May 8, 2025
Merged

Core: Refactor and use InternalData for partition stats#12946
pvary merged 5 commits into
apache:mainfrom
ajantha-bhat:internaldata

Conversation

@ajantha-bhat

@ajantha-bhatajantha-bhat commented May 1, 2025

Copy link
Copy Markdown
Member

a) Deprecate PartitionStatsHandler in iceberg-data
b) Copy PartitionStatsHandler from iceberg-data to iceberg-core and Use InternalData( also package name had to change to use PartitionStatsUtill logic as private code). So, users can add dependency on core and parquet instead of whole data module to use partition stats feature.
c) Deprecate PartitionStatsUtil as no need of too many public interface and we can use that logic as private inside PartitionStatsHandler (comment during #12629)
d) Deprecate TestPartitionStatsUtil as the functionality test is covered from TestPartitionStatsHandler
e) Move benchmarks to iceberg-data as InternalData needs parquet dependency.

* Computes, writes and reads the {@link PartitionStatisticsFile}. Uses generic readers and writers
* to support writing and reading of the stats in table default format.
*/
public class PartitionStatsHandler {

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This class was just copied from iceberg-data module (deprecated now) and replace datawriter and reader function with InternalData

return stats;
}

private static Collection<PartitionStats> computeStats(Table table, Snapshot snapshot) {

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Copied the methods from partitionStatsUtil (perviously public, now deprecated) as got a comment that no need to keep too many public interfaces and compute logic can be internal to compute and write.

@deniskuzZ

Copy link
Copy Markdown
Member

hi @ajantha-bhat, do you think it would make sense to rename PartitionStatsHandler to PartitionStatsUtil since it's a util class with only static methods?

Comment threadcore/src/main/java/org/apache/iceberg/PartitionStatsHandler.java Outdated
Comment threadcore/src/main/java/org/apache/iceberg/PartitionStatsHandler.java Outdated
@ajantha-bhat

ajantha-bhat commented May 1, 2025

Copy link
Copy Markdown
MemberAuthor

hi @ajantha-bhat, do you think it would make sense to rename PartitionStatsHandler to PartitionStatsUtil since it's a util class with only static methods?

@deniskuzZ: Thanks for the suggestion. Since we already released the public interface as PartitionStatsHandler, I would like to continue this naming. Plus in the talks and blogs we are already using this name.

@deniskuzZdeniskuzZ left a comment

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.

LGTM +1
thanks @pvary for the proposal and @ajantha-bhat for refactoring and merging the partition stats functionality. Looking forward for the increment partition stats compute support.

Comment threaddata/src/test/java/org/apache/iceberg/TestPartitionStatsHandler.java Outdated
@ajantha-bhat

Copy link
Copy Markdown
MemberAuthor

@pvary: PR is ready for review.

@advancedxyadvancedxy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM on my side, looking forward to the incremental support.

Comment threadcore/src/test/java/org/apache/iceberg/PartitionStatsHandlerBase.java Outdated
Comment threadcore/src/test/java/org/apache/iceberg/PartitionStatsHandlerBase.java Outdated
Comment threadcore/src/test/java/org/apache/iceberg/PartitionStatsHandlerTestBase.java Outdated
@ajantha-bhat

Copy link
Copy Markdown
MemberAuthor

Rebased the PR due to spark flaky test.

@ajantha-bhat

Copy link
Copy Markdown
MemberAuthor

@pvary and @gaborkaszab: Anymore comments for this? Thanks for the review.

@gaborkaszabgaborkaszab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the changes @ajantha-bhat !
I left one minor comment, but other than that the PR LGTM!

Comment threadcore/src/test/java/org/apache/iceberg/TestPartitionStatsUtil.java Outdated
@pvary
pvary merged commit bed88a3 into apache:mainMay 8, 2025
@pvary

pvary commented May 8, 2025

Copy link
Copy Markdown
Contributor

Merged to main.
Thanks for the PR @ajantha-bhat and @deniskuzZ, @advancedxy, @gaborkaszab for the reviews!

anuragmantri added a commit to anuragmantri/iceberg that referenced this pull request Jul 25, 2025
devendra-nr pushed a commit to devendra-nr/iceberg that referenced this pull request Dec 8, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@ajantha-bhat@deniskuzZ@pvary@advancedxy@gaborkaszab