fix(arrow/csv): write and read time32 columns #1706
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 288 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
Diff Size
diff_size
0.339
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1706"
general
weight: 0.35
ShivamSharma43
Rationale for this change
csv.NewInferringReaderinferstime32[s]for columns like12:34:56, butcsv.Writercan't write that type back. Writing the record it just read panics:csv.NewReaderhas a related gap: it rejects a schema with atime32field (field 0 (time) has invalid data type *arrow.Time32Type), even though the reader already parsestime32values when it infers the schema. So atime32column can't be written, and can only be read through inference.What changes are included in this PR?
time32values withTime32.FormattedString(unit). That givesHH:MM:SSfor seconds andHH:MM:SS.sssfor milliseconds, which is whatarrow.Time32FromString(used by the reader) parses.readTypeSupportedacceptstime32, soNewReadertakes a schema with atime32field. The reader already has atime32parser, so this just stops validation from rejecting the type.time64,durationanddecimal32/decimal64are left out. The reader doesn't parse them either, so there is no matching format to round-trip.Are these changes tested?
Yes.
TestCSVWriterReaderTime32RoundTripwritestime32[s]andtime32[ms]columns with a null, checks the CSV output, and reads it back withNewReaderusing the same schema.TestCSVWriterWritesInferredTime32reads a CSV file withNewInferringReader, checks that the column is inferred astime32[s], and checks that writing it gives back the same text.Both tests use a checked allocator. Without the writer change both panic with the error above. Without the
readTypeSupportedchange the round-trip test panics inNewReader.On Windows amd64 with Go 1.26.11,
go test -tags assert,test ./arrow/csv/ -run '^Test'passes,go vetis clean, andgolangci-lintreports no new issues.Example_readerneeds thearrow-testingsubmodule, which isn't checked out locally, so it was skipped. It fails the same way on main.Are there any user-facing changes?
No API changes.
csv.Writercan now writetime32columns, andcsv.NewReaderaccepts schemas withtime32fields.This PR was prepared with AI assistance (Claude Code).
🤖 Generated with Claude Code