Skip to content

lance-format/lance-trino

Repository files navigation

Trino Lance Connector

A Trino connector for reading Lance format data. This connector allows Trino to query Lance datasets directly.

Configuration

Create a catalog properties file (e.g., etc/catalog/lance.properties):

Configuration Properties

Property Description Default
lance.impl Namespace implementation: dir, rest, glue, hive2, hive3, or full class name dir
lance.connection_timeout Connection timeout duration 1m
lance.connection_retry_count Number of retries for failed connections 5

Any other lance.* properties are stripped of the lance. prefix and passed to the namespace implementation.

Directory Namespace Properties

connector.name=lance
lance.impl=dir
lance.root=/path/to/warehouse
lance.storage.timeout=30s
lance.storage.retry-count=3

REST Namespace Properties

connector.name=lance
lance.impl=rest
lance.uri=https://api.lancedb.com
lance.tls.enabled=true
lance.header.Authorization=Bearer <token>

Usage

Once configured, you can query Lance data using SQL:

-- List schemas
SHOW SCHEMAS FROM lance;

-- List tables
SHOW TABLES FROM lance.default;

-- Describe table schema
DESCRIBE lance.default.my_dataset;

-- Query a Lance dataset
SELECT * FROM lance.default.my_dataset;

-- Query with filtering and projection
SELECT id, name, value
FROM lance.default.my_dataset
WHERE value > 100
ORDER BY id
LIMIT 10;

-- Aggregations
SELECT category, COUNT(*), AVG(value)
FROM lance.default.my_dataset
GROUP BY category;

Building

Build the connector:

make install

Other available commands:

make help      # Show all available commands
make build     # Compile and package
make test      # Run tests
make compile   # Compile only
make package   # Package without tests
make clean     # Clean build artifacts
make verify    # Full verification
make run       # Run development server
make lint      # Run code style checks (checkstyle, modernizer, sortpom)
make format    # Format pom.xml files
make check     # Run all checks without tests

Installation

  1. Build the connector using Maven
  2. Copy the generated plugin directory from plugin/trino-lance/target/trino-lance-<version>/ to your Trino plugins directory (e.g., /usr/lib/trino/plugin/lance/)
  3. Configure the connector in your Trino catalog properties
  4. Restart Trino

Development Guide

Project Structure

Everything in this repository apart from the plugin/trino-lance mimics the layout of the Trino project. For example, the root pom file is a copy of the Trino root pom file with exactly the same content. We periodically upgrade the Trino version to stay up to date with the latest Trino features.

Running Tests

make test

Running the Query Runner (Development Server)

You can run a local Trino server for development:

make run

This starts a Trino server on port 8080 with the Lance connector configured.

Requirements

  • Java 23 or later
  • Trino 476 or compatible version

License

Apache License 2.0

About

Trino Lance Connector

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 4

  •  
  •  
  •  
  •