Expand description
minimal FlightSQL protocol implementation
Structs§
- Flight
SqlService Impl - Implementation of the Flight SQL service.
Constants§
- MAX_
PLAN_ CHARS - Cap on the physical-plan text appended to the server-side log line. The
plan can render arbitrarily long
file_groups=sections for wide scans, and this text is server-log-only, never returned to the client.
Functions§
- build_
denial_ warn_ line - Builds the
warn!line for a query-deny-list denial: the rule id, its reason, the query’s normalized fingerprint, the caller’s identity/client attribution, and thequery_id.pubso a test can assert its content directly, the same waybuild_log_line’s content is asserted, rather than by capturing log output. - build_
log_ line - Builds the full server-side log line for a classified
DataFusionError:desc, the error’s ownDisplay(its outerContextchain intact, with backtrace if enabled – unlikefind_root(), which is for classification only), thequery_id, and – when there’s no diagnostic span to show the caller instead – the truncated physical plan text.pubso tests can assert its content, including the truncation marker, without capturing log output. - classify_
datafusion_ error - Classifies the root cause of a
DataFusionErrorinto the gRPC status code that best distinguishes “the caller’s SQL/input was bad” from “the server broke”:Execution/Configurationland underInvalidArgumentsince they signal bad input, whileArrowErrorstaysInternalsince it reflects a real server-side decode failure. - classify_
flight_ error - Recovers the
DataFusionErrorfrom the per-batchFlightErrorre-wrap (FlightError::ExternalError(Box::new(e)), applied once the rawDataFusionErrorstream is wrapped for Arrow Flight) and classifies it viaclient_error. Every branch logs exactly once before returning, so this is a single, unconditional log point for the per-batch stream-error site regardless of which branch is taken.pubso step 9’s external integration tests can exercise this recovery path directly. - client_
error - Classifies
err, builds the client-facingStatus–desc+ root-error text (backtrace stripped) + an optional diagnostic span/notes/helps +query_id– and logs the full error server-side. The physical plan, when present and there’s no diagnostic span to show instead, only ever reaches the server log, never the returnedStatus:displayablecan render object-store partition paths from Micromegas view scans, which would leak internal lakehouse details to every caller hitting an execution-time error. - error_
class - Maps a gRPC status code to the
QueryAuditRecord.error_classbucket used both by the audit log and to gate thequery_failed/query_duration_with_errormetrics. This is the derived mapping used for everyDataFusionError-rooted failure; the query-deny-list check stamps a fourth value,"denied", directly viaQueryAuditState::fail_with_classrather than through this function, since a denial’sResourceExhaustedcode would otherwise land in the"resource"bucket alongside a genuine resource-budget failure.