Repository navigation
v0.26.0
This release adds the hive driver for Apache Hive and Apache Impala (W56). It is the 28th driver.
db, err := sql.Open("hive", "hive://hive:secret@localhost:10001")The driver speaks the Thrift service of HiveServer2 over HTTP, in the binary protocol of Thrift. The root package writes that protocol with the standard library, so the module gains no dependency. One registered name, hive, serves both products. The driver asks the server for its name and release with GetInfo, and never reads them from the DSN. The DSN is hive://user:password@host:port/database?httpPath=cliservice&tls=false. The default port is 10001 (Hive over HTTP), and a caller of Impala names its HTTP port, 28000 in dbrun.
A connection is one session, and a statement is an operation that the driver waits for. A result arrives in pages of columns, and the driver reads one page at a time. When a context ends, the driver sends CancelOperation and closes the operation. The servers bind no parameter, so the driver writes each argument into the statement as a literal. The driver has no transactions, and BeginTx returns dbimp.ErrNotSupported.
Values have the Go type of their type. A decimal is an *apd.Decimal with the scale of its column. A date is dbimp.Date, and a timestamp is dbimp.LocalDateTime. An array, a map and a struct are decoded from the JSON text that Hive sends. Hive says how many rows a statement changed, and Impala does not, so RowsAffected returns dbimp.ErrNotSupported on Impala.
The recordings and the survey are in testdata/hive/ for Hive 4.2.1 and 4.0.1 and Impala 4.5.3 and 4.4.1. The integration tests pass on all four. Hive 4.0.1 refuses ACID tables as dbrun starts it, so the tests that need one skip there.
The root package has a Thrift codec (ThriftDecoder and ThriftEncoder), and dbimptest has ThriftContract and a Thrift mode in the recorder. The recorder now masks a secret in a binary body to the same length, so that a message of Thrift stays valid.
docs/HIVE.md holds what is known about both servers. The decisions are D232 to D236. D236 adds the Hive connection and its rows to the places where rule 4 allows a context.