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 bbdd2e47 refactor(arrow/compute/exprs): deprecate Substrait anchor
APIs (#1500)
bbdd2e47 is described below
commit bbdd2e47f768ccfc2bfa845b3dadcaf8dfb2ea1f
Author: Ben Bellick <[email protected]>
AuthorDate: Mon Nov 23 18:09:02 2026 -0500
refactor(arrow/compute/exprs): deprecate Substrait anchor APIs (#1500)
Arrow exposes Substrait anchor allocation and lookup through
`ExtensionIDSet`, even though callers can use the higher-level type
conversion and execution APIs without managing anchors themselves.
Deprecate these methods ahead of their removal in the next major
release.
This change only adds deprecation comments and migration guidance.
Existing APIs and behavior are unchanged. #1627 contains the removal
step.
The motivation is
[substrait-go#161](https://github.com/substrait-io/substrait-go/issues/161),
which proposes removing anchors from `substrait-go`'s public model.
Handling Arrow's API change now avoids having to introduce that breaking
change as part of a future `substrait-go` upgrade.
Part of #1623.
I'm unsure of the public API change policy here, so I figured I would
land a deprecation first, then remove the APIs in the stacked follow-up.
### Stack
1. https://github.com/apache/arrow-go/pull/1500 <--- you are here
2. https://github.com/apache/arrow-go/pull/1627
---
Note: This PR was developed with AI assistance. All changes have been
reviewed, and I take full responsibility for this contribution.
---
arrow/compute/exprs/types.go | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/arrow/compute/exprs/types.go b/arrow/compute/exprs/types.go
index ea179ca3..fa21340f 100644
--- a/arrow/compute/exprs/types.go
+++ b/arrow/compute/exprs/types.go
@@ -387,6 +387,8 @@ type extensionSet struct {
func (e *extensionSet) GetArrowRegistry() *ExtensionIDRegistry { return
e.reg }
func (e *extensionSet) GetSubstraitRegistry() expr.ExtensionRegistry { return
e.ExtensionRegistry }
+// Deprecated: Anchor bookkeeping is an implementation detail.
+// Use FromSubstraitType to convert Substrait types to Arrow.
func (e *extensionSet) DecodeTypeArrow(anchor uint32) (extensions.ID,
arrow.DataType, bool) {
id, ok := e.DecodeType(anchor)
if !ok {
@@ -399,6 +401,8 @@ func (e *extensionSet) DecodeTypeArrow(anchor uint32)
(extensions.ID, arrow.Data
return id, dt, ok
}
+// Deprecated: Anchor bookkeeping is an implementation detail.
+// Use ExecuteScalarExpression to execute Substrait functions.
func (e *extensionSet) DecodeFunction(ref uint32) (extensions.ID,
substraitToArrow, bool) {
id, ok := e.DecodeFunc(ref)
if !ok {
@@ -415,6 +419,8 @@ func (e *extensionSet) DecodeFunction(ref uint32)
(extensions.ID, substraitToArr
return id, conv, ok
}
+// Deprecated: Anchor bookkeeping is an implementation detail.
+// Use ToSubstraitType to convert Arrow types to Substrait.
func (e *extensionSet) EncodeTypeVariation(dt arrow.DataType) (extensions.ID,
uint32, bool) {
id, ok := e.reg.GetIDByType(dt)
if !ok {
@@ -424,6 +430,8 @@ func (e *extensionSet) EncodeTypeVariation(dt
arrow.DataType) (extensions.ID, ui
return id, e.GetTypeVariationAnchor(id), true
}
+// Deprecated: Anchor bookkeeping is an implementation detail.
+// Use ToSubstraitType to convert Arrow types to Substrait.
func (e *extensionSet) EncodeType(dt arrow.DataType) (extensions.ID, uint32,
bool) {
id, ok := e.reg.GetIDByType(dt)
if !ok {
@@ -433,6 +441,8 @@ func (e *extensionSet) EncodeType(dt arrow.DataType)
(extensions.ID, uint32, boo
return id, e.GetTypeAnchor(id), true
}
+// Deprecated: Allocate function anchors through the Substrait registry when
+// encoding expressions. Arrow execution does not require this helper.
func (e *extensionSet) EncodeFunction(id extensions.ID) uint32 {
return e.GetFuncAnchor(id)
}
@@ -570,10 +580,18 @@ type ExtensionIDSet interface {
GetArrowRegistry() *ExtensionIDRegistry
GetSubstraitRegistry() expr.ExtensionRegistry
+ // Deprecated: Anchor bookkeeping is an implementation detail.
+ // Use FromSubstraitType to convert Substrait types to Arrow.
DecodeTypeArrow(anchor uint32) (extensions.ID, arrow.DataType, bool)
+ // Deprecated: Anchor bookkeeping is an implementation detail.
+ // Use ExecuteScalarExpression to execute Substrait functions.
DecodeFunction(ref uint32) (extensions.ID, substraitToArrow, bool)
+ // Deprecated: Anchor bookkeeping is an implementation detail.
+ // Use ToSubstraitType to convert Arrow types to Substrait.
EncodeType(dt arrow.DataType) (extensions.ID, uint32, bool)
+ // Deprecated: Anchor bookkeeping is an implementation detail.
+ // Use ToSubstraitType to convert Arrow types to Substrait.
EncodeTypeVariation(dt arrow.DataType) (extensions.ID, uint32, bool)
}