bippio / go-impala

Golang Driver for Apache Impala
MIT License
52 stars 39 forks source link

fix bug: panic when executing some time-consuming sql task, the resp.… #28

Closed liracle closed 3 years ago

liracle commented 3 years ago

fix bug: panic when executing some time-consuming sql task, the resp.Results that function(operation.go) return is nil

when I execute inserting 100000+ records, panic occur, follow is traceback: impala: 2020/12/24 22:37:57 execute operation: 63062281-d83a-4b4d-0000-00005b2e641c impala: 2020/12/24 22:37:57 operation. has resultset: false impala: 2020/12/24 22:37:57 operation. modified row count: 0.000000 impala: 2020/12/24 22:37:57 fetch metadata for operation: 63062281-d83a-4b4d-0000-00005b2e641c impala: 2020/12/24 22:37:57 fetch results for operation: 63062281-d83a-4b4d-0000-00005b2e641c impala: 2020/12/24 22:38:07 results: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x67e305]

goroutine 1 [running]: github.com/bippio/go-impala/hive.length(0x0, 0xc0000fe0c0) /Users/ipeapea/go/pkg/mod/github.com/bippio/go-impala@v2.0.1-0.20201029091501-4666eaa4ec38+incompatible/hive/result_set.go:110 +0x5 github.com/bippio/go-impala/hive.(Operation).FetchResults(0xc0000e8020, 0x75cce0, 0xc0001ba060, 0xc00020c320, 0x0, 0x0, 0x0) /Users/ipeapea/go/pkg/mod/github.com/bippio/go-impala@v2.0.1-0.20201029091501-4666eaa4ec38+incompatible/hive/operation.go:73 +0xb0 github.com/bippio/go-impala.query(0x75cce0, 0xc0001ba060, 0xc00020b820, 0xc000e80000, 0x3feb3f, 0xc000e80000, 0x3feb3f, 0x0, 0xc00020edb0) /Users/ipeapea/go/pkg/mod/github.com/bippio/go-impala@v2.0.1-0.20201029091501-4666eaa4ec38+incompatible/statement.go:122 +0xde github.com/bippio/go-impala.(Conn).QueryContext(0xc00020edb0, 0x75cce0, 0xc0001ba060, 0xc000e80000, 0x3feb3f, 0x913a28, 0x0, 0x0, 0x203000, 0x33, ...) /Users/ipeapea/go/pkg/mod/github.com/bippio/go-impala@v2.0.1-0.20201029091501-4666eaa4ec38+incompatible/connection.go:69 +0x113 database/sql.ctxDriverQuery(0x75cce0, 0xc0001ba060, 0x7f057da1c6c0, 0xc00020edb0, 0x0, 0x0, 0xc000e80000, 0x3feb3f, 0x913a28, 0x0, ...) /usr/local/go/src/database/sql/ctxutil.go:48 +0x227 database/sql.(DB).queryDC.func1() /usr/local/go/src/database/sql/sql.go:1643 +0x1de database/sql.withLock(0x75a7e0, 0xc000278090, 0xc00018dbf0) /usr/local/go/src/database/sql/sql.go:3284 +0x69 database/sql.(DB).queryDC(0xc00022cc30, 0x75cce0, 0xc0001ba060, 0x0, 0x0, 0xc000278090, 0xc00020a9d0, 0xc000e80000, 0x3feb3f, 0x0, ...) /usr/local/go/src/database/sql/sql.go:1638 +0x5f4 database/sql.(DB).query(0xc00022cc30, 0x75cce0, 0xc0001ba060, 0xc000e80000, 0x3feb3f, 0x0, 0x0, 0x0, 0x75cc01, 0xc0001a8000, ...) /usr/local/go/src/database/sql/sql.go:1621 +0x136 database/sql.(DB).QueryContext(0xc00022cc30, 0x75cce0, 0xc0001ba060, 0xc000e80000, 0x3feb3f, 0x0, 0x0, 0x0, 0x5a0e502000000c8, 0x5fe4a7c1, ...) /usr/local/go/src/database/sql/sql.go:1598 +0xd1