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 679d97b refactor: switch golang.org/x/exp to standard library
packages (#453)
679d97b is described below
commit 679d97b05d9aa2279cbe56a4ef5cfa94aa657db8
Author: Chromo-residuum-opec <[email protected]>
AuthorDate: Mon Jul 28 11:30:26 2025 -0700
refactor: switch golang.org/x/exp to standard library packages (#453)
### Rationale for this change
This change migrates several of usages of `golang.org/x/exp` packages to
use the standard library equivalents that have been introduced into
newer go versions.
### What changes are included in this PR?
This change is a single commit
*
https://github.com/apache/arrow-go/pull/453/commits/c87ae85327ab287608ba29af1816555ca87537b8
behavior-wise, this is intended to be a noop
### Are these changes tested?
Tested with `go test ./...`. I get the exact same behavior (including
some failures) as on master.
### Are there any user-facing changes?
n/a
---
arrow/compute/exec/kernel.go | 2 +-
arrow/compute/exec/utils.go | 8 ++++----
arrow/compute/registry.go | 6 +++---
arrow/compute/registry_test.go | 2 +-
arrow/flight/cookie_middleware.go | 2 +-
internal/utils/math.go | 5 +++--
6 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/arrow/compute/exec/kernel.go b/arrow/compute/exec/kernel.go
index fd3a52d..281f55e 100644
--- a/arrow/compute/exec/kernel.go
+++ b/arrow/compute/exec/kernel.go
@@ -22,13 +22,13 @@ import (
"context"
"fmt"
"hash/maphash"
+ "slices"
"strings"
"github.com/apache/arrow-go/v18/arrow"
"github.com/apache/arrow-go/v18/arrow/bitutil"
"github.com/apache/arrow-go/v18/arrow/internal/debug"
"github.com/apache/arrow-go/v18/arrow/memory"
- "golang.org/x/exp/slices"
)
var hashSeed = maphash.MakeSeed()
diff --git a/arrow/compute/exec/utils.go b/arrow/compute/exec/utils.go
index 58c4c0c..992a6c3 100644
--- a/arrow/compute/exec/utils.go
+++ b/arrow/compute/exec/utils.go
@@ -19,8 +19,10 @@
package exec
import (
+ "cmp"
"fmt"
"math"
+ "slices"
"sync/atomic"
"unsafe"
@@ -28,8 +30,6 @@ import (
"github.com/apache/arrow-go/v18/arrow/array"
"github.com/apache/arrow-go/v18/arrow/bitutil"
"github.com/apache/arrow-go/v18/arrow/memory"
- "golang.org/x/exp/constraints"
- "golang.org/x/exp/slices"
)
// GetSpanValues returns a properly typed slice by reinterpreting
@@ -51,14 +51,14 @@ func GetSpanOffsets[T int32 | int64](span *ArraySpan, i
int) []T {
return ret[span.Offset:]
}
-func Min[T constraints.Ordered](a, b T) T {
+func Min[T cmp.Ordered](a, b T) T {
if a < b {
return a
}
return b
}
-func Max[T constraints.Ordered](a, b T) T {
+func Max[T cmp.Ordered](a, b T) T {
if a > b {
return a
}
diff --git a/arrow/compute/registry.go b/arrow/compute/registry.go
index 6b9250c..44542ab 100644
--- a/arrow/compute/registry.go
+++ b/arrow/compute/registry.go
@@ -19,11 +19,11 @@
package compute
import (
+ "maps"
+ "slices"
"sync"
"github.com/apache/arrow-go/v18/arrow/internal/debug"
- "golang.org/x/exp/maps"
- "golang.org/x/exp/slices"
)
type FunctionRegistry interface {
@@ -138,7 +138,7 @@ func (reg *funcRegistry) GetFunctionNames() (out []string) {
reg.mx.RLock()
defer reg.mx.RUnlock()
- out = append(out, maps.Keys(reg.nameToFunction)...)
+ out = append(out, slices.Collect(maps.Keys(reg.nameToFunction))...)
slices.Sort(out)
return
}
diff --git a/arrow/compute/registry_test.go b/arrow/compute/registry_test.go
index 8383fb5..dcde9b4 100644
--- a/arrow/compute/registry_test.go
+++ b/arrow/compute/registry_test.go
@@ -21,13 +21,13 @@ package compute_test
import (
"context"
"errors"
+ "slices"
"testing"
"github.com/apache/arrow-go/v18/arrow"
"github.com/apache/arrow-go/v18/arrow/compute"
"github.com/apache/arrow-go/v18/arrow/compute/exec"
"github.com/stretchr/testify/assert"
- "golang.org/x/exp/slices"
)
var registry compute.FunctionRegistry
diff --git a/arrow/flight/cookie_middleware.go
b/arrow/flight/cookie_middleware.go
index 39c86d8..bd63b0a 100644
--- a/arrow/flight/cookie_middleware.go
+++ b/arrow/flight/cookie_middleware.go
@@ -18,12 +18,12 @@ package flight
import (
"context"
+ "maps"
"net/http"
"strings"
"sync"
"time"
- "golang.org/x/exp/maps"
"google.golang.org/grpc/metadata"
)
diff --git a/internal/utils/math.go b/internal/utils/math.go
index 10acf36..31c7327 100644
--- a/internal/utils/math.go
+++ b/internal/utils/math.go
@@ -17,20 +17,21 @@
package utils
import (
+ "cmp"
"math"
"math/bits"
"golang.org/x/exp/constraints"
)
-func Min[T constraints.Ordered](a, b T) T {
+func Min[T cmp.Ordered](a, b T) T {
if a < b {
return a
}
return b
}
-func Max[T constraints.Ordered](a, b T) T {
+func Max[T cmp.Ordered](a, b T) T {
if a > b {
return a
}