Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions go/arrow/array/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

"github.com/apache/arrow/go/arrow"
"github.com/apache/arrow/go/arrow/float16"
"github.com/pkg/errors"
"golang.org/x/xerrors"
)

// RecordEqual reports whether the two provided records are equal.
Expand Down Expand Up @@ -166,7 +166,7 @@ func ArrayEqual(left, right Interface) bool {
return arrayEqualDuration(l, r)

default:
panic(errors.Errorf("arrow/array: unknown array type %T", l))
panic(xerrors.Errorf("arrow/array: unknown array type %T", l))
}
}

Expand Down Expand Up @@ -355,7 +355,7 @@ func arrayApproxEqual(left, right Interface, opt equalOption) bool {
return arrayEqualDuration(l, r)

default:
panic(errors.Errorf("arrow/array: unknown array type %T", l))
panic(xerrors.Errorf("arrow/array: unknown array type %T", l))
}

return false
Expand Down
4 changes: 2 additions & 2 deletions go/arrow/array/interval.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/apache/arrow/go/arrow/bitutil"
"github.com/apache/arrow/go/arrow/internal/debug"
"github.com/apache/arrow/go/arrow/memory"
"github.com/pkg/errors"
"golang.org/x/xerrors"
)

func NewIntervalData(data *Data) Interface {
Expand All @@ -35,7 +35,7 @@ func NewIntervalData(data *Data) Interface {
case *arrow.DayTimeIntervalType:
return NewDayTimeIntervalData(data)
default:
panic(errors.Errorf("arrow/array: unknown interval data type %T", data.dtype))
panic(xerrors.Errorf("arrow/array: unknown interval data type %T", data.dtype))
}
}

Expand Down
4 changes: 2 additions & 2 deletions go/arrow/csv/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/apache/arrow/go/arrow/array"
"github.com/apache/arrow/go/arrow/internal/debug"
"github.com/apache/arrow/go/arrow/memory"
"github.com/pkg/errors"
"golang.org/x/xerrors"
)

// Reader wraps encoding/csv.Reader and creates array.Records from a schema.
Expand Down Expand Up @@ -105,7 +105,7 @@ func NewReader(r io.Reader, schema *arrow.Schema, opts ...Option) *Reader {
func (r *Reader) readHeader() error {
records, err := r.r.Read()
if err != nil {
return errors.Wrapf(err, "arrow/csv: could not read header from file")
return xerrors.Errorf("arrow/csv: could not read header from file: %w", err)
}

if len(records) != len(r.schema.Fields()) {
Expand Down
2 changes: 1 addition & 1 deletion go/arrow/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ go 1.12
require (
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/google/flatbuffers v1.11.0
github.com/pkg/errors v0.8.1
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.2.0
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
)
4 changes: 2 additions & 2 deletions go/arrow/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/flatbuffers v1.11.0 h1:O7CEyB8Cb3/DmtxODGtLHcEvpr81Jm5qLg/hsHnxA2A=
github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.2.0 h1:LThGCOvhuJic9Gyd1VBCkhyUXmO8vKaBFvBsJ2k03rg=
github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
22 changes: 11 additions & 11 deletions go/arrow/internal/arrjson/arrjson.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/apache/arrow/go/arrow/array"
"github.com/apache/arrow/go/arrow/float16"
"github.com/apache/arrow/go/arrow/memory"
"github.com/pkg/errors"
"golang.org/x/xerrors"
)

const (
Expand Down Expand Up @@ -152,7 +152,7 @@ func dtypeToJSON(dt arrow.DataType) dataType {
ByteWidth: dt.ByteWidth,
}
}
panic(errors.Errorf("unknown arrow.DataType %v", dt))
panic(xerrors.Errorf("unknown arrow.DataType %v", dt))
}

func dtypeFromJSON(dt dataType, children []Field) arrow.DataType {
Expand Down Expand Up @@ -261,7 +261,7 @@ func dtypeFromJSON(dt dataType, children []Field) arrow.DataType {
return arrow.FixedWidthTypes.Duration_ns
}
}
panic(errors.Errorf("unknown DataType %#v", dt))
panic(xerrors.Errorf("unknown DataType %#v", dt))
}

