public interface CatalogDiagnosticSink
CatalogDiagnostics emitted by readers, providers, validators,
and the runtime.
Plan §7.3. collecting(List) is the default sink for tests and embedding;
toParser(TGSqlParser) is the parser-side opt-in surfacing path landed in P1E
(T1E.1) — WARN/ERROR diagnostics become EErrorType.spwarningdbobject entries
on TGSqlParser.getSyntaxErrors().
| Modifier and Type | Method and Description |
|---|---|
void |
accept(CatalogDiagnostic diag) |
static CatalogDiagnosticSink |
collecting(List<CatalogDiagnostic> sink)
Sink that appends every accepted diagnostic into the supplied list.
|
static CatalogDiagnosticSink |
discarding()
Discards every diagnostic.
|
static CatalogDiagnosticSink |
toParser(TGSqlParser parser)
Surface WARN and ERROR diagnostics as
EErrorType.spwarningdbobject
entries on TGSqlParser.getSyntaxErrors(). |
void accept(CatalogDiagnostic diag)
static CatalogDiagnosticSink collecting(List<CatalogDiagnostic> sink)
static CatalogDiagnosticSink discarding()
static CatalogDiagnosticSink toParser(TGSqlParser parser)
EErrorType.spwarningdbobject
entries on TGSqlParser.getSyntaxErrors(). INFO diagnostics are dropped:
the parser-side warning channel is for actionable items, and the design plan §15
pairs the spwarningdbobject category with WARN/ERROR specifically.
Opt-in. Default-mode parsing (no sink attached anywhere) keeps
getSyntaxErrors() byte-identical to today — this method only takes effect
when the caller wires the returned sink into
CatalogLoadOptions.Builder.diagnosticSink.
The supplied parser's syntaxErrors list is mutated in place. Each WARN
gets a TSyntaxError whose tokentext carries the qualified-name's
last segment (or "<catalog>" when the diagnostic has no name attached) and
whose hint is "<code>: <message>". lineNo/columnNo
default to 0 (catalog diagnostics do not yet carry source positions; that is a P3
follow-up); errorno is 0 (the spwarningdbobject type is the
discriminator); posInList is -1; sqlStatement is null.
Parse-return-code interaction. TGSqlParser.parse() returns
getErrorCount(), which is the size of syntaxErrors. With this sink
attached, a WARN catalog diagnostic emitted during parse() contributes to
that count even when the SQL itself is syntactically valid — that is the explicit
contract of opting into surfacing. Callers who need a 0-return for
syntactically-valid SQL should not attach this sink, or should iterate
getSyntaxErrors() and filter on EErrorType.spwarningdbobject.
A null parser argument is rejected — this sink is meaningless without a parser to write into.