Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use super::analysis::PlanningContext;
use super::DataFusionPlanner;
use crate::config::{NodeMapping, RelationshipMapping};
use crate::error::Result;
use crate::source_catalog::GraphSourceCatalog;
use lance_graph_catalog::GraphSourceCatalog;
use std::sync::Arc;

impl DataFusionPlanner {
Expand Down
2 changes: 1 addition & 1 deletion crates/lance-graph/src/datafusion_planner/join_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ use crate::ast::{PropertyValue, RelationshipDirection};
use crate::case_insensitive::qualify_column;
use crate::config::{NodeMapping, RelationshipMapping};
use crate::error::Result;
use crate::source_catalog::GraphSourceCatalog;
use datafusion::logical_expr::{
col, BinaryExpr, Expr, JoinType, LogicalPlan, LogicalPlanBuilder, Operator, TableSource,
};
use lance_graph_catalog::GraphSourceCatalog;
use std::collections::HashMap;
use std::sync::Arc;

Expand Down
2 changes: 1 addition & 1 deletion crates/lance-graph/src/datafusion_planner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ pub use analysis::{PlanningContext, QueryAnalysis, RelationshipInstance};
use crate::config::GraphConfig;
use crate::error::Result;
use crate::logical_plan::LogicalOperator;
use crate::source_catalog::GraphSourceCatalog;
use datafusion::logical_expr::LogicalPlan;
use lance_graph_catalog::GraphSourceCatalog;
use std::sync::Arc;

/// Planner abstraction for graph-to-physical planning
Expand Down
4 changes: 2 additions & 2 deletions crates/lance-graph/src/datafusion_planner/scan_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use super::analysis::{PlanningContext, RelationshipInstance};
use crate::ast::PropertyValue;
use crate::case_insensitive::qualify_column;
use crate::error::Result;
use crate::source_catalog::GraphSourceCatalog;
use datafusion::logical_expr::{col, BinaryExpr, Expr, LogicalPlan, LogicalPlanBuilder, Operator};
use lance_graph_catalog::GraphSourceCatalog;
use std::collections::{HashMap, HashSet};
use std::sync::Arc;

Expand Down Expand Up @@ -107,7 +107,7 @@ impl DataFusionPlanner {
// No catalog attached - create empty source fallback for flexibility
// This allows planners created with DataFusionPlanner::new() to work
// without requiring a catalog, though they won't have actual data sources
let empty_source = Arc::new(crate::source_catalog::SimpleTableSource::empty());
let empty_source = Arc::new(lance_graph_catalog::SimpleTableSource::empty());
let normalized_label = label.to_lowercase();
let builder =
LogicalPlanBuilder::scan(&normalized_label, empty_source, None).map_err(|e| {
Expand Down
4 changes: 2 additions & 2 deletions crates/lance-graph/src/datafusion_planner/test_fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

use crate::config::GraphConfig;
use crate::logical_plan::LogicalOperator;
use crate::source_catalog::{InMemoryCatalog, SimpleTableSource};
use arrow_schema::{DataType, Field, Schema};
use lance_graph_catalog::{InMemoryCatalog, SimpleTableSource};
use std::sync::Arc;

pub fn person_schema() -> Arc<Schema> {
Expand All @@ -17,7 +17,7 @@ pub fn person_schema() -> Arc<Schema> {
]))
}

pub fn make_catalog() -> Arc<dyn crate::source_catalog::GraphSourceCatalog> {
pub fn make_catalog() -> Arc<dyn lance_graph_catalog::GraphSourceCatalog> {
let person_src = Arc::new(SimpleTableSource::new(person_schema()));
let knows_schema = Arc::new(Schema::new(vec![
Field::new("src_person_id", DataType::Int64, false),
Expand Down
6 changes: 3 additions & 3 deletions crates/lance-graph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ pub mod error;
pub mod lance_native_planner;
pub mod lance_vector_search;
pub mod logical_plan;
pub mod namespace;
pub mod parser;
pub mod query;
pub mod semantic;
pub mod simple_executor;
pub mod source_catalog;

/// Maximum allowed hops for variable-length relationship expansion (e.g., *1..N)
pub const MAX_VARIABLE_LENGTH_HOPS: u32 = 20;

pub use config::{GraphConfig, NodeMapping, RelationshipMapping};
pub use error::{GraphError, Result};
pub use lance_graph_catalog::{
DirNamespace, GraphSourceCatalog, InMemoryCatalog, SimpleTableSource,
};
pub use lance_vector_search::VectorSearch;
pub use namespace::DirNamespace;
pub use query::{CypherQuery, ExecutionStrategy};
3 changes: 0 additions & 3 deletions crates/lance-graph/src/namespace/directory.rs

This file was deleted.

3 changes: 0 additions & 3 deletions crates/lance-graph/src/namespace/mod.rs

This file was deleted.

22 changes: 11 additions & 11 deletions crates/lance-graph/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ use crate::ast::ReadingClause;
use crate::config::GraphConfig;
use crate::error::{GraphError, Result};
use crate::logical_plan::LogicalPlanner;
use crate::namespace::DirNamespace;
use crate::parser::parse_cypher_query;
use crate::simple_executor::{
to_df_boolean_expr_simple, to_df_order_by_expr_simple, to_df_value_expr_simple, PathExecutor,
};
use arrow_array::RecordBatch;
use arrow_schema::{Field, Schema, SchemaRef};
use lance_graph_catalog::DirNamespace;
use lance_namespace::models::DescribeTableRequest;
use std::collections::{HashMap, HashSet};
use std::sync::Arc;
Expand Down Expand Up @@ -395,8 +395,8 @@ impl CypherQuery {
&self,
ctx: datafusion::execution::context::SessionContext,
) -> Result<arrow::record_batch::RecordBatch> {
use crate::source_catalog::InMemoryCatalog;
use datafusion::datasource::DefaultTableSource;
use lance_graph_catalog::InMemoryCatalog;
use std::sync::Arc;

let config = self.require_config()?;
Expand Down Expand Up @@ -463,7 +463,7 @@ impl CypherQuery {
/// ```ignore
/// use std::sync::Arc;
/// use datafusion::execution::context::SessionContext;
/// use lance_graph::source_catalog::InMemoryCatalog;
/// use lance_graph::InMemoryCatalog;
/// use lance_graph::query::CypherQuery;
///
/// // Create custom catalog
Expand All @@ -481,7 +481,7 @@ impl CypherQuery {
/// ```
pub async fn execute_with_catalog_and_context(
&self,
catalog: std::sync::Arc<dyn crate::source_catalog::GraphSourceCatalog>,
catalog: std::sync::Arc<dyn lance_graph_catalog::GraphSourceCatalog>,
ctx: datafusion::execution::context::SessionContext,
) -> Result<arrow::record_batch::RecordBatch> {
use arrow::compute::concat_batches;
Expand Down Expand Up @@ -557,12 +557,12 @@ impl CypherQuery {
&self,
datasets: HashMap<String, arrow::record_batch::RecordBatch>,
) -> Result<(
crate::source_catalog::InMemoryCatalog,
lance_graph_catalog::InMemoryCatalog,
datafusion::execution::context::SessionContext,
)> {
use crate::source_catalog::InMemoryCatalog;
use datafusion::datasource::{DefaultTableSource, MemTable};
use datafusion::execution::context::SessionContext;
use lance_graph_catalog::InMemoryCatalog;
use std::sync::Arc;

if datasets.is_empty() {
Expand Down Expand Up @@ -619,13 +619,13 @@ impl CypherQuery {
&self,
namespace: std::sync::Arc<dyn lance_namespace::LanceNamespace + Send + Sync>,
) -> Result<(
crate::source_catalog::InMemoryCatalog,
lance_graph_catalog::InMemoryCatalog,
datafusion::execution::context::SessionContext,
)> {
use crate::source_catalog::InMemoryCatalog;
use datafusion::datasource::{DefaultTableSource, TableProvider};
use datafusion::execution::context::SessionContext;
use lance::datafusion::LanceTableProvider;
use lance_graph_catalog::InMemoryCatalog;
use std::sync::Arc;

let config = self.require_config()?;
Expand Down Expand Up @@ -740,7 +740,7 @@ impl CypherQuery {
/// Internal helper to explain the query execution plan with explicit catalog and session context
async fn explain_internal(
&self,
catalog: std::sync::Arc<dyn crate::source_catalog::GraphSourceCatalog>,
catalog: std::sync::Arc<dyn lance_graph_catalog::GraphSourceCatalog>,
ctx: datafusion::execution::context::SessionContext,
) -> Result<String> {
// Create all plans (phases 1-4)
Expand All @@ -757,7 +757,7 @@ impl CypherQuery {
/// DataFusion logical planning) without creating the physical plan.
fn create_logical_plans(
&self,
catalog: std::sync::Arc<dyn crate::source_catalog::GraphSourceCatalog>,
catalog: std::sync::Arc<dyn lance_graph_catalog::GraphSourceCatalog>,
) -> Result<(
crate::logical_plan::LogicalOperator,
datafusion::logical_expr::LogicalPlan,
Expand Down Expand Up @@ -791,7 +791,7 @@ impl CypherQuery {
/// Helper to create all plans (graph logical, DataFusion logical, physical)
async fn create_plans(
&self,
catalog: std::sync::Arc<dyn crate::source_catalog::GraphSourceCatalog>,
catalog: std::sync::Arc<dyn lance_graph_catalog::GraphSourceCatalog>,
ctx: &datafusion::execution::context::SessionContext,
) -> Result<(
crate::logical_plan::LogicalOperator,
Expand Down
4 changes: 0 additions & 4 deletions crates/lance-graph/src/source_catalog.rs

This file was deleted.

5 changes: 2 additions & 3 deletions python/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ use datafusion::execution::context::SessionContext;
use lance_graph::{
ast::DistanceMetric as RustDistanceMetric, CypherQuery as RustCypherQuery,
ExecutionStrategy as RustExecutionStrategy, GraphConfig as RustGraphConfig,
GraphError as RustGraphError, VectorSearch as RustVectorSearch,
GraphError as RustGraphError, VectorSearch as RustVectorSearch, InMemoryCatalog,
};
use lance_graph::source_catalog::InMemoryCatalog;
use pyo3::{
exceptions::{PyNotImplementedError, PyRuntimeError, PyValueError},
prelude::*,
Expand Down Expand Up @@ -919,7 +918,7 @@ fn record_batch_to_python_table(
#[pyclass(name = "CypherEngine", module = "lance.graph")]
pub struct CypherEngine {
config: RustGraphConfig,
catalog: Arc<dyn lance_graph::source_catalog::GraphSourceCatalog>,
catalog: Arc<dyn lance_graph::GraphSourceCatalog>,
context: Arc<datafusion::execution::context::SessionContext>,
}

Expand Down
2 changes: 1 addition & 1 deletion python/src/namespace.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Arc;

use lance_graph::namespace::DirNamespace;
use lance_graph::DirNamespace;
use pyo3::prelude::*;

#[pyclass(name = "DirNamespace", module = "lance.graph")]
Expand Down
Loading