[Enhancement] Reject unsupported output formats on the analytics-engine route with a 4xx#5570
Merged
RyanL1997 merged 2 commits intoJun 19, 2026
Conversation
…a 4xx
The analytics-engine (Calcite/DataFusion) route formats every response with
SimpleJsonResponseFormatter and does not implement the alternate response
formats (csv/raw/viz) supported by the classic SQL/PPL engines. A request such
as `format=csv` against an analytics index was silently answered with JSON:
the client asked for one content type and received another, with no signal that
the parameter was dropped.
This adds an up-front guard on the analytics route that rejects an unsupported
output format with a structured ErrorReport coded UNSUPPORTED_OPERATION, so the
client gets a clean 4xx with an actionable message instead of silent JSON.
JSON/JDBC (the default) is unaffected.
Changes:
- New AnalyticsEngineFormatSupport.validateFormat(Format): accepts JDBC (the
JSON contract the route emits); throws an ErrorReport(UNSUPPORTED_OPERATION,
ANALYZING) with a suggestion for csv/raw/viz.
- Wire the guard into both analytics entry points:
* SQLPlugin#createSqlAnalyticsRouter (SQL `_sql` route)
* TransportPPLQueryAction#doExecute (PPL `_ppl` route)
The thrown ErrorReport flows through the existing REST error handling
(RestSqlAction/RestPPLQueryAction), which classifies its IllegalArgumentException
cause as a client error -> 400.
Tests:
- AnalyticsEngineFormatSupportTest: JDBC accepted; csv/raw/viz rejected with
UNSUPPORTED_OPERATION, a message naming the format + "analytics engine",
and a suggestion.
Signed-off-by: Jialiang Liang <jiallian@amazon.com>
Signed-off-by: Jialiang Liang <jiallian@amazon.com>
dai-chen
approved these changes
Jun 19, 2026
ahkcs
approved these changes
Jun 19, 2026
Collaborator
|
As follow-up, later we can consider either move this into |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The analytics-engine (Calcite/DataFusion) route formats every response with
SimpleJsonResponseFormatterand does not implement the alternate response formats (csv/raw/viz) that the classic SQL/PPL engines support. A request such asformat=csvagainst an analytics index was silently answered with JSON: the client asked for one content type and received another, with no signal that the parameter was dropped.This PR adds an up-front guard on the analytics route that rejects an unsupported output format with a structured
ErrorReportcodedUNSUPPORTED_OPERATION, so the client gets a clean 4xx with an actionable message instead of silent JSON. JSON/JDBC (the default) is unaffected.Changes
AnalyticsEngineFormatSupport.validateFormat(Format): acceptsJDBC(the JSON contract the route emits); throws anErrorReport(UNSUPPORTED_OPERATION, ANALYZING)with a suggestion forcsv/raw/viz.SQLPlugin#createSqlAnalyticsRouter(SQL_sqlroute)TransportPPLQueryAction#doExecute(PPL_pplroute)ErrorReportflows through the existing REST error handling (RestSqlAction/RestPPLQueryAction), which classifies itsIllegalArgumentExceptioncause as a client error → 400.Related Issues
N/A
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.