Skip to content

Instantly share code, notes, and snippets.

@wolfeidau
Last active February 6, 2024 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolfeidau/b86f07898cf43655c5f822c9cfe3bb36 to your computer and use it in GitHub Desktop.
Save wolfeidau/b86f07898cf43655c5f822c9cfe3bb36 to your computer and use it in GitHub Desktop.
Testing out adbc to duckdb.
SIGSEGV: segmentation violation
PC=0x0 m=10 sigcode=2
signal arrived during cgo execution
goroutine 1 [syscall]:
runtime.cgocall(0x10083c984, 0x14000115418)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/cgocall.go:157 +0x44 fp=0x140001153e0 sp=0x140001153a0 pc=0x100485044
github.com/apache/arrow-adbc/go/adbc/drivermgr._Cfunc_AdbcStatementRelease(0x14000184000, 0x1400050c930)
_cgo_gotypes.go:498 +0x34 fp=0x14000115410 sp=0x140001153e0 pc=0x100818694
github.com/apache/arrow-adbc/go/adbc/drivermgr.(*stmt).Close.func1(0x14000115478?, 0x0?)
/Users/markw/go/pkg/mod/github.com/apache/arrow-adbc/go/adbc@v0.9.0/drivermgr/wrapper.go:375 +0x70 fp=0x14000115450 sp=0x14000115410 pc=0x10081b7d0
github.com/apache/arrow-adbc/go/adbc/drivermgr.(*stmt).Close(0x1009a6448?)
/Users/markw/go/pkg/mod/github.com/apache/arrow-adbc/go/adbc@v0.9.0/drivermgr/wrapper.go:375 +0x38 fp=0x14000115490 sp=0x14000115450 pc=0x10081b718
main.main.func3()
/Users/markw/Code/notgopath/duckdb_adbc_go/main.go:59 +0x30 fp=0x140001154b0 sp=0x14000115490 pc=0x10083c180
main.main()
/Users/markw/Code/notgopath/duckdb_adbc_go/main.go:85 +0xa08 fp=0x14000115f30 sp=0x140001154b0 pc=0x10083c0b8
runtime.main()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:267 +0x2bc fp=0x14000115fd0 sp=0x14000115f30 pc=0x1004b892c
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x14000115fd0 sp=0x14000115fd0 pc=0x1004e7654
goroutine 2 [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000054f90 sp=0x14000054f70 pc=0x1004b8d58
runtime.goparkunlock(...)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:404
runtime.forcegchelper()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:322 +0xb8 fp=0x14000054fd0 sp=0x14000054f90 pc=0x1004b8be8
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x14000054fd0 sp=0x14000054fd0 pc=0x1004e7654
created by runtime.init.6 in goroutine 1
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:310 +0x24
goroutine 3 [GC sweep wait]:
runtime.gopark(0x1?, 0x0?, 0x0?, 0x0?, 0x0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000055760 sp=0x14000055740 pc=0x1004b8d58
runtime.goparkunlock(...)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:404
runtime.bgsweep(0x0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgcsweep.go:321 +0x108 fp=0x140000557b0 sp=0x14000055760 pc=0x1004a5888
runtime.gcenable.func1()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:200 +0x28 fp=0x140000557d0 sp=0x140000557b0 pc=0x10049a318
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x140000557d0 sp=0x140000557d0 pc=0x1004e7654
created by runtime.gcenable in goroutine 1
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:200 +0x6c
goroutine 4 [sleep]:
runtime.gopark(0x14000180000?, 0x2d50fb22906d0?, 0x0?, 0x0?, 0x1009a38c0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000055f10 sp=0x14000055ef0 pc=0x1004b8d58
runtime.goparkunlock(...)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:404
runtime.(*scavengerState).sleep(0x100cc3600, 0x40eb624000000000)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgcscavenge.go:504 +0x128 fp=0x14000055f80 sp=0x14000055f10 pc=0x1004a32c8
runtime.bgscavenge(0x0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgcscavenge.go:662 +0x9c fp=0x14000055fb0 sp=0x14000055f80 pc=0x1004a367c
runtime.gcenable.func2()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:201 +0x28 fp=0x14000055fd0 sp=0x14000055fb0 pc=0x10049a2b8
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x14000055fd0 sp=0x14000055fd0 pc=0x1004e7654
created by runtime.gcenable in goroutine 1
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:201 +0xac
goroutine 18 [finalizer wait]:
runtime.gopark(0x0?, 0x140003681b0?, 0xf0?, 0x82?, 0x1000000010?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000067d80 sp=0x14000067d60 pc=0x1004b8d58
runtime.runfinq()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mfinal.go:193 +0x108 fp=0x14000067fd0 sp=0x14000067d80 pc=0x1004993c8
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x14000067fd0 sp=0x14000067fd0 pc=0x1004e7654
created by runtime.createfing in goroutine 1
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mfinal.go:163 +0x80
goroutine 34 [GC worker (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000050730 sp=0x14000050710 pc=0x1004b8d58
runtime.gcBgMarkWorker()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1295 +0xd8 fp=0x140000507d0 sp=0x14000050730 pc=0x10049bf78
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x140000507d0 sp=0x140000507d0 pc=0x1004e7654
created by runtime.gcBgMarkStartWorkers in goroutine 1
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1219 +0x28
goroutine 5 [GC worker (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000056730 sp=0x14000056710 pc=0x1004b8d58
runtime.gcBgMarkWorker()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1295 +0xd8 fp=0x140000567d0 sp=0x14000056730 pc=0x10049bf78
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x140000567d0 sp=0x140000567d0 pc=0x1004e7654
created by runtime.gcBgMarkStartWorkers in goroutine 1
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1219 +0x28
goroutine 6 [GC worker (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000056f30 sp=0x14000056f10 pc=0x1004b8d58
runtime.gcBgMarkWorker()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1295 +0xd8 fp=0x14000056fd0 sp=0x14000056f30 pc=0x10049bf78
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x14000056fd0 sp=0x14000056fd0 pc=0x1004e7654
created by runtime.gcBgMarkStartWorkers in goroutine 1
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1219 +0x28
goroutine 19 [GC worker (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000296730 sp=0x14000296710 pc=0x1004b8d58
runtime.gcBgMarkWorker()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1295 +0xd8 fp=0x140002967d0 sp=0x14000296730 pc=0x10049bf78
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x140002967d0 sp=0x140002967d0 pc=0x1004e7654
created by runtime.gcBgMarkStartWorkers in goroutine 1
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1219 +0x28
goroutine 35 [GC worker (idle)]:
runtime.gopark(0x2d50f4cd1cf6f?, 0x140004db100?, 0x1a?, 0x14?, 0x0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000050f30 sp=0x14000050f10 pc=0x1004b8d58
runtime.gcBgMarkWorker()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1295 +0xd8 fp=0x14000050fd0 sp=0x14000050f30 pc=0x10049bf78
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x14000050fd0 sp=0x14000050fd0 pc=0x1004e7654
created by runtime.gcBgMarkStartWorkers in goroutine 1
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1219 +0x28
goroutine 36 [GC worker (idle)]:
runtime.gopark(0x2d50f4cd11a9b?, 0x3?, 0x6b?, 0x3?, 0x0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000051730 sp=0x14000051710 pc=0x1004b8d58
runtime.gcBgMarkWorker()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1295 +0xd8 fp=0x140000517d0 sp=0x14000051730 pc=0x10049bf78
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x140000517d0 sp=0x140000517d0 pc=0x1004e7654
created by runtime.gcBgMarkStartWorkers in goroutine 1
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1219 +0x28
goroutine 37 [GC worker (idle)]:
runtime.gopark(0x100cf9660?, 0x3?, 0x9c?, 0x6a?, 0x0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000051f30 sp=0x14000051f10 pc=0x1004b8d58
runtime.gcBgMarkWorker()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1295 +0xd8 fp=0x14000051fd0 sp=0x14000051f30 pc=0x10049bf78
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x14000051fd0 sp=0x14000051fd0 pc=0x1004e7654
created by runtime.gcBgMarkStartWorkers in goroutine 1
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1219 +0x28
goroutine 38 [GC worker (idle)]:
runtime.gopark(0x100cf9660?, 0x1?, 0x86?, 0xc1?, 0x0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000052730 sp=0x14000052710 pc=0x1004b8d58
runtime.gcBgMarkWorker()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1295 +0xd8 fp=0x140000527d0 sp=0x14000052730 pc=0x10049bf78
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x140000527d0 sp=0x140000527d0 pc=0x1004e7654
created by runtime.gcBgMarkStartWorkers in goroutine 1
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1219 +0x28
goroutine 39 [GC worker (idle)]:
runtime.gopark(0x2d50f4cd11be9?, 0x1?, 0x7a?, 0xbc?, 0x0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000052f30 sp=0x14000052f10 pc=0x1004b8d58
runtime.gcBgMarkWorker()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1295 +0xd8 fp=0x14000052fd0 sp=0x14000052f30 pc=0x10049bf78
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x14000052fd0 sp=0x14000052fd0 pc=0x1004e7654
created by runtime.gcBgMarkStartWorkers in goroutine 1
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1219 +0x28
goroutine 20 [GC worker (idle)]:
runtime.gopark(0x2d50f4cd1f873?, 0x1?, 0x7c?, 0x9?, 0x0?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/proc.go:398 +0xc8 fp=0x14000296f30 sp=0x14000296f10 pc=0x1004b8d58
runtime.gcBgMarkWorker()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1295 +0xd8 fp=0x14000296fd0 sp=0x14000296f30 pc=0x10049bf78
runtime.goexit()
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x14000296fd0 sp=0x14000296fd0 pc=0x1004e7654
created by runtime.gcBgMarkStartWorkers in goroutine 1
/opt/homebrew/Cellar/go/1.21.6/libexec/src/runtime/mgc.go:1219 +0x28
r0 0x14000184000
r1 0x1400050c930
r2 0x14000115390
r3 0x140000831e0
r4 0xc70
r5 0x14000002230
r6 0x1
r7 0x6
r8 0x0
r9 0x0
r10 0x80000000
r11 0x0
r12 0x31
r13 0x1746d2f00
r14 0x32
r15 0x8d67f002
r16 0x1400010e3a0
r17 0x14000115370
r18 0x0
r19 0x14000184000
r20 0x14000116000
r21 0x3c
r22 0x0
r23 0x5a
r24 0x0
r25 0x1400003cf68
r26 0x140001158f0
r27 0x810
r28 0x140000831e0
r29 0x1746d2ec0
lr 0x100841b68
sp 0x1746d2eb0
pc 0x0
fault 0x0
exit status 2
module github.com/wolfeidau/duckdb-adbc-go
go 1.21.6
require (
github.com/alecthomas/kong v0.8.1
github.com/apache/arrow-adbc/go/adbc v0.9.0
github.com/rs/zerolog v1.32.0
)
require (
github.com/apache/arrow/go/v14 v14.0.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/google/flatbuffers v23.5.26+incompatible // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/tools v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)
package main
import (
"context"
"encoding/json"
"fmt"
"github.com/alecthomas/kong"
"github.com/apache/arrow-adbc/go/adbc/drivermgr"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
var (
version = "development"
cli struct {
Version kong.VersionFlag `help:"Print the version and exit" short:"v"`
Debug bool `help:"Enable debug logging."`
}
)
func main() {
kong.Parse(&cli,
kong.Description("Packaging tool which builds Lambda deployment archives from a list of binaries."),
kong.Vars{
"version": version,
},
)
logger := zerolog.New(zerolog.NewConsoleWriter()).Level(zerolog.InfoLevel).With().Caller().Timestamp().Logger()
if cli.Debug {
logger = logger.Level(zerolog.DebugLevel)
}
var drv drivermgr.Driver
db, err := drv.NewDatabase(map[string]string{
"driver": "lib/libduckdb.dylib",
"entrypoint": "duckdb_adbc_init",
// any other parameters to duckdb
})
if err != nil {
log.Fatal().Err(err).Msg("failed to open database")
}
ctx := context.Background()
cnxn, err := db.Open(ctx)
if err != nil {
log.Fatal().Err(err).Msg("failed to open connection")
}
// you can use cnxn to query the duckdb instance
st, err := cnxn.NewStatement()
if err != nil {
log.Fatal().Err(err).Msg("failed to create statement")
}
defer st.Close()
//
// Using https://duckdb.org/docs/extensions/iceberg To test the examples, download the iceberg_data.zip file and unzip it.
//
err = st.SetSqlQuery(`SELECT * FROM "data/iceberg/lineitem_iceberg/data/00041-414-f3c73457-bbd6-4b92-9c15-17b241171b16-00001.parquet"`)
if err != nil {
log.Fatal().Err(err).Msg("failed to set query")
}
rdr, n, err := st.ExecuteQuery(ctx)
if err != nil {
log.Fatal().Err(err).Msg("failed to execute query")
}
defer rdr.Release()
log.Info().Int64("rows", n).Msg("query executed")
for rdr.Next() {
rec := rdr.Record()
data, err := json.Marshal(rec)
if err != nil {
log.Fatal().Err(err).Msg("failed to marshal record")
}
fmt.Println(string(data))
rec.Release()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment