Skip to content

v0.10.0

Choose a tag to compare

@kenshaw kenshaw released this 01 Oct 01:12
· 63 commits to main since this release

This release adds the driver avatica, for Apache Calcite Avatica and the Apache Phoenix Query Server. The drivers libsql and databend each get one fix in how a transaction ends.

New

  • Avatica. The package avatica runs SQL on the standalone server of Avatica and on the Phoenix Query Server, over the JSON protocol of Avatica. It was measured on Avatica 1.28.0 and 1.29.0, which run HSQLDB, and on Phoenix 2.0-5.0. The driver speaks JSON only (D153). Apache Druid will get a driver of its own (D154).
  • DSN. The DSN is avatica://user:password@host:port, with the default port 8765, no path, and the keys tls and auth (D156). The user and the password go in the info of openConnection. auth=basic also sends them by HTTP basic authentication.
  • Reading. One connection of database/sql is one connection of Avatica, with autoCommit on. A query reads its rows in frames, one token at a time, and fetches each next frame. WithFrameSize sets the size of a frame, 1000 rows by default. An error in a later frame wraps dbimp.ErrIncomplete (D157).
  • Types. A value has the Go type of the name of its type of JDBC: int64, *apd.Decimal with every digit, float64, bool, string, []byte, dbimp.Date, dbimp.LocalTime, dbimp.LocalDateTime, dbimp.Interval, []any and uuid.UUID (D155).
  • Arguments. A statement with arguments goes as prepare and execute, with a typed value for each argument. The driver refuses a count of arguments that is not the count of the parameters, because the server binds a missing one as NULL. A decimal goes as text. Each character outside ASCII goes as an escape of JSON, because the Phoenix Query Server misreads raw UTF-8 (D158).
  • Transactions. BeginTx turns autoCommit off, and sends ReadOnly and the isolation level. The end of a transaction sets autoCommit, readOnly and the isolation level back (D159).

What a caller must know

  • Nothing stops a statement on the server. When the context of a query ends, the driver stops the read and closes the statement, but the server runs the statement to its end (D159). WithTimeout above zero fails with dbimp.ErrNotSupported.
  • LastInsertId fails with dbimp.ErrNotSupported, because Avatica gives no id.
  • A DATE before 1582-10-15 arrives in the Julian calendar of Java, and the driver reads it in the Gregorian calendar. The driver binds no array and no interval (D160).
  • The server cannot write TIMESTAMP WITH TIME ZONE, TIME WITH TIME ZONE, CLOB or BLOB in JSON, and fails the whole answer for them.
  • Phoenix writes with UPSERT, and refuses INSERT and UPDATE. It stores an empty string as NULL, and reads a NULL in a BINARY column as zero bytes.

Fixes

  • libSQL. When the context of a transaction ended, database/sql rolled it back, but the context stopped the ROLLBACK before it reached the server. The server then held the transaction and the write lock of SQLite until the stream expired after 10 seconds. The ROLLBACK now reaches the server (D150).
  • Databend. The Commit of a failed transaction sent its ROLLBACK with no time limit, so a server that did not answer could block Commit. The ROLLBACK now has a limit of 5 seconds, and its error joins the error of Commit (D122).

Other changes

  • The workflow also tests each product whose release the manifest of a driver recorded, so Phoenix runs the tests of avatica (D161).
  • The workflow pins dbmeta at 585a1f8, which starts the Avatica and Phoenix servers with JSON.
  • The record command can capture a number or an object, and writes each password in a body as REDACTED.