From ea97479e47c771dd473263c7bb319135fb5b2ac8 Mon Sep 17 00:00:00 2001 From: Stefano Scafiti Date: Tue, 26 Aug 2025 17:18:03 +0200 Subject: [PATCH] Register arrow to substrait boolean functions. Add support for "xor" operator. --- arrow/compute/exprs/types.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arrow/compute/exprs/types.go b/arrow/compute/exprs/types.go index ad6e4e19..9b12b83a 100644 --- a/arrow/compute/exprs/types.go +++ b/arrow/compute/exprs/types.go @@ -113,7 +113,7 @@ func init() { } } - for _, fn := range []string{"and", "or", "not"} { + for _, fn := range []string{"and", "or", "xor", "not"} { err := DefaultExtensionIDRegistry.AddSubstraitScalarToArrow( extensions.ID{URI: SubstraitBooleanFuncsURI, Name: fn}, simpleMapSubstraitToArrowFunc) @@ -122,6 +122,15 @@ func init() { } } + // NOTE: "not" is already registered for conversion to substrait + for _, fn := range []string{"and", "or", "xor"} { + err := DefaultExtensionIDRegistry.AddArrowToSubstrait(fn, + simpleMapArrowToSubstraitFunc(SubstraitBooleanFuncsURI)) + if err != nil { + panic(err) + } + } + for _, fn := range []string{"and_kleene", "or_kleene", "not"} { err := DefaultExtensionIDRegistry.AddArrowToSubstrait(fn, simpleMapArrowToSubstraitFunc(SubstraitBooleanFuncsURI))