Skip to main content

Crate lance_graph

Crate lance_graph 

Source
Expand description

Lance Graph Query Engine

This crate provides graph query capabilities for Lance datasets using Cypher syntax. It interprets Lance datasets as property graphs and translates Cypher queries into DataFusion SQL queries for execution.

§Features

  • Cypher query parsing and AST representation
  • Graph pattern matching on columnar data
  • Property graph interpretation of Lance datasets
  • Translation to optimized SQL via DataFusion
  • Support for nodes, relationships, and properties

§Example

use lance_graph::{CypherQuery, GraphConfig, Result};

let config = GraphConfig::builder()
    .with_node_label("Person", "person_id")
    .with_relationship("KNOWS", "src_person_id", "dst_person_id")
    .build()?;

let query = CypherQuery::new("MATCH (p:Person) WHERE p.age > 30 RETURN p.name")?
    .with_config(config);

// Execute against a dataset (would need actual dataset integration)
// let results = query.execute(&dataset).await?;

Re-exports§

pub use config::GraphConfig;
pub use config::NodeMapping;
pub use config::RelationshipMapping;
pub use error::GraphError;
pub use error::Result;
pub use lance_vector_search::VectorSearch;
pub use query::CypherQuery;
pub use query::ExecutionStrategy;
pub use sql_query::SqlQuery;
pub use table_readers::DeltaTableReader;
pub use table_readers::default_table_readers;
pub use table_readers::ParquetTableReader;

Modules§

ast
Abstract Syntax Tree for Cypher queries
case_insensitive
Case-insensitive string utilities
config
Graph configuration for mapping Lance datasets to property graphs
datafusion_planner
DataFusion-based physical planner for graph queries
error
Error types for the Lance graph query engine
lance_native_planner
Lance Native physical planner (placeholder)
lance_vector_search
Lance Vector Search API for lance-graph
logical_plan
Logical planning for graph queries
parameter_substitution
parser
Cypher query parser
query
High-level Cypher query interface for Lance datasets
semantic
Semantic analysis for graph queries
sql_catalog
Bridge between catalog connectors and the SQL query engine.
sql_query
Direct SQL query interface for Lance datasets
table_readers
Built-in TableReader implementations for common data formats.

Structs§

CatalogInfo
Metadata about a catalog (top-level namespace).
ColumnInfo
Metadata about a column in a table.
Connector
Bundles a CatalogProvider with TableReaders for convenient use.
DirNamespace
A namespace that resolves table names relative to a base directory or URI.
InMemoryCatalog
A simple in-memory catalog useful for tests and bootstrap wiring.
SchemaInfo
Metadata about a schema (second-level namespace within a catalog).
SimpleTableSource
A trivial logical table source with a fixed schema.
TableInfo
Full table metadata including columns and storage information.
UnityCatalogConfig
Configuration for connecting to a Unity Catalog server.
UnityCatalogProvider
Unity Catalog REST API client.

Enums§

CatalogError
Errors that can occur during catalog operations.
DataSourceFormat
Data format of the underlying storage.
TableType
Type of table (managed vs external).

Constants§

MAX_VARIABLE_LENGTH_HOPS
Maximum allowed hops for variable-length relationship expansion (e.g., *1..N)

Traits§

CatalogProvider
Abstract trait for browsing an external catalog.
GraphSourceCatalog
A minimal catalog to resolve node labels and relationship types to logical table sources.
TableReader
Reads table data in a specific format and registers it into a DataFusion SessionContext.

Type Aliases§

CatalogResult