public final class AnalysisResult extends Object
SqlSemanticAnalyzer.analyze(java.lang.String, gudusoft.gsqlparser.EDbVendor) call. Carries the
built SemanticProgram, the JSON-encoded form, and the list
of Diagnostics emitted during analysis.
API status: supported read-only result. Public getters and
isSuccessful() are part of Join Analysis Consumption Profile v1.
Callers must test success before dereferencing getProgram() or
getJson() and should inspect diagnostics on successful results too.
A successful analysis produces a non-null program and JSON with
an empty (or warning-only) diagnostics list. A failed analysis
produces a null program / JSON and at least one
ERROR-severity diagnostic.
This type is immutable and thread-safe. Consumers should
pattern-match on Diagnostic.getCode() (the
DiagnosticCode enum is the stable contract) rather than
parsing message text.
| Modifier and Type | Method and Description |
|---|---|
List<Diagnostic> |
getDiagnostics()
Diagnostics emitted during analysis.
|
Diagnostic |
getFirstError() |
String |
getJson() |
SemanticProgram |
getProgram() |
String |
getSchemaVersion()
JSON schema version selected for this result's payload.
|
String |
getStatementText()
The verbatim source slice of the analyzed top-level statement
(slice 178, R3).
|
boolean |
isSuccessful() |
public boolean isSuccessful()
true iff a non-null program was built AND no
ERROR-severity diagnostics are
present.public String getSchemaVersion()
schemaVersion in
getJson(); rejected results without JSON carry the analyzer's
baseline version.public SemanticProgram getProgram()
null when analysis
failed. Use isSuccessful() as the discriminator.public String getJson()
getProgram(), or
null when analysis failed.public List<Diagnostic> getDiagnostics()
null; may be empty.public String getStatementText()
SqlSemanticAnalyzer.analyze(java.lang.String, gudusoft.gsqlparser.EDbVendor) and
SqlSemanticAnalyzer.analyzeAll(java.lang.String, gudusoft.gsqlparser.EDbVendor) once the statement is located;
null for parse-level rejections before a statement exists.
Lets multi-statement consumers reproduce the exact text of one
statement without re-parsing or slicing the parse tree themselves.public Diagnostic getFirstError()
ERROR-severity
diagnostic, or null when none were emitted.