Skip to content

Commit

Permalink
ARROW-5585: [Go] Rename TypeEquals to TypeEqual
Browse files Browse the repository at this point in the history
via
find . -type f -exec sed -i "s/TypeEquals/TypeEqual/g" {} \;

Closes #6746 from palmerlao/arrow-5585

Authored-by: Palmer Lao <palmer.lao@gmail.com>
Signed-off-by: Sebastien Binet <binet@cern.ch>
  • Loading branch information
palmerlao authored and sbinet committed Apr 2, 2020
1 parent db81f0a commit d8243f8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go/arrow/array/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func baseArrayEqual(left, right Interface) bool {
return false
case left.NullN() != right.NullN():
return false
case !arrow.TypeEquals(left.DataType(), right.DataType()): // We do not check for metadata as in the C++ implementation.
case !arrow.TypeEqual(left.DataType(), right.DataType()): // We do not check for metadata as in the C++ implementation.
return false
case !validityBitmapEqual(left, right):
return false
Expand Down
2 changes: 1 addition & 1 deletion go/arrow/array/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (rec *simpleRecord) validate() error {
arr.Len(), rec.rows,
)
}
if !arrow.TypeEquals(f.Type, arr.DataType()) {
if !arrow.TypeEqual(f.Type, arr.DataType()) {
return fmt.Errorf("arrow/array: column %q type mismatch: got=%v, want=%v",
f.Name,
arr.DataType(), f.Type,
Expand Down
4 changes: 2 additions & 2 deletions go/arrow/array/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func NewColumn(field arrow.Field, chunks *Chunked) *Column {
}
col.data.Retain()

if !arrow.TypeEquals(col.data.DataType(), col.field.Type) {
if !arrow.TypeEqual(col.data.DataType(), col.field.Type) {
col.data.Release()
panic("arrow/array: inconsistent data type")
}
Expand Down Expand Up @@ -117,7 +117,7 @@ func NewChunked(dtype arrow.DataType, chunks []Interface) *Chunked {
dtype: dtype,
}
for i, chunk := range chunks {
if !arrow.TypeEquals(chunk.DataType(), dtype) {
if !arrow.TypeEqual(chunk.DataType(), dtype) {
panic("arrow/array: mismatch data type")
}
chunk.Retain()
Expand Down
14 changes: 7 additions & 7 deletions go/arrow/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ type typeEqualsConfig struct {
metadata bool
}

// TypeEqualsOption is a functional option type used for configuring type
// TypeEqualOption is a functional option type used for configuring type
// equality checks.
type TypeEqualsOption func(*typeEqualsConfig)
type TypeEqualOption func(*typeEqualsConfig)

// CheckMetadata is an option for TypeEquals that allows checking for metadata
// CheckMetadata is an option for TypeEqual that allows checking for metadata
// equality besides type equality. It only makes sense for STRUCT type.
func CheckMetadata() TypeEqualsOption {
func CheckMetadata() TypeEqualOption {
return func(cfg *typeEqualsConfig) {
cfg.metadata = true
}
}

// TypeEquals checks if two DataType are the same, optionally checking metadata
// TypeEqual checks if two DataType are the same, optionally checking metadata
// equality for STRUCT types.
func TypeEquals(left, right DataType, opts ...TypeEqualsOption) bool {
func TypeEqual(left, right DataType, opts ...TypeEqualOption) bool {
var cfg typeEqualsConfig
for _, opt := range opts {
opt(&cfg)
Expand Down Expand Up @@ -71,7 +71,7 @@ func TypeEquals(left, right DataType, opts ...TypeEqualsOption) bool {
return false
case leftField.Nullable != rightField.Nullable:
return false
case !TypeEquals(leftField.Type, rightField.Type, opts...):
case !TypeEqual(leftField.Type, rightField.Type, opts...):
return false
}
}
Expand Down
8 changes: 4 additions & 4 deletions go/arrow/compare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"testing"
)

func TestTypeEquals(t *testing.T) {
func TestTypeEqual(t *testing.T) {
tests := []struct {
left, right DataType
want bool
Expand Down Expand Up @@ -240,12 +240,12 @@ func TestTypeEquals(t *testing.T) {
t.Run("", func(t *testing.T) {
var got bool
if test.checkMetadata {
got = TypeEquals(test.left, test.right, CheckMetadata())
got = TypeEqual(test.left, test.right, CheckMetadata())
} else {
got = TypeEquals(test.left, test.right)
got = TypeEqual(test.left, test.right)
}
if got != test.want {
t.Fatalf("TypeEquals(%v, %v, %v): got=%v, want=%v", test.left, test.right, test.checkMetadata, got, test.want)
t.Fatalf("TypeEqual(%v, %v, %v): got=%v, want=%v", test.left, test.right, test.checkMetadata, got, test.want)
}
})
}
Expand Down

0 comments on commit d8243f8

Please sign in to comment.