Skip to content

Commit

Permalink
chore: CI fixes, downgrade to Go 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed Aug 8, 2023
1 parent 80b8e32 commit 2c13c97
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 42 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
c/vendor/* linguist-vendored
go/adbc/drivermgr/adbc.h linguist-vendored
go/adbc/drivermgr/adbc_driver_manager.cc linguist-vendored
go/adbc/pkg/flightsql/* linguist-generated
go/adbc/pkg/panicdummy/* linguist-generated
go/adbc/pkg/snowflake/* linguist-generated
python/adbc_driver_flightsql/adbc_driver_flightsql/_static_version.py export-subst
python/adbc_driver_manager/adbc_driver_manager/_static_version.py export-subst
python/adbc_driver_postgresql/adbc_driver_postgresql/_static_version.py export-subst
Expand Down
3 changes: 2 additions & 1 deletion c/driver_manager/adbc_driver_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <algorithm>
#include <array>
#include <cctype>
#include <cstring>
#include <string>
#include <unordered_map>
Expand Down Expand Up @@ -600,7 +601,7 @@ std::string AdbcDriverManagerDefaultEntrypoint(const std::string& driver) {
// if pos == npos this is the entire filename
std::string token = filename.substr(prev, pos - prev);
// capitalize first letter
token[0] = std::toupper(token[0]);
token[0] = std::toupper(static_cast<unsigned char>(token[0]));

entrypoint += token;

Expand Down
2 changes: 1 addition & 1 deletion ci/scripts/python_wheel_unix_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function check_visibility {
# Filter out Arrow symbols and see if anything remains.
# '_init' and '_fini' symbols may or not be present, we don't care.
# (note we must ignore the grep exit status when no match is found)
grep ' T ' nm_arrow.log | grep -v -E '(Adbc|\b_init\b|\b_fini\b)' | cat - > visible_symbols.log
grep ' T ' nm_arrow.log | grep -v -E '(Adbc|DriverInit|\b_init\b|\b_fini\b)' | cat - > visible_symbols.log

if [[ -f visible_symbols.log && `cat visible_symbols.log | wc -l` -eq 0 ]]; then
return 0
Expand Down
25 changes: 7 additions & 18 deletions go/adbc/driver/flightsql/flightsql_adbc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1162,10 +1162,8 @@ func (c *cnxn) GetInfo(ctx context.Context, infoCodes []adbc.InfoCode) (array.Re
}
}

if rdr.Err() != nil {
return nil, adbcFromFlightStatusWithDetails(rdr.Err(), header, trailer, "GetInfo(DoGet): endpoint %d: %s", i, endpoint.Location)
} else if ctx.Err() != nil {
return nil, adbcFromFlightStatusWithDetails(context.Cause(ctx), header, trailer, "GetInfo(DoGet): endpoint %d: %s", i, endpoint.Location)
if err := checkContext(rdr.Err(), ctx); err != nil {
return nil, adbcFromFlightStatusWithDetails(err, header, trailer, "GetInfo(DoGet): endpoint %d: %s", i, endpoint.Location)
}
}
} else if grpcstatus.Code(err) != grpccodes.Unimplemented {
Expand Down Expand Up @@ -1303,12 +1301,9 @@ func (c *cnxn) GetObjects(ctx context.Context, depth adbc.ObjectDepth, catalog *
g.AppendCatalog("")
}

if err = rdr.Err(); err != nil {
if err := checkContext(rdr.Err(), ctx); err != nil {
return nil, adbcFromFlightStatusWithDetails(err, header, trailer, "GetObjects(GetCatalogs)")
} else if ctx.Err() != nil {
return nil, adbcFromFlightStatusWithDetails(context.Cause(ctx), header, trailer, "GetObjects(GetCatalogs)")
}

return g.Finish()
}

Expand Down Expand Up @@ -1366,11 +1361,8 @@ func (c *cnxn) getObjectsDbSchemas(ctx context.Context, depth adbc.ObjectDepth,
}
}

if rdr.Err() != nil {
result = nil
err = adbcFromFlightStatusWithDetails(rdr.Err(), header, trailer, "GetObjects(GetDBSchemas)")
} else if ctx.Err() != nil {
return nil, adbcFromFlightStatusWithDetails(context.Cause(ctx), header, trailer, "GetObjects(GetCatalogs)")
if err := checkContext(rdr.Err(), ctx); err != nil {
return nil, adbcFromFlightStatusWithDetails(err, header, trailer, "GetObjects(GetCatalogs)")
}
return
}
Expand Down Expand Up @@ -1449,12 +1441,9 @@ func (c *cnxn) getObjectsTables(ctx context.Context, depth adbc.ObjectDepth, cat
}
}

if rdr.Err() != nil {
result = nil
err = adbcFromFlightStatusWithDetails(rdr.Err(), header, trailer, "GetObjects(GetTables)")
} else if ctx.Err() != nil {
if err := checkContext(rdr.Err(), ctx); err != nil {
result = nil
err = adbcFromFlightStatusWithDetails(context.Cause(ctx), header, trailer, "GetObjects(GetTables)")
err = adbcFromFlightStatusWithDetails(err, header, trailer, "GetObjects(GetTables)")
}
return
}
Expand Down
12 changes: 4 additions & 8 deletions go/adbc/driver/flightsql/record_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,8 @@ func newRecordReader(ctx context.Context, alloc memory.Allocator, cl *flightsql.
rec.Retain()
ch <- rec
}
if rdr.Err() != nil {
return adbcFromFlightStatusWithDetails(rdr.Err(), header, trailer, "DoGet: endpoint 0: remote: %s", firstEndpoint.Location)
} else if ctx.Err() != nil {
return adbcFromFlightStatusWithDetails(context.Cause(ctx), header, trailer, "DoGet: endpoint 0: remote: %s", firstEndpoint.Location)
if err := checkContext(rdr.Err(), ctx); err != nil {
return adbcFromFlightStatusWithDetails(err, header, trailer, "DoGet: endpoint 0: remote: %s", firstEndpoint.Location)
}
return nil
})
Expand Down Expand Up @@ -159,10 +157,8 @@ func newRecordReader(ctx context.Context, alloc memory.Allocator, cl *flightsql.
chs[endpointIndex] <- rec
}

if rdr.Err() != nil {
return adbcFromFlightStatusWithDetails(rdr.Err(), header, trailer, "DoGet: endpoint %d: %s", endpointIndex, endpoint.Location)
} else if ctx.Err() != nil {
return adbcFromFlightStatusWithDetails(context.Cause(ctx), header, trailer, "DoGet: endpoint %d: %s", endpointIndex, endpoint.Location)
if err := checkContext(rdr.Err(), ctx); err != nil {
return adbcFromFlightStatusWithDetails(err, header, trailer, "DoGet: endpoint %d: %s", endpointIndex, endpoint.Location)
}
return nil
})
Expand Down
12 changes: 12 additions & 0 deletions go/adbc/driver/flightsql/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package flightsql

import (
"context"
"fmt"

"github.com/apache/arrow-adbc/go/adbc"
Expand Down Expand Up @@ -123,3 +124,14 @@ func adbcFromFlightStatusWithDetails(err error, header, trailer metadata.MD, con
Details: details,
}
}

func checkContext(maybeErr error, ctx context.Context) error {
if maybeErr != nil {
return maybeErr
} else if ctx.Err() == context.Canceled {
return adbc.Error{Msg: "Cancelled by request", Code: adbc.StatusCancelled}
} else if ctx.Err() == context.DeadlineExceeded {
return adbc.Error{Msg: "Deadline exceeded", Code: adbc.StatusTimeout}
}
return ctx.Err()
}
3 changes: 2 additions & 1 deletion go/adbc/drivermgr/adbc_driver_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <algorithm>
#include <array>
#include <cctype>
#include <cstring>
#include <string>
#include <unordered_map>
Expand Down Expand Up @@ -600,7 +601,7 @@ std::string AdbcDriverManagerDefaultEntrypoint(const std::string& driver) {
// if pos == npos this is the entire filename
std::string token = filename.substr(prev, pos - prev);
// capitalize first letter
token[0] = std::toupper(token[0]);
token[0] = std::toupper(static_cast<unsigned char>(token[0]));

entrypoint += token;

Expand Down
2 changes: 1 addition & 1 deletion go/adbc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

module github.com/apache/arrow-adbc/go/adbc

go 1.20
go 1.18

require (
github.com/apache/arrow/go/v13 v13.0.0-20230713180941-b97597765355
Expand Down
6 changes: 3 additions & 3 deletions go/adbc/pkg/_tmpl/driver.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,18 @@ func exportBytesOption(val []byte, out *C.uint8_t, length *C.size_t) C.AdbcStatu

type cancellableContext struct {
ctx context.Context
cancel context.CancelCauseFunc
cancel context.CancelFunc
}

func (c *cancellableContext) newContext() context.Context {
c.cancelContext()
c.ctx, c.cancel = context.WithCancelCause(context.Background())
c.ctx, c.cancel = context.WithCancel(context.Background())
return c.ctx
}

func (c *cancellableContext) cancelContext() {
if c.cancel != nil {
c.cancel(adbc.Error{Msg: "Cancelled by request", Code: adbc.StatusCancelled})
c.cancel()
}
c.ctx = nil
c.cancel = nil
Expand Down
6 changes: 3 additions & 3 deletions go/adbc/pkg/flightsql/driver.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions go/adbc/pkg/panicdummy/driver.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions go/adbc/pkg/snowflake/driver.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions python/adbc_driver_manager/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ include NOTICE.txt
include adbc_driver_manager/adbc.h
include adbc_driver_manager/adbc_driver_manager.cc
include adbc_driver_manager/adbc_driver_manager.h
include adbc_driver_manager/_lib.pxd
include adbc_driver_manager/_lib.pyi
include adbc_driver_manager/_reader.pyi
include adbc_driver_manager/py.typed

0 comments on commit 2c13c97

Please sign in to comment.