Skip to content

Fix chained-transform schema validation error to list conflicting col…#18512

Open
dkranchii wants to merge 1 commit into
apache:masterfrom
dkranchii:fix/schema-validation-chained-transform-msg
Open

Fix chained-transform schema validation error to list conflicting col…#18512
dkranchii wants to merge 1 commit into
apache:masterfrom
dkranchii:fix/schema-validation-chained-transform-msg

Conversation

@dkranchii
Copy link
Copy Markdown
Contributor

Summary

SchemaUtils.validate(...) correctly rejects a schema where a column produced by one transform function is reused as an argument to another transform, but the error message previously rendered as "Columns: true are a result of transformations, and cannot be used as arguments to other transform functions" (or false). The cause: Set#retainAll returns a boolean, and that boolean was passed where the formatted intersection set should have been.

The message is surfaced through the controller's schema REST endpoint, so operators currently see "Invalid schema: <name>. Reason: Columns: true ..." and have no way to tell which columns actually conflict.

What this PR changes

  • Compute the intersection into a fresh HashSet and pass that set to Preconditions.checkState, producing "Columns: [x] are a result of transformations, ...".
  • Removes a latent side effect (retainAll was mutating transformedColumns regardless of validation outcome).
  • Drops the now-unused import java.util.Collections.

Testing

  • Added SchemaUtilsTest#testChainedTransformErrorMessageListsConflictingColumns, which asserts the full expected error message so the bug cannot regress silently.
  • Pre-existing testValidateTransformFunctionArguments continues to cover the validation outcome.
  • Local: ./mvnw -pl pinot-core -Dtest=SchemaUtilsTest testTests run: 12, Failures: 0, Errors: 0.

Risk

  • Low: change is one static utility method in pinot-segment-local plus one new test in pinot-core.
  • No public API changes, no dependency changes, no wire-format / rolling-upgrade implications. Only the human-readable error text changes for an already-failing input.

…umns

The error message previously rendered as "Columns: true ..." because
Set#retainAll's boolean return value was passed as the format argument
instead of the intersection set.

Compute the intersection into a fresh HashSet so operators see the
actual conflicting columns (e.g. "Columns: [x] ..."). Adds a regression
test that asserts the full expected message.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.73%. Comparing base (2ffaa1c) to head (47f34e8).

Additional details and impacted files
@@              Coverage Diff              @@
##             master   #18512       +/-   ##
=============================================
+ Coverage     35.23%   63.73%   +28.49%     
- Complexity     1117     1932      +815     
=============================================
  Files          3292     3292               
  Lines        201470   201471        +1     
  Branches      31316    31316               
=============================================
+ Hits          70998   128398    +57400     
+ Misses       124206    62788    -61418     
- Partials       6266    10285     +4019     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-21 63.73% <100.00%> (+28.49%) ⬆️
temurin 63.73% <100.00%> (+28.49%) ⬆️
unittests 63.72% <100.00%> (+28.49%) ⬆️
unittests1 55.79% <100.00%> (?)
unittests2 35.24% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dkranchii
Copy link
Copy Markdown
Contributor Author

@Jackie-Jiang can you please review this PR. thanks

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.

2 participants