Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/docker/python-debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ cat /adbc/ci/conda_env_cpp.txt /adbc/ci/conda_env_python.txt |\

micromamba install -c conda-forge -y \
-f /tmp/spec.txt \
binutils \
"conda-forge/label/python_debug::python=${PYTHON}.*"
micromamba clean --all -y

Expand Down
4 changes: 2 additions & 2 deletions dev/release/verify-release-candidate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ test_cpp() {
maybe_setup_conda \
--file ci/conda_env_cpp.txt \
compilers \
go python || exit 1
go-cgo python || exit 1

if [ "${USE_CONDA}" -gt 0 ]; then
export CMAKE_PREFIX_PATH="${CONDA_BACKUP_CMAKE_PREFIX_PATH}:${CMAKE_PREFIX_PATH}"
Expand Down Expand Up @@ -661,7 +661,7 @@ test_go() {
# apache/arrow-adbc#517: `go build` calls git. Don't assume system
# has git; even if it's there, go_build.sh sets DYLD_LIBRARY_PATH
# which can interfere with system git.
maybe_setup_conda compilers git go || exit 1
maybe_setup_conda compilers git go-cgo || exit 1

if [ "${USE_CONDA}" -gt 0 ]; then
# The CMake setup forces RPATH to be the Conda prefix
Expand Down
35 changes: 29 additions & 6 deletions go/adbc/driver/flightsql/flightsql_adbc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ import (
"os"
"path/filepath"
"runtime"
"runtime/debug"
"slices"
"strings"
"testing"
"time"

"github.com/apache/arrow-adbc/go/adbc"
driver "github.com/apache/arrow-adbc/go/adbc/driver/flightsql"
"github.com/apache/arrow-adbc/go/adbc/driver/internal/driverbase"
"github.com/apache/arrow-adbc/go/adbc/validation"
"github.com/apache/arrow-go/v18/arrow"
"github.com/apache/arrow-go/v18/arrow/array"
Expand Down Expand Up @@ -256,16 +258,37 @@ func (s *FlightSQLQuirks) SupportsStatistics() bool { return
func (s *FlightSQLQuirks) SupportsTransactions() bool { return true }
func (s *FlightSQLQuirks) SupportsGetParameterSchema() bool { return false }
func (s *FlightSQLQuirks) SupportsDynamicParameterBinding() bool { return true }

func expectedDriverVersions() (string, string) {
driverVersion, arrowVersion := driverbase.UnknownVersion, driverbase.UnknownVersion
if info, ok := debug.ReadBuildInfo(); ok {
for _, setting := range info.Settings {
if setting.Key == "vcs.modified" && setting.Value == "true" {
driverVersion = "-dev"
}
}
for _, dep := range info.Deps {
if strings.HasPrefix(dep.Path, "github.com/apache/arrow-go/") {
if dep.Version != "" {
arrowVersion = dep.Version
}
break
}
}
}
return driverVersion, arrowVersion
}

func (s *FlightSQLQuirks) GetMetadata(code adbc.InfoCode) interface{} {
switch code {
case adbc.InfoDriverName:
return "ADBC Flight SQL Driver - Go"
// runtime/debug.ReadBuildInfo doesn't currently work for tests
// github.com/golang/go/issues/33976
case adbc.InfoDriverVersion:
return "(unknown or development build)"
driverVersion, _ := expectedDriverVersions()
return driverVersion
case adbc.InfoDriverArrowVersion:
return "(unknown or development build)"
_, arrowVersion := expectedDriverVersions()
return arrowVersion
case adbc.InfoDriverADBCVersion:
return adbc.AdbcVersion1_1_0
case adbc.InfoVendorName:
Expand Down Expand Up @@ -1147,12 +1170,12 @@ func (suite *ConnectionTests) TestGetInfo() {
case adbc.InfoDriverVersion:
{
driverVersion = true
// Can't assert on value here since test won't have debug.ReadBuildInfo
// Version values are checked by TestMetadataGetInfo.
}
case adbc.InfoDriverArrowVersion:
{
driverArrowVersion = true
// Can't assert on value here since test won't have debug.ReadBuildInfo
// Version values are checked by TestMetadataGetInfo.
}
}
}
Expand Down
39 changes: 31 additions & 8 deletions go/adbc/driver/internal/driverbase/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"encoding/json"
"fmt"
"log/slog"
"runtime/debug"
"slices"
"strings"
"testing"
Expand Down Expand Up @@ -51,6 +52,26 @@ func NewDriver(alloc memory.Allocator, handler slog.Handler, useHelpers bool) ad
return driverbase.NewDriver(&driverImpl{DriverImplBase: driverbase.NewDriverImplBase(info, alloc), handler: handler, useHelpers: useHelpers})
}

func expectedDriverVersions() (string, string) {
driverVersion, arrowVersion := driverbase.UnknownVersion, driverbase.UnknownVersion
if info, ok := debug.ReadBuildInfo(); ok {
for _, setting := range info.Settings {
if setting.Key == "vcs.modified" && setting.Value == "true" {
driverVersion = "-dev"
}
}
for _, dep := range info.Deps {
if strings.HasPrefix(dep.Path, "github.com/apache/arrow-go/") {
if dep.Version != "" {
arrowVersion = dep.Version
}
break
}
}
}
return driverVersion, arrowVersion
}

func TestDefaultDriver(t *testing.T) {
var handler MockedHandler
handler.On("Handle", mock.Anything, mock.Anything).Return(nil)
Expand Down Expand Up @@ -94,7 +115,8 @@ func TestDefaultDriver(t *testing.T) {

// This is what the driverbase provided GetInfo result should look like out of the box,
// with one custom setting registered at initialization
expectedGetInfoTable, err := array.TableFromJSON(alloc, adbc.GetInfoSchema, []string{`[
driverVersion, arrowVersion := expectedDriverVersions()
expectedGetInfoTable, err := array.TableFromJSON(alloc, adbc.GetInfoSchema, []string{fmt.Sprintf(`[
{
"info_name": 0,
"info_value": [0, "MockDriver"]
Expand All @@ -113,11 +135,11 @@ func TestDefaultDriver(t *testing.T) {
},
{
"info_name": 101,
"info_value": [0, "(unknown or development build)"]
"info_value": [0, %q]
},
{
"info_name": 102,
"info_value": [0, "(unknown or development build)"]
"info_value": [0, %q]
},
{
"info_name": 103,
Expand All @@ -127,7 +149,7 @@ func TestDefaultDriver(t *testing.T) {
"info_name": 10001,
"info_value": [0, "my custom info"]
}
]`})
]`, driverVersion, arrowVersion)})
require.NoError(t, err)
defer expectedGetInfoTable.Release()

Expand Down Expand Up @@ -223,7 +245,8 @@ func TestCustomizedDriver(t *testing.T) {
// - the default DriverInfo set at initialization
// - the DriverInfo set once in the NewDriver constructor
// - the DriverInfo set dynamically when GetInfo is called by implementing DriverInfoPreparer interface
expectedGetInfoTable, err := array.TableFromJSON(alloc, adbc.GetInfoSchema, []string{`[
driverVersion, arrowVersion := expectedDriverVersions()
expectedGetInfoTable, err := array.TableFromJSON(alloc, adbc.GetInfoSchema, []string{fmt.Sprintf(`[
{
"info_name": 0,
"info_value": [0, "MockDriver"]
Expand All @@ -250,11 +273,11 @@ func TestCustomizedDriver(t *testing.T) {
},
{
"info_name": 101,
"info_value": [0, "(unknown or development build)"]
"info_value": [0, %q]
},
{
"info_name": 102,
"info_value": [0, "(unknown or development build)"]
"info_value": [0, %q]
},
{
"info_name": 103,
Expand All @@ -268,7 +291,7 @@ func TestCustomizedDriver(t *testing.T) {
"info_name": 10002,
"info_value": [0, "this was fetched dynamically"]
}
]`})
]`, driverVersion, arrowVersion)})
require.NoError(t, err)
defer expectedGetInfoTable.Release()

Expand Down
Loading