…h-project#5784)
* Stop Janino compile failures from returning the query plan
When generated Java failed to compile, the PPL response was a 500
carrying the query plan in its reason field, kilobytes of RelNode lines
on a real query. The one useful line, the compiler diagnostic, sat in
details where clients do not render it.
Calcite reports a codegen failure as SQLException with the plan as its
message. ErrorReport pinned its own message to that cause and had no
way to override it, and toJsonMap never emitted reason, so
ErrorMessage.getErrorAsJson back-filled reason from the cause message,
which was the plan a second time. enrichErrorsForSpecialCases also
copied the plan into context.plan.
The response layer now refuses to back-fill reason from a plan-bearing
cause message. StageErrorHandler recognises a codegen failure in the
cause chain, sets a generic reason and narrows details to the compiler
message. Both are needed, since the failure reaches the response two
ways and neither guard alone covers both. ErrorReport.Builder gains
the reason setter they rely on.
Detection is gated to the EXECUTING stage and the compile_exception
marker carries its separator, so a user-supplied identifier cannot be
read as an engine defect. On the plan-preparation branch details is
replaced and not skipped, since the builder already defaults it to
the same plan-bearing message.
Four unit tests in ErrorReportTest cover reason reaching toJsonMap,
surviving wrap, and staying first-write-wins. Fourteen query shapes
measured on a live single-node cluster before and after.
Resolves opensearch-project#5753
Signed-off-by: Chayanin Noramuttha <cnoramut@amazon.com>
* Null-check the planning error message before matching on it
Signed-off-by: Chayanin Noramuttha <cnoramut@amazon.com>
* Read a plan-stripped message on every response sink
Signed-off-by: Chayanin Noramuttha <cnoramut@amazon.com>
* Test the codegen sanitiser in StageErrorHandler
Signed-off-by: Chayanin Noramuttha <cnoramut@amazon.com>
* Test that response sinks publish curated error fields
Signed-off-by: Chayanin Noramuttha <cnoramut@amazon.com>
---------
Signed-off-by: Chayanin Noramuttha <cnoramut@amazon.com>
(cherry picked from commit 07f079d)
Signed-off-by: opensearch-ci-bot <opensearch-infra@amazon.com>
Backport 07f079d from #5784.