Skip to content

Commit

Permalink
fix naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignalina committed Oct 23, 2022
1 parent a2fa544 commit d097f1b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions api/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ import (
"github.com/apache/arrow/go/v9/arrow/memory"
)

type CallApi interface {
type Bridge interface {
FromChunks(arrays []arrow.Array) (int, error)
}

type ArrowBridge struct {
type CommonParameter struct {
GoAllocator *memory.GoAllocator
}
6 changes: 3 additions & 3 deletions ffi/rust/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ func Info(s string) {
)
}

type GoBridge struct {
api.ArrowBridge
type Bridge struct {
api.CommonParameter
}

func (goBridge GoBridge) FromChunks(arrays []arrow.Array) (int, error) {
func (b Bridge) FromChunks(arrays []arrow.Array) (int, error) {
var Cschemas []cdata.CArrowSchema
var Carrays []cdata.CArrowArray

Expand Down
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,24 @@ func buildAndAppend(mem *memory.GoAllocator, values [][]int32) ([]*array.Int32Bu
}

func main() {
goBridge := rust.GoBridge{api.ArrowBridge{memory.NewGoAllocator()}}
mem := memory.NewGoAllocator()

var b api.Bridge
b = rust.Bridge{api.CommonParameter{mem}}

values := [][]int32{
{1, 2, 3, -4},
{2, 3, 4, 5},
{3, 4, 5, 6},
}

builders, arrays := buildAndAppend(goBridge.GoAllocator, values)
builders, arrays := buildAndAppend(mem, values)
for idx := 0; idx < len(arrays); idx++ {
defer builders[idx].Release()
defer arrays[idx].Release()
}

ret, err := goBridge.FromChunks(arrays)
ret, err := b.FromChunks(arrays)

if nil != err {
fmt.Println(err)
Expand Down

0 comments on commit d097f1b

Please sign in to comment.