You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "Akanksha-kedia (via GitHub)" <gi...@apache.org> on 2026/07/01 05:28:10 UTC

[PR] Fix SchemaUtils to surface actual validation failure reason [pinot]

Akanksha-kedia opened a new pull request, #18896:
URL: https://github.com/apache/pinot/pull/18896

   ## Description
   
   The `updateSchema` endpoint in `PinotSchemaRestletResource` was catching `SchemaBackwardIncompatibleException` but discarding the actual error details, returning only a generic message: `"Backward incompatible schema <name>. Only allow adding new columns"`.
   
   This made it very difficult for users to understand **why** their schema update was rejected. The exception itself already contains detailed information about incompatible field specifications, missing columns, primary key changes, and suggestions for fixing the issue — but this information was never surfaced to the user.
   
   After this fix, the error response includes the actual reason from `e.getMessage()`, giving users actionable information about what is incompatible and how to fix it.
   
   ## Related Issue
   
   Fixes #14787
   
   ## Changes Made
   
   - Modified `PinotSchemaRestletResource.updateSchema()` to include `e.getMessage()` in the error response for `SchemaBackwardIncompatibleException`, replacing the generic "Only allow adding new columns" message.
   - Added a test assertion in `PinotSchemaRestletResourceTest` to verify that backward-incompatible schema update errors include the actual incompatibility details.
   
   ## Testing Done
   
   - [x] Unit test updated to verify error message includes incompatibility details
   - [x] Spotless formatting passes
   - [x] Checkstyle passes
   - [x] Compilation verified
   
   ## Upgrade Notes
   
   None. This is a user-facing error message improvement only — no API or configuration changes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Fix SchemaUtils to surface actual validation failure reason [pinot]

Posted by "Akanksha-kedia (via GitHub)" <gi...@apache.org>.
Akanksha-kedia commented on PR #18896:
URL: https://github.com/apache/pinot/pull/18896#issuecomment-4852853446

   cc @Jackie-Jiang @siddharthteotia @npawar — requesting your review.
   
   ## What this PR does
   
   Fixes a UX paper-cut in schema validation: when `SchemaUtils` rejects a backward-incompatible schema change, the REST response previously returned a generic message like:
   
   > *"Backward incompatible schema myTable. Only allow adding new columns"*
   
   The exception already carries the full reason (which column was removed, which type changed, etc.) but it was being silently discarded in the catch block. This one-line fix threads `e.getMessage()` into the response:
   
   > *"Backward incompatible schema myTable. Reason: Column 'userId' changed type from INT to STRING"*
   
   **Why it matters:** operators debugging failed schema updates had no way to know from the API response what was actually wrong — they had to dig into controller logs. This surfaces the detail directly in the REST response where it belongs.
   
   **Change scope:** one catch block in `PinotSchemaRestletResource`, plus a test assertion verifying the message contains the incompatibility detail.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Fix SchemaUtils to surface actual validation failure reason [pinot]

Posted by "Akanksha-kedia (via GitHub)" <gi...@apache.org>.
Akanksha-kedia commented on PR #18896:
URL: https://github.com/apache/pinot/pull/18896#issuecomment-4855243168

   ## Code Review — PR #18896 (`fix/schema-utils-validation-message`)
   
   The fix is correct — the exception message from `PinotHelixResourceManager` (which constructs detailed incompatibility info including missing columns, field-type changes, and suggestions) now flows through to the HTTP 400 response body. Two **MAJOR** findings on test coverage, several **MINOR** style issues.
   
   ---
   
   ### C5 — Correctness & Nulls
   
   **[MINOR] `e.getMessage()` null-safety** (`PinotSchemaRestletResource.java:480`)
   `SchemaBackwardIncompatibleException` always passes a non-null message at its only throw site today. However, the constructor has no `Objects.requireNonNull` guard — a future subclass or test stub could pass `null`, producing `"Reason: null"`. Consider:
   ```java
   String.format("Backward incompatible schema %s. Reason: %s", schemaName,
       Objects.toString(e.getMessage(), "(no message)"))
   ```
   
   **[MINOR] Asymmetry between `addSchema` and `updateSchema` error format**
   `addSchema` (line 439) forwards `e.getMessage()` with no outer prefix. `updateSchema` (line 477) now wraps it as `"Backward incompatible schema %s. Reason: %s"`. A user hitting `POST /schemas?override=true` vs `PUT /schemas/{name}` gets different message shapes for the same underlying error. Also: the outer prefix `"Backward incompatible schema %s."` and the inner message both identify the schema by name — the prefix is redundant.
   
   ---
   
   ### C6 — Testing
   
   **[MAJOR] No message-content assertion for the `addSchema` (POST override) backward-incompatibility path**
   `createSchema` on line 108 still uses `expectValidationException`, which only checks the exception type. Since `addSchema`'s catch block also passes `e.getMessage()`, the detailed-message contract for that path is untested. Add an `expectValidationExceptionWithMessage` assertion there too.
   
   **[MINOR] Asserting on implementation-internal substring `"Incompatible field specifications"`**
   This string is constructed in `PinotHelixResourceManager`. If the wording changes, the test becomes a weaker assertion silently. A more stable anchor is `"Reason:"` (owned by the REST layer) or the column name being changed.
   
   ---
   
   ### C3 — Naming & API
   
   **[MINOR] `"Reason:"` prefix usage is inconsistent across the file**
   `validateSchemaInternal` uses concatenation (`". Reason: "`); `updateSchema`'s generic `Exception` catch and the new handler use format strings (`"Reason: %s"`); `addSchema`'s handler uses no prefix at all. Standardise on one form.
   
   ---
   
   ### C8 — Process & Scope
   
   **[MAJOR] Scope gap: only `updateSchema` was changed, but the test does not validate the pre-existing `addSchema` message path**
   `addSchema` (line 439) was already forwarding `e.getMessage()` correctly before this PR. The PR correctly fixes only `updateSchema`. However, there is no test confirming `addSchema` also surfaces the detail. The PR title says "include validation failure reason" — adding the `addSchema` test would make coverage complete.
   
   ---
   
   ### C1 — Architecture (advisory)
   
   **[MINOR] Detailed incompatibility message is constructed in the resource manager, not in the exception or a value type**
   The 60-line error-building block in `PinotHelixResourceManager.updateSchema()` (lines 1626–1685) is user-facing text embedded inside the manager. A cleaner long-term direction: `Schema.isBackwardCompatibleWith()` returns a structured `BackwardCompatibilityResult` (list of violations) and the REST layer does the formatting. This PR doesn't make things worse, but flagging for future consideration.
   
   ---
   
   ### Pre-existing issue (not introduced here)
   `updateSchema` returns `SuccessResponse(schema.getSchemaName() + " successfully added")` (line 472) — should be `"successfully updated"`. Worth a follow-up.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Fix SchemaUtils to surface actual validation failure reason [pinot]

