This is an automated email from the ASF dual-hosted git repository.
zeroshade pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 1dba9fb79e ARROW-16450: [Go][Docs] Include error handling in csv
examples
1dba9fb79e is described below
commit 1dba9fb79eb7800556e387a1cf4851912ce7d724
Author: Mark Wolfe <[email protected]>
AuthorDate: Thu May 5 09:57:51 2022 -0400
ARROW-16450: [Go][Docs] Include error handling in csv examples
As per the tests I have added checks in the examples as this tripped me up
while dealing with nulls in my CSVs.
Closes #13059 from wolfeidau/arrow-16450-csv-example-godoc
Authored-by: Mark Wolfe <[email protected]>
Signed-off-by: Matthew Topol <[email protected]>
---
go/arrow/csv/reader_test.go | 8 ++++++++
go/arrow/csv/writer_test.go | 7 +++++++
2 files changed, 15 insertions(+)
diff --git a/go/arrow/csv/reader_test.go b/go/arrow/csv/reader_test.go
index 5da2ef1295..36e66c50bf 100644
--- a/go/arrow/csv/reader_test.go
+++ b/go/arrow/csv/reader_test.go
@@ -20,6 +20,7 @@ import (
"bytes"
"fmt"
"io/ioutil"
+ "log"
"testing"
"github.com/apache/arrow/go/v8/arrow"
@@ -61,6 +62,13 @@ func Example() {
n++
}
+ // check for reader errors indicating issues converting csv values
+ // to the arrow schema types
+ err := r.Err()
+ if err != nil {
+ log.Fatal(err)
+ }
+
// Output:
// rec[0]["i64"]: [0]
// rec[0]["f64"]: [0]
diff --git a/go/arrow/csv/writer_test.go b/go/arrow/csv/writer_test.go
index 0890846d29..aba133d47a 100644
--- a/go/arrow/csv/writer_test.go
+++ b/go/arrow/csv/writer_test.go
@@ -81,6 +81,13 @@ func Example_writer() {
n++
}
+ // check for reader errors indicating issues converting csv values
+ // to the arrow schema types
+ err = r.Err()
+ if err != nil {
+ log.Fatal(err)
+ }
+
// Output:
// rec[0]["i64"]: [0]
// rec[0]["f64"]: [0]