Skip to content

fix: validate transform parameters in metadata - #757

Merged
wgtmac merged 2 commits into
apache:mainfrom
fallintoplace:fix/validate-transform-params
Jul 23, 2026
Merged

fix: validate transform parameters in metadata#757
wgtmac merged 2 commits into
apache:mainfrom
fallintoplace:fix/validate-transform-params

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Summary

  • add Transform::Validate to reuse bind-time transform checks during metadata validation
  • reject invalid bucket/truncate parameters when parsing transform strings
  • make partition specs and sort orders reject non-positive bucket/truncate parameters during schema-bound validation

Validation

  • cmake -S . -B build-transform-params -G Ninja -DICEBERG_BUILD_BUNDLE=OFF -DICEBERG_BUILD_REST=OFF -DICEBERG_BUILD_SHARED=OFF
  • ctest --test-dir build-transform-params -R schema_test --output-on-failure

@huan233usc huan233usc 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. Correct and well-targeted: metadata validation now reaches the bind-time bucket/truncate parameter checks via ValidateBindMake, and the new tests genuinely exercise the parameter path (source types are valid for their transforms). Two minor, non-blocking nits inline.

Comment thread src/iceberg/transform.cc
Comment thread src/iceberg/transform.cc Outdated
StringUtils::ParseNumber<int32_t>(match[2].str()));

if (type_str == kBucketName) {
if (param <= 0) {

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.

The bucket/truncate positivity rule (and its message) is now duplicated here and in BucketTransform::Make/TruncateTransform::Make. Fine for fail-fast on unbound transforms, but easy to drift — consider a shared helper if it grows.

@fallintoplace
fallintoplace force-pushed the fix/validate-transform-params branch from 45d8d9d to beb7824 Compare June 30, 2026 20:58
Comment thread src/iceberg/transform.cc
Comment thread src/iceberg/transform_internal.h Outdated
Comment thread src/iceberg/transform.cc
@wgtmac

wgtmac commented Jul 23, 2026

Copy link
Copy Markdown
Member

I went ahead to address all comments and now CIs are green. Let me merge this. Thanks @fallintoplace and @huan233usc!

@wgtmac
wgtmac merged commit 6c30d3c into apache:main Jul 23, 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.

3 participants