Skip to content

v0.12.0

Choose a tag to compare

@kenshaw kenshaw released this 07 Oct 01:54
· 47 commits to main since this release

This release adds the driver trino, for Trino and Presto. No other driver changes for a caller.

New

  • Trino and Presto. The package trino runs SQL on Trino and on Presto through POST /v1/statement, measured on Trino 476 and 483 and on Presto 0.299. One driver serves both, and Presto is a flavor. The driver tells the flavor from what the server says, and the key flavor can set it (D173 and D175).
  • DSN. The DSN is trino://user@host:8080/catalog/schema. The keys are tls, source, timezone, timeout, flavor and session.<name>, and the last one sets a property of the session.
  • Reading. A query follows nextUri page by page and decodes each row as it arrives. An error that comes before any row is the error of QueryContext.
  • Parameters. The servers take no bound parameter in a statement, so the driver writes each argument as a literal in a prepared statement and sends EXECUTE name USING ....
  • Transactions. BeginTx starts a transaction of the server, and the driver carries its id in the header of each statement.
  • Cancel. The server runs a query on when its client leaves. The driver sends DELETE to the nextUri when the context ends and when the caller closes the rows early. A DELETE aborts a transaction on Trino, so a connection that holds a transaction reads up to four small pages in place of the DELETE.
  • Types. A DECIMAL is an *apd.Decimal, and so is the NUMBER of Trino 483. A time is a time.Time or one of the types of the root package. An ARRAY is a []any, a MAP is a map[string]any, and a ROW is a []any in the order of its fields. Both flavors give the same Go values, although Presto sends these types as JSON text. A time with picoseconds loses the digits beyond the ninth only when they are all zero, and fails when one is not zero (D175).

What a caller must know

  • A []any argument is an ARRAY. To send a ROW, write CAST(JSON_PARSE(?) AS row(...)) and pass JSON text. The driver has no Row type. The names of the fields of a ROW are in the type name of the column, and docs/TRINO.md lists the options to read them later.
  • The memory catalog of the test images refuses UPDATE, DELETE and MERGE, and Presto refuses TRUNCATE there. The integration tests of these statements wait for a catalog that supports them.
  • A zero dbimp.Interval is an INTERVAL DAY TO SECOND, so it cannot go into a YEAR TO MONTH column.

Other changes

  • The command dbimptest/cmd/record follows an absolute nextUri and can keep a header of a response with the capture header:<name>.
  • Hard rule 4 of AGENTS.md now lists the Trino transaction and the rows of a Trino query among the types that keep a context (D175).
  • ClickHouse is started in docs/CLICKHOUSE.md and D174. It has no driver yet.

Tests

CI passed all 30 jobs on the tagged commit, which includes the integration jobs of Trino 476 and 483 and of Presto 0.299, and the quick round trip of Druid.