ostafen-m2d opened a new issue, #493:
URL: https://github.com/apache/arrow-go/issues/493

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   Hi, I'm experimenting a weird behavior for the equal kernel, when using it 
to compare boolean values.
   
   ```golang
   package main
   
   import (
        "context"
        "fmt"
        "log"
   
        "github.com/apache/arrow-go/v18/arrow/array"
        "github.com/apache/arrow-go/v18/arrow/compute"
        "github.com/apache/arrow-go/v18/arrow/memory"
   )
   
   func main() {
        ctx := context.Background()
        pool := memory.NewGoAllocator()
        n := 5 // number of elements in the array
   
        // --- Build first Boolean array filled with false ---
        bldr1 := array.NewBooleanBuilder(pool)
        defer bldr1.Release()
        for i := 0; i < n; i++ {
                bldr1.Append(false)
        }
        arr1 := bldr1.NewBooleanArray()
        defer arr1.Release()
   
        // --- Build second Boolean array filled with false ---
        bldr2 := array.NewBooleanBuilder(pool)
        defer bldr2.Release()
        for i := 0; i < n; i++ {
                bldr2.Append(false)
        }
        arr2 := bldr2.NewBooleanArray()
        defer arr2.Release()
   
        // Wrap arrays as compute.Datum
        datum1 := compute.NewDatum(arr1)
        datum2 := compute.NewDatum(arr2)
   
        // --- Call equal kernel ---
        resDatum, err := compute.CallFunction(ctx, "equal", nil, datum1, datum2)
        if err != nil {
                log.Fatal(err)
        }
        defer resDatum.Release()
   
        // Convert result Datum to BooleanArray
        resArr := resDatum.(*compute.ArrayDatum).MakeArray().(*array.Boolean)
        defer resArr.Release()
   
        // Print element-wise comparison
        for i := 0; i < int(resArr.Len()); i++ {
                fmt.Printf("arr1[%d] == arr2[%d] -> %v\n", i, i, 
resArr.Value(i))
        }
   }
   ```
   
   I would expect this snippet to print true for all result values, but it 
print false.
   
   Is this expected behavior? Am I missing something?
   
   ### Component(s)
   
   Other


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to