Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-17326: [Go][FlightSQL] Add FlightSQL support for Go #13828

Merged
merged 14 commits into from
Aug 11, 2022
2 changes: 1 addition & 1 deletion dev/archery/archery/integration/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def run_all_tests(with_cpp=True, with_java=True, with_js=True,
Scenario(
"flight_sql",
description="Ensure Flight SQL protocol is working as expected.",
skip={"Rust", "Go"}
skip={"Rust"}
),
]

Expand Down
2 changes: 1 addition & 1 deletion format/Flight.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
syntax = "proto3";

option java_package = "org.apache.arrow.flight.impl";
option go_package = "github.com/apache/arrow/go/flight;flight";
option go_package = "github.com/apache/arrow/go/arrow/flight/internal/flight";
option csharp_namespace = "Apache.Arrow.Flight.Protocol";

package arrow.flight.protocol;
Expand Down
1 change: 1 addition & 0 deletions format/FlightSql.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ syntax = "proto3";
import "google/protobuf/descriptor.proto";

option java_package = "org.apache.arrow.flight.sql.impl";
option go_package = "github.com/apache/arrow/go/arrow/flight/internal/flight";
package arrow.flight.protocol.sql;

/*
Expand Down
4 changes: 4 additions & 0 deletions go/arrow/array/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ func NewRecord(schema *arrow.Schema, cols []arrow.Array, nrows int64) *simpleRec
}

func (rec *simpleRecord) validate() error {
if rec.rows == 0 && len(rec.arrs) == 0 {
return nil
}

if len(rec.arrs) != len(rec.schema.Fields()) {
return fmt.Errorf("arrow/array: number of columns/fields mismatch")
}
Expand Down
4 changes: 2 additions & 2 deletions go/arrow/array/record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ func TestRecord(t *testing.T) {
{
schema: schema,
cols: nil,
rows: -1,
err: fmt.Errorf("arrow/array: number of columns/fields mismatch"),
rows: 0,
// err: fmt.Errorf("arrow/array: number of columns/fields mismatch"),
lidavidm marked this conversation as resolved.
Show resolved Hide resolved
},
{
schema: schema,
Expand Down
11 changes: 11 additions & 0 deletions go/arrow/array/union.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,10 @@ type UnionBuilder interface {
// Mode returns what kind of Union is being built, either arrow.SparseMode
// or arrow.DenseMode
Mode() arrow.UnionMode
// Child returns the builder for the requested child index.
// If an invalid index is requested (e.g. <0 or >len(children))
// then this will panic.
Child(idx int) Builder
}

type unionBuilder struct {
Expand Down Expand Up @@ -734,6 +738,13 @@ func newUnionBuilder(mem memory.Allocator, children []Builder, typ arrow.UnionTy
return b
}

func (b *unionBuilder) Child(idx int) Builder {
if idx < 0 || idx > len(b.children) {
panic("arrow/array: invalid child index for union builder")
}
return b.children[idx]
}

func (b *unionBuilder) Mode() arrow.UnionMode { return b.mode }

func (b *unionBuilder) reserve(elements int, resize func(int)) {
Expand Down
Loading