Skip to content

Releases

v0.26.1

Choose a tag to compare

@kenshaw kenshaw released this 09 Nov 00:19

This release makes the hive driver name a column of Hive as the statement writes it (W56).

Hive names a column of a table with the name of the table in front, as t.id, because hive.resultset.use.unique.column.names is true by default. A tool that writes the names of the columns into an INSERT, such as \copy of usql, then failed on Hive. The driver now sends that key as false in the confOverlay of each statement when the server says that it is Hive. select * from t names the columns id and name, and a join of two tables that each have id names them id and id_1. Impala is not changed. The key changes no state of the session, and WithParameter("hive.resultset.use.unique.column.names", true) restores the old names for one statement. The rule is in D237.

The recordings in testdata/hive/ now carry the names that dbrun gives the entries, hive-4.2.1, hive-4.0.1, impala-4.5.3 and impala-4.4.1, and the Hive recordings hold the new key. The usql session reported the fault after it checked v0.26.0 against Hive 4.2.1.

v0.26.0

Choose a tag to compare

@kenshaw kenshaw released this 08 Nov 23:25

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.

v0.25.2

Choose a tag to compare

@kenshaw kenshaw released this 08 Nov 02:17

The Trino ErrVerbose leaves the position out of its message when it writes the LINE line.

Trino writes line 2:3: before the text of an error. ErrVerbose shows the same place in the LINE line and the caret, so the message on the first line repeated it. The first line now has the message without that prefix. The prefix stays when the query is empty, and when it names another place.

dbimp.Position now returns an empty string for an empty query.

The usql session suggested the change after it checked v0.25.1 against Trino 476. The rule is in D231.

v0.25.1

Choose a tag to compare

@kenshaw kenshaw released this 08 Nov 02:06

ErrVerbose now writes the layout of psql, so that \errverbose of usql looks the same for every database.

  • The first line is ERROR: and two spaces, then the code and the message. A server that gives a line and a column gets the line of the query and a caret under the column. Each other field follows as its name in upper case, a colon, two spaces and the value.
  • Change dbimp.Verbose to write this layout, and add dbimp.Position for the line and the caret.
  • Rewrite the method of the 27 drivers and of the response errors of couchbase, neo4j and surrealdb. The code of a driver goes on the first line, the name of a code goes in DETAIL, and a stack trace goes in CONTEXT.

The decision is D231, and the work item is W55.

v0.25.0

Choose a tag to compare

@kenshaw kenshaw released this 08 Nov 01:44

The error of each driver now has a method ErrVerbose(query string) string, for the command \errverbose of usql.

usql cannot name the error types of this module, so it reads the method through an interface that it declares itself, on any error in the chain.

  • Add dbimp.Verbose. It writes the message, and then each field that has a value, one on each line.
  • Add ErrVerbose to the error type of each of the 27 drivers, and to ResponseError of couchbase, neo4j and surrealdb. It returns an empty string when the server sent nothing but the message, so usql prints the error as before.
  • Make the gate of step 12 fail for an exported error type that has no such method.

The decision is D230, and the work item is W54.

v0.24.3

Choose a tag to compare

@kenshaw kenshaw released this 04 Nov 05:02

A decimal now scans into a type that has the method Compose.

A driver that implements driver.RowsColumnScanner replaces convertAssign of database/sql. dbimp.Assign then turned a decimal into text, so a scan into a type with Compose failed with "unsupported Scan". The cassandra session found this.

  • Assign now calls dest.Compose(src.Decompose(nil)) for an *apd.Decimal source and a destination with Compose, as convertAssign does. The value keeps its scale.

The decision is D229, and the work item is W53.

v0.24.2

Choose a tag to compare

@kenshaw kenshaw released this 04 Nov 02:43

A decimal now has the scale of its column.

ClickHouse and Exasol sent a decimal without its trailing zeros, so 1.50 of a Decimal(9, 2) column arrived as 1.5. A caller that prints each digit of the value, such as usql with tblfmt, printed 1.5.

  • Add dbimp.PadScale. It gives a value the exponent that is minus the scale of its column. It never rounds and never drops a digit.
  • Call it in clickhouse and exasol, where the fault was measured, and in avatica, databend, databricks, drill, maxcompute, snowflake, athena and trino, where it changes no recorded value.
  • bigquery and spanner do not pad, because NUMERIC has a fixed scale of 9 on the server.

The decision is D228, and the work item is W52.

v0.24.1

Choose a tag to compare

@kenshaw kenshaw released this 02 Nov 23:19

This release fixes a flaky test and improves documents.

  • The doc comment of tablestore CreateIndex says when SHOW INDEX lists the index: only after WithBaseData(false), and only when the table is mapped after the index exists. DescribeTable always names the index.
  • TestDeadlineInterruptsABlockedWrite no longer fails on a busy runner.
  • D220, D221 and D224 are decided.

v0.24.0

Choose a tag to compare

@kenshaw kenshaw released this 01 Nov 22:58

The error of each driver now says whether the server refused the credential, with a method.

  • dbimp.Error, *dbimp.StatusError and the error type of each of the 27 drivers have the method AuthenticationRefused() bool.
  • The method returns what Is reports for dbimp.ErrAuthentication. It is true for a wrong password, key or token. It is false for a refusal for lack of a permission, a locked account, an expired password, and a network or TLS failure.
  • A caller that does not import dbimp can read the method through an interface of its own. To find it, walk the whole tree of the error through Unwrap() error and Unwrap() []error, because errors.As stops at the first error that has the method. Wrap with %w, because %v hides it.
  • ErrAuthentication and the Is methods stay.
  • The gate of step 12 fails for a type that matches ErrAuthentication and has no such method (D227, W51).

v0.23.1

Choose a tag to compare

@kenshaw kenshaw released this 01 Nov 21:51

This release changes documents only. No code changes.

  • The README lists the maxcompute and tablestore drivers.
  • The README links the drivers that have their own repositories: xo/cassandra, xo/odbc and xo/oracle.
  • docs/TARGETS.md and docs/PROGRESS.md match the state of the drivers.
⌂ 换网址