This is an automated email from the ASF dual-hosted git repository.
zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-go.git
The following commit(s) were added to refs/heads/main by this push:
new f2acefa7 fix: expose internal offsets in json/csv readers (#1342)
f2acefa7 is described below
commit f2acefa73f7eb63f487f499431184cef5f4f97f0
Author: Willem Jan <[email protected]>
AuthorDate: Tue Oct 13 13:29:21 2026 +0200
fix: expose internal offsets in json/csv readers (#1342)
### Rationale for this change
When decoding non-typesafe formats like CSV and JSON it is possible
decoding errors occur somewhere midstream. Without knowing the offset
decoding fails at, it can become very hard to troubleshoot what/where in
the data the problem is. For this I would like the Offset to be exposed
to aid in troubleshooting when such problems occur.
### What changes are included in this PR?
Expose internal InputOffset method directly in the CSV & JSON reader.
### Are these changes tested?
No additional tests added; simple 1 to 1 exposure of internal
InputOffset method.
### Are there any user-facing changes?
Adds public InputOffset method on CSV & JSON readers.
Co-authored-by: Willem Jan Noort <[email protected]>
---
arrow/array/json_reader.go | 4 ++++
arrow/csv/reader.go | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/arrow/array/json_reader.go b/arrow/array/json_reader.go
index 52938af0..6ca50af5 100644
--- a/arrow/array/json_reader.go
+++ b/arrow/array/json_reader.go
@@ -229,4 +229,8 @@ func (r *JSONReader) nextn() bool {
return n > 0
}
+func (r *JSONReader) InputOffset() int64 {
+ return r.r.InputOffset()
+}
+
var _ RecordReader = (*JSONReader)(nil)
diff --git a/arrow/csv/reader.go b/arrow/csv/reader.go
index 0ba1a038..555e7f24 100644
--- a/arrow/csv/reader.go
+++ b/arrow/csv/reader.go
@@ -1107,4 +1107,8 @@ func tryParse(val string, dt arrow.DataType) error {
panic("shouldn't end up here")
}
+func (r *Reader) InputOffset() int64 {
+ return r.r.InputOffset()
+}
+
var _ array.RecordReader = (*Reader)(nil)