Skip to content

[New Driver] Propose adding a Presto (PrestoDB) driver #230

Description

@jja725

Summary

I'd like to propose adding a Presto (PrestoDB) driver to the ADBC Driver
Foundry, following the same pattern as the existing Trino
driver
: a standalone repo built on
driverbase-go, wrapping a database/sql client
(prestodb/presto-go-client/v2)
via sqlwrapper.

I've built a working prototype at
https://github.com/jja725/adbc-presto by porting the Trino driver's
structure over to the Presto client, and would like to either transfer this
repo into the org (e.g. as adbc-drivers/presto) or use it as the basis for
a fresh PR into a new org repo, whichever the maintainers prefer.

Status

  • Mirrors the adbc-drivers/trino layout: driver core, db_factory.go,
    catalog/schema/statistics introspection, error mapping, cgo shared-library
    packaging (pkg/), a docker-compose + pytest validation suite, and CI
    workflow templates adapted from adbc-drivers/dev.
  • Builds and passes go vet/gofmt cleanly, plus the cgo shared library
    (-tags driverlib -buildmode=c-shared).
  • Full Go integration suite (validation + driver-specific tests, 85 cases)
    passes against prestodb/presto:latest (0.298) in Docker.

Notable differences from the Trino driver (why this isn't just a rename)

  • No current_catalog/current_schema SQL functions in PrestoDB, and
    the Go client doesn't apply X-Presto-Set-Catalog/Schema response
    headers to its session. The driver tracks the current namespace itself
    (validated against system.metadata.catalogs /
    information_schema.schemata) and applies it to new pooled connections
    via presto.WithSessionSetup.
  • PrestoDB does not narrow INSERT literals (e.g. an INTEGER literal
    is rejected for a TINYINT column), so the ingest path wraps
    TINYINT/SMALLINT/REAL/DECIMAL/TIME/DATE/TIMESTAMP WITH TIME ZONE
    parameters in explicit CASTs.
  • Presto TIMESTAMP/TIME have fixed millisecond precision (no
    parameterized precision like Trino), and the client exposes no
    precision/scale/nullability column metadata, so DECIMAL maps to
    string and ARRAY/MAP/ROW map to JSON strings.
  • SHOW STATS has an extra histogram column in PrestoDB; the scan
    tolerates either column count.
  • Error mapping targets presto.QueryError (ErrorType/ErrorName/code
    ranges) and HTTP-level presto.ErrorResponse, since PrestoDB doesn't
    return SQLSTATE.

Open questions for maintainers

  1. Preferred path: transfer jja725/adbc-presto into the org, or open a PR
    against a freshly-created empty adbc-drivers/presto repo?
  2. Module path / driver naming conventions to follow exactly (I used
    github.com/adbc-drivers/presto, driver name presto, matching the
    adbc-drivers/trino conventions).
  3. Any preference on how a PrestoDB driver should relate to the existing
    presto-go-client/v2's dual Presto/Trino support — I kept this driver
    PrestoDB-only and left Trino on trino-go-client in the existing driver,
    since the latter has richer Trino-specific features (typed array
    scanning, progress callbacks, prepared statements) that the shared
    client doesn't provide.

Happy to open the PR once there's a repo to target, or adjust the structure
based on feedback here first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions