catopt-query-category-theor.../README.md

1021 B

CatOpt-Query: Category-Theoretic Compositional Optimizer for Distributed Database Query Planning

Overview

  • Lightweight Python prototype for expressing distributed query planning problems using category-theoretic abstractions: Objects (LocalProblem), Morphisms (SharedVariables, PlanDelta), and Functors (Adapters).
  • Provides a canonical representation and a minimal solver to stitch per-shard plans into a global plan with delta-sync semantics.

Project structure

  • catopt_query/protocol.py: protocol models (LocalProblem, SharedVariables, PlanDelta, CanonicalPlan)
  • catopt_query/canonical.py: canonical plan representation
  • catopt_query/adapters.py: adapter scaffolding (vendor -> canonical)
  • catopt_query/solver.py: tiny ADMM-lite style cross-shard planner
  • tests/: pytest-based tests for protocol, adapters, and solver

How to run

  • Run tests: pytest -q
  • Build: python -m build

This repository follows the MVP goals and aims for a production-ready extension, with a focus on clear interfaces and testability.