fix: validate transform parameters in metadata#757
Conversation
huan233usc
left a comment
There was a problem hiding this comment.
LGTM. Correct and well-targeted: metadata validation now reaches the bind-time bucket/truncate parameter checks via Validate→Bind→Make, and the new tests genuinely exercise the parameter path (source types are valid for their transforms). Two minor, non-blocking nits inline.
| return InvalidArgument("Invalid source type {} for transform {}", | ||
| source_type->ToString(), ToString()); | ||
| } | ||
| ICEBERG_RETURN_UNEXPECTED(Bind(source_type)); |
There was a problem hiding this comment.
Worth a one-line comment on why both CanTransform and Bind are called here: CanTransform keeps type mismatches as InvalidArgument/"Invalid source type", whereas Bind→Make would report them as NotSupported. Otherwise a future cleanup may drop CanTransform as redundant and silently change the error kind.
| StringUtils::ParseNumber<int32_t>(match[2].str())); | ||
|
|
||
| if (type_str == kBucketName) { | ||
| if (param <= 0) { |
There was a problem hiding this comment.
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.
45d8d9d to
beb7824
Compare
Summary
Transform::Validateto reuse bind-time transform checks during metadata validationValidation
cmake -S . -B build-transform-params -G Ninja -DICEBERG_BUILD_BUNDLE=OFF -DICEBERG_BUILD_REST=OFF -DICEBERG_BUILD_SHARED=OFFctest --test-dir build-transform-params -R schema_test --output-on-failure