Posted by "Akanksha-kedia (via GitHub)" <gi...@apache.org>.
Akanksha-kedia commented on PR #18896:
URL: https://github.com/apache/pinot/pull/18896#issuecomment-4889228007

   Hi @Jackie-Jiang @xiangfu0 — this is a small targeted fix to `SchemaUtils.validate()` that surfaces the actual validation failure reason instead of a generic error message. All CI checks are green. Would love a review!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Fix SchemaUtils to surface actual validation failure reason [pinot]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #18896:
URL: https://github.com/apache/pinot/pull/18896#issuecomment-4850864802

   ## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/18896?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 56.99%. Comparing base ([`7fe517a`](https://app.codecov.io/gh/apache/pinot/commit/7fe517afce7bd1d892516f7cddcd7baff41278aa?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`200057c`](https://app.codecov.io/gh/apache/pinot/commit/200057cef512bbc7c876358b5d37e44861736761?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 299 commits behind head on master.
   > :exclamation:  There is a different number of reports uploaded between BASE (7fe517a) and HEAD (200057c). Click for more details.
   > 
   > <details><summary>HEAD has 16 uploads less than BASE</summary>
   >
   >| Flag | BASE (7fe517a) | HEAD (200057c) |
   >|------|------|------|
   >|java-21|5|1|
   >|unittests|2|1|
   >|temurin|5|1|
   >|unittests2|1|0|
   >|integration|3|0|
   >|integration1|1|0|
   >|custom-integration1|1|0|
   >|integration2|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #18896      +/-   ##
   ============================================
   - Coverage     63.68%   56.99%   -6.70%     
   + Complexity     1684        1    -1683     
   ============================================
     Files          3262     2604     -658     
     Lines        199826   152945   -46881     
     Branches      31031    24877    -6154     
   ============================================
   - Hits         127264    87166   -40098     
   + Misses        62414    58361    -4053     
   + Partials      10148     7418    -2730     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/pinot/pull/18896/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/18896/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration](https://app.codecov.io/gh/apache/pinot/pull/18896/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration1](https://app.codecov.io/gh/apache/pinot/pull/18896/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration2](https://app.codecov.io/gh/apache/pinot/pull/18896/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [java-21](https://app.codecov.io/gh/apache/pinot/pull/18896/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.99% <ø> (-6.70%)` | :arrow_down: |
   | [temurin](https://app.codecov.io/gh/apache/pinot/pull/18896/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.99% <ø> (-6.70%)` | :arrow_down: |
   | [unittests](https://app.codecov.io/gh/apache/pinot/pull/18896/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.99% <ø> (-6.70%)` | :arrow_down: |
   | [unittests1](https://app.codecov.io/gh/apache/pinot/pull/18896/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.99% <ø> (+1.23%)` | :arrow_up: |
   | [unittests2](https://app.codecov.io/gh/apache/pinot/pull/18896/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/pinot/pull/18896?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Fix SchemaUtils to surface actual validation failure reason [pinot]

Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 merged PR #18896:
URL: https://github.com/apache/pinot/pull/18896


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org