ShivamSharma43 opened a new pull request, #1706: URL: https://github.com/apache/arrow-go/pull/1706
### Rationale for this change `csv.NewInferringReader` infers `time32[s]` for columns like `12:34:56`, but `csv.Writer` can't write that type back. Writing the record it just read panics: ``` panic: arrow/csv: field has unsupported data type time32[s] ``` `csv.NewReader` has a related gap: it rejects a schema with a `time32` field (`field 0 (time) has invalid data type *arrow.Time32Type`), even though the reader already parses `time32` values when it infers the schema. So a `time32` column can't be written, and can only be read through inference. ### What changes are included in this PR? - The writer formats `time32` values with `Time32.FormattedString(unit)`. That gives `HH:MM:SS` for seconds and `HH:MM:SS.sss` for milliseconds, which is what `arrow.Time32FromString` (used by the reader) parses. - `readTypeSupported` accepts `time32`, so `NewReader` takes a schema with a `time32` field. The reader already has a `time32` parser, so this just stops validation from rejecting the type. `time64`, `duration` and `decimal32`/`decimal64` are left out. The reader doesn't parse them either, so there is no matching format to round-trip. ### Are these changes tested? Yes. - `TestCSVWriterReaderTime32RoundTrip` writes `time32[s]` and `time32[ms]` columns with a null, checks the CSV output, and reads it back with `NewReader` using the same schema. - `TestCSVWriterWritesInferredTime32` reads a CSV file with `NewInferringReader`, checks that the column is inferred as `time32[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 `readTypeSupported` change the round-trip test panics in `NewReader`. On Windows amd64 with Go 1.26.11, `go test -tags assert,test ./arrow/csv/ -run '^Test'` passes, `go vet` is clean, and `golangci-lint` reports no new issues. `Example_reader` needs the `arrow-testing` submodule, 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.Writer` can now write `time32` columns, and `csv.NewReader` accepts schemas with `time32` fields. This PR was prepared with AI assistance (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
