sql-machine-learning / gohive

A Go driver for Hive
55 stars 27 forks source link

go test -v panic #47

Open jimdn opened 5 years ago

jimdn commented 5 years ago

go test -v === RUN TestOpenConnection --- PASS: TestOpenConnection (0.00s) === RUN TestQuery --- FAIL: TestQuery (0.06s) panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x6bf29c]

goroutine 8 [running]: testing.tRunner.func1(0xc000104200) /usr/lib/golang/src/testing/testing.go:792 +0x387 panic(0x712840, 0x9cf200) /usr/lib/golang/src/runtime/panic.go:513 +0x1b9 sqlflow.org/gohive.drv.Open(0x776384, 0x15, 0x1e, 0xc000055b28, 0x435b0c, 0xc000055b60) /home/jimmydeng/go/src/sqlflow.org/gohive/driver.go:53 +0x1ac database/sql.dsnConnector.Connect(0x776384, 0x15, 0x7c2140, 0x9f8800, 0x7c4c80, 0xc000014098, 0x0, 0x0, 0x0, 0x0) /usr/lib/golang/src/database/sql/sql.go:637 +0x45 database/sql.(DB).conn(0xc00010a180, 0x7c4c80, 0xc000014098, 0x40db01, 0x4368be, 0xc0000425a8, 0x459ad0) /usr/lib/golang/src/database/sql/sql.go:1177 +0x135 database/sql.(DB).query(0xc00010a180, 0x7c4c80, 0xc000014098, 0x77d0ef, 0x24, 0x0, 0x0, 0x0, 0xc000076601, 0xc0000426f0, ...) /usr/lib/golang/src/database/sql/sql.go:1514 +0x66 database/sql.(DB).QueryContext(0xc00010a180, 0x7c4c80, 0xc000014098, 0x77d0ef, 0x24, 0x0, 0x0, 0x0, 0x15, 0x7c2140, ...) /usr/lib/golang/src/database/sql/sql.go:1496 +0xd3 database/sql.(DB).Query(0xc00010a180, 0x77d0ef, 0x24, 0x0, 0x0, 0x0, 0x0, 0x9a088a, 0x26) /usr/lib/golang/src/database/sql/sql.go:1510 +0x82 sqlflow.org/gohive.TestQuery(0xc000104200) /home/jimmydeng/go/src/sqlflow.org/gohive/driver_test.go:19 +0x96 testing.tRunner(0xc000104200, 0x789b68) /usr/lib/golang/src/testing/testing.go:827 +0xbf created by testing.(*T).Run /usr/lib/golang/src/testing/testing.go:878 +0x353 exit status 2 FAIL sqlflow.org/gohive 0.071s

typhoonzero commented 5 years ago

Are you running go test in the docker container sqlflow/gohive:dev or on somewhere else?

jimdn commented 5 years ago

Fisrt i downloaded sqlflow.org/gohive and put it to my GOPATH, then I run go test -v in my own HADOOP environment: hadoop-2.7.7 hive-2.3.4 The first TestCase was passed which is testing the connection. But exec db.Query in the next TestCase, it panic.

weiguoz commented 5 years ago

We test gohive in a docker container. ref

TestOpenConnection initializes the configuration but does not connect to the hive server. I would suggest running the TestPing or db.Query to check the connection status.