Skip to content

fix: compare transform function parameters#840

Merged
wgtmac merged 1 commit into
apache:mainfrom
WZhuo:fix_trans_func
Jul 24, 2026
Merged

fix: compare transform function parameters#840
wgtmac merged 1 commit into
apache:mainfrom
WZhuo:fix_trans_func

Conversation

@WZhuo

@WZhuo WZhuo commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • include bucket counts in BucketTransform equality
  • include truncate widths in TruncateTransform equality
  • cover parameter and source-type differences in transform tests

Testing

  • build/src/iceberg/test/schema_test
  • pre-commit hooks

Copilot AI review requested due to automatic review settings July 23, 2026 02:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes TransformFunction equality for parameterized transforms so that bucket[N] and truncate[W] comparisons account for their parameters (and source types), and adds tests to prevent regressions.

Changes:

  • Make TransformFunction::Equals available to derived classes (protected) for shared equality checks.
  • Override Equals in BucketTransform and TruncateTransform to include num_buckets_ / width_ in equality.
  • Extend transform tests to cover parameter and source-type differences.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/iceberg/transform.h Exposes base equality helper (Equals) to derived transforms.
src/iceberg/transform_function.h Declares equality overrides for bucket/truncate transforms.
src/iceberg/transform_function.cc Implements parameter-aware equality for bucket/truncate transforms.
src/iceberg/test/transform_test.cc Adds equality tests for parameter and source-type differences.

Comment thread src/iceberg/transform.h
Comment thread src/iceberg/transform.h
/// \brief Compare two partition specs for equality.
protected:
/// \brief Compare the common properties of two transform functions for equality.
[[nodiscard]] virtual bool Equals(const TransformFunction& other) const;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: This is only used by the == overload, so maybe we can remove the [[nodiscard]] attribute? Same for the below.

@wgtmac wgtmac 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.

Make sense. Thanks @WZhuo for fixing it!

@wgtmac
wgtmac merged commit e7c5e9c into apache:main Jul 24, 2026
21 checks passed
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.

4 participants