8000
Skip to content

Releases: prestodb/presto-go-client

v2.1.1

25 Mar 06:27

Choose a tag to compare

What's Changed

Refactoring

  • Replace initialized atomic.Bool + client *Client with atomic.Pointer[Client] in connector, eliminating redundant state
  • Remove unreachable *net.OpError fallback in isRetryableNetError
  • Simplify PrepareForInsert to collect and sort once
  • Improve error messages for duration and SI size types (include got %T)
  • Use strings.IndexByte instead of bytes.IndexByte([]byte(...)) to avoid allocation

Dependencies

  • go-colorable v0.1.13 → v0.1.14
  • golang.org/x/sys v0.35.0 → v0.42.0
  • golang.org/x/crypto v0.45.0 → v0.49.0
  • golang.org/x/net v0.47.0 → v0.52.0
  • golang.org/x/oauth2 v0.27.0 → v0.36.0

Full Changelog: v2.1.0...v2.1.1

v2.1.0

25 Mar 06:16

Choose a tag to compare

What's Changed

Breaking Changes

  • query_json package renamed to queryjson — update import paths from github.com/prestodb/presto-go-client/v2/query_json to github.com/prestodb/presto-go-client/v2/queryjson

Features

  • Handle X-Presto-Set-Session and X-Presto-Clear-Session response headers

Bug Fixes

  • Fix race condition on MockPrestoServer.defaultLatency (converted to atomic.Int64)
  • Fix PrepareForInsert error-path idempotency (deferred nil-out pattern)
  • Make Session.PrepareForInsert output deterministic (sorted keys)
  • Fix drain processing for initial query batch
  • Eliminate nested lock ordering between session mu and clientMu
  • Replace sync.Once with retryable init for connector, fix interval parsing
  • Add nil receiver guard to Session.PrepareForInsert
  • Improve error messages for duration and SI size types (include got %T)
  • Use strings.IndexByte instead of bytes.IndexByte([]byte(...)) to avoid allocation
  • Remove unreachable *net.OpError fallback in isRetryableNetError

Refactoring

  • Replace initialized atomic.Bool + client *Client with atomic.Pointer[Client] in connector
  • Simplify PrepareForInsert to collect and sort once

Testing & Documentation

  • Coverage increased from 80% to 87.7%
  • Added UpdateCount field to MockQueryTemplate
  • Added tests for deprecated driver paths (Stmt.Exec, Stmt.Query, Conn.Begin)
  • Added tests for Source, Open, Driver(), WithHTTPClient
  • Documented isRetryableNetError network timeout retry behavior
  • Improved ensureClient double-checked locking comment with Go memory model citation

v2.0.1

19 Mar 07:49

Choose a tag to compare

Fix concurrency, error handling, and correctness issues identified during code review.

v2.0.0

15 Mar 20:52
c2f878c

Choose a tag to compare

presto-go-client v2.0.0

A complete rewrite of the Presto Go client library, implementing RFC-0022. This release replaces the legacy v1 client with a modern, modular architecture built on current Go best practices.

Highlights

  • Low-level REST API client — direct access to /v1/statement, /v1/query/{queryId}, /v1/queryState/{queryId}, and /v1/cluster endpoints
  • database/sql driver — standard Go database API with full DSN parsing, parameter interpolation, and transaction support (all four Presto isolation levels + read-only mode)
  • Trino compatibility — automatic header translation when using the trino:// DSN scheme
  • Session management — isolated, cloneable, thread-safe sessions with fluent configuration API
  • Batch result streaming — memory-efficient Drain API
  • Query info/stats parsing — the query_json subpackage provides structured Go types for complete Presto query information, including derived metrics and flattened stage hierarchies

Authentication

Authentication is fully modular — opt-in via separate Go modules to avoid dependency bloat:

  • Kerberos/SPNEGO (prestoauth/kerberos) — keytab-based authentication via gokrb5
  • OAuth2/JWT (prestoauth/oauth2) — static bearer tokens or client credentials flow with automatic token refresh

TLS

Full TLS configuration support including custom CA certificates, mutual TLS (client cert + key), and skip-verify mode. HTTPS is automatically enabled when any ssl_* DSN parameter is set.

Type System

Generic complex type scanners eliminate the need for dozens of explicit scanner types:

  • NullSlice[T] for ARRAY columns
  • NullMap[K, V] for MAP columns
  • NullRow[T] for ROW columns (struct scanning)
  • INTERVAL DAY TO SECOND parses directly to time.Duration

Testing

  • prestotest package provides MockPrestoServer — a stdlib-only mock for hermetic unit testing without a real Presto cluster
  • CI enforces 80% coverage, race detection, static analysis, and vulnerability scanning

Other Improvements over v1

  • Automatic retry with exponential backoff on 503 and transient network errors
  • Request body buffering for safe retry replay
  • Proper HTTP response body cleanup (no resource leaks)
  • Thread-safe header mutations
  • Gzip request/response compression
  • Pre-minted query ID support

Installation

go get github.com/prestodb/presto-go-client/v2

Optional authentication modules:

go get github.com/prestodb/presto-go-client/v2/prestoauth/kerberos
go get github.com/prestodb/presto-go-client/v2/prestoauth/oauth2

Migration from v1

The v2 client uses a new module path (github.com/prestodb/presto-go-client/v2). The v1 client remains available at the v1.0.0 release.

v1.0.0

15 Mar 20:46
905ac40

Choose a tag to compare

Final release of the v1 presto-go-client. For the v2 rewrite, see the main branch.

0