ruvector/crates/ruvector-postgres/tests/pgvector_compat/mod.rs
rUv 367a4917cc feat(ruvector-postgres): Complete v2.0.0 with 148 SQL functions
## Summary
Complete RuVector-Postgres v2 implementation with all major features:
- 148 pg_extern SQL functions across 27 source files
- Docker Hub publication ready with multi-arch builds (PG14-17)
- Full pgvector drop-in compatibility verified

## New Features
- **Hybrid Search** (7 functions): BM25 + vector fusion with RRF/linear/learned
- **Multi-Tenancy** (17 functions): Tenant isolation, RLS, quotas
- **Self-Healing** (23 functions): Problem detection, remediation strategies
- **Integrity Control** (4 functions): Mincut gating, contracted graphs
- **Self-Learning** (10 functions): Query trajectory tracking, optimization

## Infrastructure
- GitHub Actions workflow for Docker Hub publication
- CI workflow for testing PG14-17
- Integration test Docker setup with baseline testing
- Benchmark suite for e2e, hybrid, integrity testing

## Files Changed
- New: src/healing/, src/hybrid/, src/integrity/, src/tenancy/, src/workers/
- New: sql/ruvector--2.0.0.sql (SQL migration)
- New: docker/publish-dockerhub.sh, docker-compose.integration.yml
- Updated: Dockerfile for PG17 default, multi-arch builds
- Updated: HNSW/IVFFlat index access methods with full pgrx AM support

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 23:41:29 +00:00

50 lines
1.7 KiB
Rust

//! pgvector Drop-In Compatibility Test Suite for RuVector Postgres v2
//!
//! This module provides comprehensive validation that RuVector is a 100% compatible
//! drop-in replacement for pgvector. Tests cover:
//!
//! 1. Type Compatibility - vector(n), halfvec(n), sparsevec types
//! 2. Operator Compatibility - <->, <#>, <=>, +, -, * operators
//! 3. Function Compatibility - l2_distance, inner_product, cosine_distance, etc.
//! 4. Index Compatibility - HNSW and IVFFlat with all WITH options
//! 5. Query Compatibility - ORDER BY, LIMIT, WHERE clauses
//!
//! ## Running Tests
//!
//! ```bash
//! # Run all pgvector compatibility tests
//! cargo pgrx test pgvector_compat
//!
//! # Run the comparison harness against both pgvector and ruvector
//! ./tests/pgvector_compat/run_comparison.sh
//! ```
//!
//! ## Test Categories
//!
//! - `types.rs` - Vector type creation, casting, and storage
//! - `operators.rs` - Distance operators and vector arithmetic
//! - `functions.rs` - SQL function compatibility
//! - `indexes.rs` - Index creation and usage
//! - `queries.rs` - Complex query patterns
//! - `edge_cases.rs` - Boundary conditions and error handling
//! - `comparison.rs` - Side-by-side pgvector/ruvector comparison
pub mod types;
pub mod operators;
pub mod functions;
pub mod indexes;
pub mod queries;
pub mod edge_cases;
pub mod comparison;
/// Version of pgvector API we are compatible with
pub const PGVECTOR_COMPAT_VERSION: &str = "0.7.0";
/// Maximum supported dimensions (matches pgvector)
pub const MAX_DIMENSIONS: usize = 16_000;
/// Epsilon for floating-point comparisons
pub const FLOAT_EPSILON: f32 = 1e-5;
/// Test precision epsilon (slightly looser for SIMD variations)
pub const TEST_EPSILON: f32 = 1e-4;