← Back to Pull requests

fix(arrow/flight): skip metadata-only messages in the record reader #1549

Open
unknown opened this pull request with 262 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 13, 2026 07:22 UTC
Author

Rationale for this change

Writer.WriteMetadata sends a FlightData message that has app_metadata but no IPC header or body. NewRecordReader dropped the first such message while peeking for a descriptor, but the message adapter passed any later one to ipc.NewMessage. The empty header then reached the flatbuffers decoder, and reading failed with:

arrow/flight: could not create flight reader: arrow/ipc: unknown error while reading: runtime error: index out of range [3] with length 0

So two heartbeats before the schema broke the stream (see #1517). A single metadata-only message between two record batches failed the same way, because Next() hit the same decode error.

What changes are included in this PR?

dataMessageReader.Message() now skips messages that have neither a DataHeader nor a DataBody. It still records any FlightDescriptor they carry. Messages with a header, or with a body and no header, follow the same path as before. LatestAppMetadata() still returns the metadata attached to the record batch that was read, not the metadata of a skipped heartbeat.

Are these changes tested?

Yes. TestReaderSkipsMetadataOnlyMessages writes three WriteMetadata messages before the schema and one after each record batch (including after the last one). It then checks that every batch reads back equal, with its own WriteWithAppMetadata value, and that the stream ends cleanly. The test fails on main with the error above and passes with this change. collectingFlightStreamWriter now copies AppMetadata too, so the test can check it.

go test ./arrow/flight/... passes, with and without -tags assert,test -short. go vet ./arrow/flight/... and gofmt are clean.

Are there any user-facing changes?

Readers no longer fail on streams that contain standalone metadata messages. The record-oriented reader skips those messages.

Fixes #1517

AI assistance: I used Claude Code (Anthropic) to write this change and the test. I reviewed the code and ran the tests locally.

🤖 Generated with Claude Code

Diff: 262 lines (+196 / -66) across 3 files Reviewer: ShivamSharma43 Review duration: 13759m
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 262 lines diff across 3 files
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth shallow_review_depth
0.344
Diff Size diff_size
0.333
Real PR Conversation Timeline
1 comments
"Review active on #1549"
general weight: 0.35
Assignees
Unassigned
Labels
risk: low confidence: 46.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.3% (MEDIUM) · Higher = larger blast radius
39.3%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 46.7% · Lower = rushed or shallow review
46.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 20.9% · Safe to merge
20.9%