func schemaToJSON(schema *arrow.Schema) Schema {
Expand Down Expand Up @@ -541,7 +541,7 @@ func arrayFromJSON(mem memory.Allocator, dt arrow.DataType, arr Array) array.Int
data := make([][]byte, len(strdata))
for i, v := range strdata {
if len(v) != 2*dt.ByteWidth {
panic(errors.Errorf("arrjson: invalid hex-string length (got=%d, want=%d)", len(v), 2*dt.ByteWidth))
panic(xerrors.Errorf("arrjson: invalid hex-string length (got=%d, want=%d)", len(v), 2*dt.ByteWidth))
}
vv, err := hex.DecodeString(v)
if err != nil {
Expand Down Expand Up @@ -618,7 +618,7 @@ func arrayFromJSON(mem memory.Allocator, dt arrow.DataType, arr Array) array.Int
return bldr.NewArray()

default:
panic(errors.Errorf("unknown data type %v %T", dt, dt))
panic(xerrors.Errorf("unknown data type %v %T", dt, dt))
}
panic("impossible")
}
Expand Down Expand Up @@ -791,7 +791,7 @@ func arrayToJSON(field arrow.Field, arr array.Interface) Array {
for i := range o.Data {
v := []byte(strings.ToUpper(hex.EncodeToString(arr.Value(i))))
if len(v) != 2*dt.ByteWidth {
panic(errors.Errorf("arrjson: invalid hex-string length (got=%d, want=%d)", len(v), 2*dt.ByteWidth))
panic(xerrors.Errorf("arrjson: invalid hex-string length (got=%d, want=%d)", len(v), 2*dt.ByteWidth))
}
o.Data[i] = string(v) // re-convert as string to prevent json.Marshal from base64-encoding it.
}
Expand Down Expand Up @@ -859,7 +859,7 @@ func arrayToJSON(field arrow.Field, arr array.Interface) Array {
}

default:
panic(errors.Errorf("unknown array type %T", arr))
panic(xerrors.Errorf("unknown array type %T", arr))
}
panic("impossible")
}
Expand Down Expand Up @@ -1129,7 +1129,7 @@ func strFromJSON(vs []interface{}) []string {
case json.Number:
o[i] = v.String()
default:
panic(errors.Errorf("could not convert %v (%T) to a string", v, v))
panic(xerrors.Errorf("could not convert %v (%T) to a string", v, v))
}
}
return o
Expand All @@ -1153,10 +1153,10 @@ func bytesFromJSON(vs []interface{}) [][]byte {
case json.Number:
o[i], err = hex.DecodeString(v.String())
default:
panic(errors.Errorf("could not convert %v (%T) to a string", v, v))
panic(xerrors.Errorf("could not convert %v (%T) to a string", v, v))
}
if err != nil {
panic(errors.Errorf("could not decode %v: %v", v, err))
panic(xerrors.Errorf("could not decode %v: %v", v, err))
}
}
return o
Expand Down Expand Up @@ -1340,7 +1340,7 @@ func buildArray(bldr array.Builder, data array.Interface) {

switch bldr := bldr.(type) {
default:
panic(errors.Errorf("unknown builder %T", bldr))
panic(xerrors.Errorf("unknown builder %T", bldr))

case *array.BooleanBuilder:
data := data.(*array.Boolean)
Expand Down
8 changes: 4 additions & 4 deletions go/arrow/ipc/cmd/arrow-cat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import (

"github.com/apache/arrow/go/arrow/ipc"
"github.com/apache/arrow/go/arrow/memory"
"github.com/pkg/errors"
"golang.org/x/xerrors"
)

func main() {
Expand All @@ -90,7 +90,7 @@ func processStream(w io.Writer, rin io.Reader) error {
for {
r, err := ipc.NewReader(rin, ipc.WithAllocator(mem))
if err != nil {
if errors.Cause(err) == io.EOF {
if xerrors.Is(err, io.EOF) {
return nil
}
return err
Expand Down Expand Up @@ -131,7 +131,7 @@ func processFile(w io.Writer, fname string) error {
hdr := make([]byte, len(ipc.Magic))
_, err = io.ReadFull(f, hdr)
if err != nil {
return errors.Errorf("could not read file header: %v", err)
return xerrors.Errorf("could not read file header: %w", err)
}
f.Seek(0, io.SeekStart)

Expand All @@ -144,7 +144,7 @@ func processFile(w io.Writer, fname string) error {

r, err := ipc.NewFileReader(f, ipc.WithAllocator(mem))
if err != nil {
if errors.Cause(err) == io.EOF {
if xerrors.Is(err, io.EOF) {
return nil
}
return err
Expand Down
10 changes: 5 additions & 5 deletions go/arrow/ipc/cmd/arrow-file-to-stream/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/apache/arrow/go/arrow/arrio"
"github.com/apache/arrow/go/arrow/ipc"
"github.com/apache/arrow/go/arrow/memory"
"github.com/pkg/errors"
"golang.org/x/xerrors"
)

func main() {
Expand Down Expand Up @@ -56,7 +56,7 @@ func processFile(w io.Writer, fname string) error {

rr, err := ipc.NewFileReader(r, ipc.WithAllocator(mem))
if err != nil {
if errors.Cause(err) == io.EOF {
if xerrors.Is(err, io.EOF) {
return nil
}
return err
Expand All @@ -68,15 +68,15 @@ func processFile(w io.Writer, fname string) error {

n, err := arrio.Copy(ww, rr)
if err != nil {
return errors.Wrap(err, "could not copy ARROW stream")
return xerrors.Errorf("could not copy ARROW stream: %w", err)
}
if got, want := n, int64(rr.NumRecords()); got != want {
return errors.Errorf("invalid number of records written (got=%d, want=%d)", got, want)
return xerrors.Errorf("invalid number of records written (got=%d, want=%d)", got, want)
}

err = ww.Close()
if err != nil {
return errors.Wrap(err, "could not close output ARROW stream")
return xerrors.Errorf("could not close output ARROW stream: %w", err)
}

return nil
Expand Down
Loading