pub mod error;
pub mod error_context;
pub mod type_checker;
pub mod types;
pub mod ast;
pub mod cascade;
pub mod compiler;
pub mod context;
pub mod executor;
pub mod optimizer;
pub mod parser;
pub mod validator;
pub mod ir;
pub mod runtime;
pub mod builder;
pub mod documentation;
pub mod utils;
pub use error::{HyperQLError, Result};
pub use types::*;
pub use ast::{Expression, SelectStatement, Statement};
pub use compiler::{CompiledQuery, Compiler};
pub use executor::{Executor, MemoryDataSource};
pub use type_checker::{TypeChecker, TypeInfo, TypeContext};
pub use optimizer::{QueryOptimizer, OptimizerConfig, OptimizationStats};
pub use validator::{QueryValidator, ValidationConfig, ValidationResult, ValidationError, ValidationWarning};
pub use builder::HyperQLBuilder;
pub use documentation::{HyperQLExamples, HyperQLSyntax};
pub use utils::query_utils;
#[cfg(test)]
mod integration_tests {
use super::*;
use std::collections::HashMap;
#[test]
fn test_end_to_end_select_where_functionality() {
let mut data_source = MemoryDataSource::new();
let mut alice = Entity {
id: EntityId("alice_001".to_string()),
properties: HashMap::new(),
position: Some(Position3D {
x: 1.0,
y: 2.0,
z: 3.0,
}),
embedding: None,
};
alice.properties.insert(
PropertyName("name".to_string()),
Value::String("Alice".to_string()),
);
alice
.properties
.insert(PropertyName("age".to_string()), Value::Int(30));
alice
.properties
.insert(PropertyName("active".to_string()), Value::Bool(true));
let mut bob = Entity {
id: EntityId("bob_002".to_string()),
properties: HashMap::new(),
position: Some(Position3D {
x: 4.0,
y: 5.0,
z: 6.0,
}),
embedding: None,
};
bob.properties.insert(
PropertyName("name".to_string()),
Value::String("Bob".to_string()),
);
bob.properties
.insert(PropertyName("age".to_string()), Value::Int(25));
bob.properties
.insert(PropertyName("active".to_string()), Value::Bool(false));
let mut charlie = Entity {
id: EntityId("charlie_003".to_string()),
properties: HashMap::new(),
position: None,
embedding: None,
};
charlie.properties.insert(
PropertyName("name".to_string()),
Value::String("Charlie".to_string()),
);
charlie
.properties
.insert(PropertyName("age".to_string()), Value::Int(35));
data_source.add_entities("entities", vec![alice, bob, charlie]);
let mut executor = Executor::new(Box::new(data_source));
let compiler = Compiler::new();
println!("Testing: SELECT * FROM entities WHERE name = 'Alice'");
let query1 = "SELECT * FROM entities WHERE name = 'Alice'";
let statement1 = parse_statement(query1).expect("Query should parse");
let compiled1 = compiler.compile(statement1).expect("Query should compile");
let result1 = executor.execute(compiled1).expect("Query should execute");
assert_eq!(result1.rows.len(), 1, "Should return exactly one row");
assert_eq!(
result1.rows[0].columns.get("name"),
Some(&Value::String("Alice".to_string()))
);
assert_eq!(result1.rows[0].columns.get("age"), Some(&Value::Int(30)));
assert_eq!(
result1.rows[0].columns.get("active"),
Some(&Value::Bool(true))
);
println!("✓ Successfully filtered by name = 'Alice'");
println!("\nTesting: SELECT name, age FROM entities WHERE age > 30");
let query2 = "SELECT name, age FROM entities WHERE age > 30";
let statement2 = parse_statement(query2).expect("Query should parse");
let compiled2 = compiler.compile(statement2).expect("Query should compile");
let result2 = executor.execute(compiled2).expect("Query should execute");
assert_eq!(result2.rows.len(), 1, "Should return exactly one row");
assert_eq!(
result2.rows[0].columns.get("name"),
Some(&Value::String("Charlie".to_string()))
);
assert_eq!(result2.rows[0].columns.get("age"), Some(&Value::Int(35)));
assert_eq!(
result2.rows[0].columns.len(),
2,
"Should only have name and age columns"
);
println!("✓ Successfully projected specific columns and filtered by age > 30");
println!("\nTesting: SELECT * FROM entities ORDER BY age DESC LIMIT 2");
let query3 = "SELECT * FROM entities ORDER BY age DESC LIMIT 2";
let statement3 = parse_statement(query3).expect("Query should parse");
let compiled3 = compiler.compile(statement3).expect("Query should compile");
let result3 = executor.execute(compiled3).expect("Query should execute");
assert_eq!(result3.rows.len(), 2, "Should return exactly two rows");
assert_eq!(
result3.rows[0].columns.get("name"),
Some(&Value::String("Charlie".to_string()))
);
assert_eq!(
result3.rows[1].columns.get("name"),
Some(&Value::String("Alice".to_string()))
);
println!("✓ Successfully ordered by age DESC and limited to 2 results");
println!("\nTesting: SELECT name FROM entities WHERE age > 20 AND age < 35");
let query4 = "SELECT name FROM entities WHERE age > 20 AND age < 35";
let statement4 = parse_statement(query4).expect("Query should parse");
let compiled4 = compiler.compile(statement4).expect("Query should compile");
let result4 = executor.execute(compiled4).expect("Query should execute");
assert_eq!(result4.rows.len(), 2, "Should return Alice and Bob");
let names: Vec<String> = result4
.rows
.iter()
.map(|row| match row.columns.get("name") {
Some(Value::String(name)) => name.clone(),
_ => "Unknown".to_string(),
})
.collect();
assert!(names.contains(&"Alice".to_string()));
assert!(names.contains(&"Bob".to_string()));
println!("✓ Successfully used AND condition in WHERE clause");
println!("\nExecution Statistics:");
println!(
"- Entities scanned: {}",
result4.execution_stats.entities_scanned
);
println!(
"- Execution time: {}ms",
result4.execution_stats.execution_time_ms
);
println!(
"\n🎉 All end-to-end tests passed! HyperQL basic SELECT WHERE functionality is working."
);
}
#[test]
fn test_type_checker_integration() {
use crate::ast::{BinaryOperator, ColumnRef, Literal};
use crate::type_checker::TypeChecker;
println!("Testing type checker integration...");
let mut type_checker = TypeChecker::new();
let expr = Expression::Binary {
left: Box::new(Expression::Literal(Literal::Int(42))),
op: BinaryOperator::Add,
right: Box::new(Expression::Literal(Literal::Float(std::f64::consts::PI))),
};
let result_type = type_checker
.check_expression_type(&expr)
.expect("Should type check successfully");
assert_eq!(
result_type,
TypeInfo::Float,
"Int + Float should result in Float"
);
println!("✓ Basic arithmetic type promotion works");
let left = Expression::Literal(Literal::String("hello".to_string()));
let right = Expression::Literal(Literal::Int(42));
let result =
type_checker.check_operation_compatibility(&left, &BinaryOperator::Add, &right);
assert!(result.is_err(), "String + Int should be a type error");
println!("✓ Type incompatibility detection works");
let sum_result = type_checker
.check_function_type("SUM", &[Expression::Literal(Literal::Int(100))])
.expect("SUM should work on integers");
assert_eq!(sum_result, TypeInfo::Integer);
println!("✓ Function type checking works");
let where_expr = Expression::Binary {
left: Box::new(Expression::Column(ColumnRef {
table: None,
name: "age".to_string(),
})),
op: BinaryOperator::GreaterThan,
right: Box::new(Expression::Literal(Literal::Int(21))),
};
let result = type_checker.check_where_clause(&where_expr);
assert!(result.is_ok(), "Valid WHERE clause should pass");
println!("✓ WHERE clause validation works");
println!("\n🎉 Type checker integration tests passed!");
}
#[test]
fn test_query_plan_generation() {
use std::collections::HashMap;
println!("Testing query plan generation...");
let mut data_source = MemoryDataSource::new();
let mut alice = Entity {
id: EntityId("alice_001".to_string()),
properties: HashMap::new(),
position: Some(Position3D {
x: 1.0,
y: 2.0,
z: 3.0,
}),
embedding: None,
};
alice.properties.insert(
PropertyName("name".to_string()),
Value::String("Alice".to_string()),
);
alice
.properties
.insert(PropertyName("age".to_string()), Value::Int(30));
data_source.add_entity("entities", alice);
let mut executor = Executor::new(Box::new(data_source));
let compiler = Compiler::new();
println!("\nTesting: SELECT * FROM entities");
let query = "SELECT * FROM entities";
let statement = parse_statement(query).expect("Query should parse");
let compiled = compiler.compile(statement).expect("Query should compile");
match &compiled.plan {
crate::compiler::ExecutionPlan::Project { input, .. } => match input.as_ref() {
crate::compiler::ExecutionPlan::Scan { .. } => {
println!("✓ Generated execution plan with Scan -> Project structure");
}
_ => panic!("Expected Scan as input to Project"),
},
_ => panic!("Expected Project plan"),
}
let result = executor.execute(compiled).expect("Plan should execute");
assert_eq!(result.rows.len(), 1);
println!("✓ Plan execution returned {} rows", result.rows.len());
println!("\nTesting: Query metadata generation");
let query2 = "SELECT name, age FROM entities WHERE age > 25";
let statement2 = parse_statement(query2).expect("Query should parse");
let compiled2 = compiler.compile(statement2).expect("Query should compile");
assert!(
compiled2
.metadata
.tables_accessed
.contains(&"entities".to_string())
);
println!(
"✓ Metadata captured accessed tables: {:?}",
compiled2.metadata.tables_accessed
);
assert!(compiled2.estimated_cost.estimated_rows > 0);
assert!(compiled2.estimated_cost.estimated_cpu_cost > 0.0);
println!(
"✓ Cost estimation generated: {} estimated rows, {:.2} CPU cost",
compiled2.estimated_cost.estimated_rows, compiled2.estimated_cost.estimated_cpu_cost
);
println!(
"\n🎉 All query plan generation tests passed! HyperQL is now a pure query language."
);
}
#[test]
fn test_comprehensive_type_validation() {
use crate::ast::{BinaryOperator, ColumnRef, Literal, VectorExpression};
println!("Testing comprehensive type validation across HyperQL features...");
let mut type_checker = TypeChecker::new();
let geo_expr = Expression::Geometric(crate::ast::geometric::GeometricExpression::Within {
target: Box::new(Expression::Column(ColumnRef {
table: None,
name: "position".to_string(),
})),
radius: 5.0,
reference: Box::new(Expression::Column(ColumnRef {
table: None,
name: "position".to_string(),
})),
});
let geo_type = type_checker
.check_expression_type(&geo_expr)
.expect("Geometric expression should type check");
assert_eq!(geo_type, TypeInfo::Bool, "WITHIN should return boolean");
println!("✓ Geometric expression type checking works");
let vector_expr = Expression::Vector(VectorExpression::Similarity {
vector_name: "embeddings".to_string(),
reference: Box::new(Expression::Literal(Literal::String("query".to_string()))),
metric: crate::ast::vector::similarity::SimilarityMetric::Cosine,
threshold: Some(0.8),
vector_type: crate::ast::vector::similarity::VectorType::Dense { dimensions: 768 },
});
let vector_type = type_checker
.check_expression_type(&vector_expr)
.expect("Vector expression should type check");
assert_eq!(
vector_type,
TypeInfo::Float,
"Vector similarity should return float"
);
println!("✓ Vector expression type checking works");
let complex_expr = Expression::Binary {
left: Box::new(Expression::Function {
name: "AVG".to_string(),
args: vec![Expression::Literal(Literal::Float(85.5))],
}),
op: BinaryOperator::GreaterThan,
right: Box::new(Expression::Binary {
left: Box::new(Expression::Literal(Literal::Int(50))),
op: BinaryOperator::Add,
right: Box::new(Expression::Literal(Literal::Float(25.0))),
}),
};
let complex_type = type_checker
.check_expression_type(&complex_expr)
.expect("Complex expression should type check");
assert_eq!(
complex_type,
TypeInfo::Bool,
"Comparison should return boolean"
);
println!("✓ Complex nested expression type checking works");
let update_result = type_checker.check_update_assignment(
"name",
&Expression::Literal(Literal::String("John Doe".to_string())),
);
assert!(update_result.is_ok(), "Valid UPDATE assignment should pass");
let invalid_update = type_checker.check_update_assignment(
"position",
&Expression::Literal(Literal::String("not a point".to_string())),
);
assert!(
invalid_update.is_err(),
"Invalid UPDATE assignment should fail"
);
println!("✓ UPDATE assignment validation works");
println!("\n🎉 Comprehensive type validation tests passed!");
}
#[test]
fn test_query_optimizer_integration_basic() {
println!("Testing basic query optimizer functionality...");
let compiler = Compiler::new();
let optimizer = QueryOptimizer::new();
println!("1. Testing optimizer creation:");
let custom_config = OptimizerConfig {
enable_predicate_pushdown: true,
enable_projection_pushdown: false, enable_constant_folding: true,
enable_expression_simplify: false,
};
let custom_optimizer = QueryOptimizer::with_config(custom_config);
let query = "SELECT name FROM users WHERE age > 25";
let statement = parse_statement(query).expect("Should parse");
let basic_compiled = compiler.compile(statement.clone()).expect("Should compile");
println!(" ✓ Basic compilation successful");
let optimized_compiled = compiler
.compile_with_optimizer(statement.clone(), &optimizer)
.expect("Should compile with optimizer");
println!(" ✓ Optimized compilation successful");
let (stats_compiled, stats) = compiler
.compile_with_optimizer_stats(statement, &custom_optimizer)
.expect("Should compile with optimizer stats");
println!(" ✓ Stats compilation successful: {:?}", stats);
println!("\n2. Testing configuration respect:");
println!(" ✓ Custom optimizer created with selective optimizations");
println!("\n3. Testing plan variation:");
let plan_changed = !plans_equivalent(&basic_compiled.plan, &optimized_compiled.plan);
println!(
" Plan changed: {} (structure difference detected)",
plan_changed || stats.plan_changed
);
println!("\n🎉 Basic query optimizer integration test passed!");
}
fn plans_equivalent(
plan1: &crate::compiler::ExecutionPlan,
plan2: &crate::compiler::ExecutionPlan,
) -> bool {
std::mem::discriminant(plan1) == std::mem::discriminant(plan2)
}
#[test]
fn test_query_optimizer_integration() {
use std::collections::HashMap;
println!("Testing query optimizer integration...");
let mut data_source = MemoryDataSource::new();
let mut alice = Entity {
id: EntityId("alice_001".to_string()),
properties: HashMap::new(),
position: Some(Position3D {
x: 1.0,
y: 2.0,
z: 3.0,
}),
embedding: None,
};
alice.properties.insert(
PropertyName("name".to_string()),
Value::String("Alice".to_string()),
);
alice
.properties
.insert(PropertyName("age".to_string()), Value::Int(30));
alice
.properties
.insert(PropertyName("score".to_string()), Value::Float(85.5));
let mut bob = Entity {
id: EntityId("bob_002".to_string()),
properties: HashMap::new(),
position: Some(Position3D {
x: 4.0,
y: 5.0,
z: 6.0,
}),
embedding: None,
};
bob.properties.insert(
PropertyName("name".to_string()),
Value::String("Bob".to_string()),
);
bob.properties
.insert(PropertyName("age".to_string()), Value::Int(25));
bob.properties
.insert(PropertyName("score".to_string()), Value::Float(72.3));
data_source.add_entities("users", vec![alice, bob]);
let compiler = Compiler::new();
let optimizer = QueryOptimizer::new();
let mut executor = Executor::new(Box::new(data_source));
println!("\n1. Testing constant folding optimization:");
let query1 = "SELECT name FROM users WHERE age > 20 + 5"; let statement1 = parse_statement(query1).expect("Query should parse");
let _unoptimized = compiler
.compile(statement1.clone())
.expect("Should compile");
println!(" Unoptimized query compiled successfully");
let (optimized, stats) = compiler
.compile_with_optimizer_stats(statement1, &optimizer)
.expect("Should compile with optimizer");
println!(" Optimizations applied: {:?}", stats);
assert!(
stats.constant_folding_applied,
"Constant folding should be applied"
);
let result = executor.execute(optimized).expect("Should execute");
assert_eq!(result.rows.len(), 1, "Should return Alice (age 30 > 25)");
assert_eq!(
result.rows[0].columns.get("name"),
Some(&Value::String("Alice".to_string()))
);
println!(" ✓ Query executed correctly with optimizations");
println!("\n2. Testing expression simplification:");
let query2 = "SELECT * FROM users WHERE age > 20 AND age > 20"; let statement2 = parse_statement(query2).expect("Query should parse");
let (optimized2, stats2) = compiler
.compile_with_optimizer_stats(statement2, &optimizer)
.expect("Should compile with optimizer");
println!(" Optimizations applied: {:?}", stats2);
let result2 = executor.execute(optimized2).expect("Should execute");
assert_eq!(
result2.rows.len(),
2,
"Should return both users (both have age > 20)"
);
println!(" ✓ Simplified expression query executed correctly");
println!("\n3. Testing predicate pushdown optimization:");
let query3 = "SELECT name, age FROM users WHERE age > 28 ORDER BY name";
let statement3 = parse_statement(query3).expect("Query should parse");
let (optimized3, stats3) = compiler
.compile_with_optimizer_stats(statement3, &optimizer)
.expect("Should compile with optimizer");
println!(" Optimizations applied: {:?}", stats3);
let result3 = executor.execute(optimized3).expect("Should execute");
assert_eq!(result3.rows.len(), 1, "Should return Alice (age 30 > 28)");
println!(" ✓ Predicate pushdown query executed correctly");
println!("\n4. Testing custom optimizer configuration:");
let custom_config = OptimizerConfig {
enable_predicate_pushdown: false,
enable_projection_pushdown: false,
enable_constant_folding: true,
enable_expression_simplify: false,
};
let custom_optimizer = QueryOptimizer::with_config(custom_config);
let query4 = "SELECT name FROM users WHERE age > 10 + 15"; let statement4 = parse_statement(query4).expect("Query should parse");
let (optimized4, stats4) = compiler
.compile_with_optimizer_stats(statement4, &custom_optimizer)
.expect("Should compile with custom optimizer");
println!(" Custom optimizations applied: {:?}", stats4);
assert!(
stats4.constant_folding_applied,
"Constant folding should still be enabled"
);
assert!(
!stats4.predicate_pushdown_applied || !stats4.projection_pushdown_applied,
"Disabled optimizations should not be applied"
);
let result4 = executor.execute(optimized4).expect("Should execute");
assert_eq!(
result4.rows.len(),
1,
"Should return Alice (age 30 > 25, Bob has age 25 which is not > 25)"
);
assert_eq!(
result4.rows[0].columns.get("name"),
Some(&Value::String("Alice".to_string()))
);
println!(" ✓ Custom optimizer configuration works correctly");
println!("\n5. Testing complex query with multiple optimizations:");
let query5 = "SELECT name FROM users WHERE age > 15 + 10 AND score > 50.0 + 20.0 ORDER BY name LIMIT 10";
let statement5 = parse_statement(query5).expect("Query should parse");
let (optimized5, stats5) = compiler
.compile_with_optimizer_stats(statement5, &optimizer)
.expect("Should compile with optimizer");
println!(" Complex query optimizations applied: {:?}", stats5);
let result5 = executor.execute(optimized5).expect("Should execute");
assert_eq!(
result5.rows.len(),
1,
"Should return Alice (age > 25 AND score > 70.0)"
);
assert_eq!(
result5.rows[0].columns.get("name"),
Some(&Value::String("Alice".to_string()))
);
println!(" ✓ Complex query with multiple optimizations executed correctly");
println!("\n6. Demonstrating optimization benefits:");
let demo_query = "SELECT * FROM users WHERE age > 2 * 10 + 5";
let demo_statement = parse_statement(demo_query).expect("Query should parse");
let unoptimized_query = compiler
.compile(demo_statement.clone())
.expect("Should compile");
let (optimized_query, optimization_stats) = compiler
.compile_with_optimizer_stats(demo_statement, &optimizer)
.expect("Should compile with optimizer");
println!(
" Original estimated cost: {:.2} CPU, {} rows",
unoptimized_query.estimated_cost.estimated_cpu_cost,
unoptimized_query.estimated_cost.estimated_rows
);
println!(
" Optimized estimated cost: {:.2} CPU, {} rows",
optimized_query.estimated_cost.estimated_cpu_cost,
optimized_query.estimated_cost.estimated_rows
);
println!(" Optimizations applied: {:?}", optimization_stats);
println!(
"\n🎉 All query optimizer integration tests passed! HyperQL optimization system is working correctly."
);
}
#[test]
fn test_query_validator_integration() {
use std::collections::HashMap;
println!("Testing query validator integration...");
let mut data_source = MemoryDataSource::new();
let mut alice = Entity {
id: EntityId("alice_001".to_string()),
properties: HashMap::new(),
position: Some(Position3D {
x: 1.0,
y: 2.0,
z: 3.0,
}),
embedding: None,
};
alice.properties.insert(
PropertyName("name".to_string()),
Value::String("Alice".to_string()),
);
alice
.properties
.insert(PropertyName("age".to_string()), Value::Int(30));
data_source.add_entity("users", alice);
let compiler = Compiler::new();
let mut executor = Executor::new(Box::new(data_source));
println!("\n1. Testing valid query validation:");
let valid_query = "SELECT name FROM users WHERE age > 25";
let statement1 = parse_statement(valid_query).expect("Query should parse");
let mut validator = QueryValidator::new();
let validation_result = validator
.validate(&statement1)
.expect("Validation should not error");
assert!(
validation_result.valid,
"Valid query should pass validation"
);
assert!(
validation_result.errors.is_empty(),
"Valid query should have no errors"
);
println!(" ✓ Valid query passed validation");
println!("\n2. Testing invalid query validation (HAVING without GROUP BY):");
let invalid_query = "SELECT name FROM users HAVING COUNT(*) > 1";
let statement2 = parse_statement(invalid_query).expect("Query should parse");
let validation_result2 = validator
.validate(&statement2)
.expect("Validation should not error");
assert!(
!validation_result2.valid,
"Invalid query should fail validation"
);
assert!(
!validation_result2.errors.is_empty(),
"Invalid query should have errors"
);
println!(
" ✓ Invalid query failed validation with {} errors",
validation_result2.errors.len()
);
for error in &validation_result2.errors {
println!(" - {}", error.message);
}
println!("\n3. Testing query with warnings (OFFSET without LIMIT):");
let warning_query = "SELECT * FROM users OFFSET 10";
let statement3 = parse_statement(warning_query).expect("Query should parse");
let validation_result3 = validator
.validate(&statement3)
.expect("Validation should not error");
assert!(
validation_result3.valid,
"Query with warnings should still be valid"
);
assert!(
!validation_result3.warnings.is_empty(),
"Query should have warnings"
);
println!(
" ✓ Query passed validation with {} warnings",
validation_result3.warnings.len()
);
for warning in &validation_result3.warnings {
println!(" - {}", warning.message);
}
println!("\n4. Testing compiler integration with validation:");
let valid_statement = parse_statement(valid_query).expect("Query should parse");
let compiled_with_validation = compiler
.compile_with_validation(valid_statement, &mut validator)
.expect("Compilation with validation should succeed");
let result = executor
.execute(compiled_with_validation)
.expect("Execution should succeed");
assert_eq!(result.rows.len(), 1, "Should return one result");
println!(" ✓ Validation + compilation + execution pipeline works");
println!("\n5. Testing schema-aware validation:");
let mut schema = HashMap::new();
schema.insert(
"users".to_string(),
vec!["id".to_string(), "name".to_string(), "age".to_string()],
);
let config = ValidationConfig {
validate_schema: true,
allow_ambiguous_columns: false,
..ValidationConfig::default()
};
let mut schema_validator = QueryValidator::with_config(config);
let valid_schema_query = "SELECT name FROM users WHERE age > 25";
let statement4 = parse_statement(valid_schema_query).expect("Query should parse");
let schema_result = schema_validator
.validate_with_schema(&statement4, &schema)
.expect("Schema validation should not error");
assert!(schema_result.valid, "Valid schema query should pass");
println!(" ✓ Schema-aware validation passed for valid query");
let invalid_schema_query = "SELECT nonexistent FROM users";
let statement5 = parse_statement(invalid_schema_query).expect("Query should parse");
let schema_result2 = schema_validator
.validate_with_schema(&statement5, &schema)
.expect("Schema validation should not error");
assert!(!schema_result2.valid, "Invalid schema query should fail");
println!(" ✓ Schema-aware validation failed for invalid column reference");
println!("\n6. Testing custom validation configuration:");
let strict_config = ValidationConfig {
strict_mode: true,
allow_ambiguous_columns: false,
require_explicit_aliases: true,
warn_performance_issues: true,
..ValidationConfig::default()
};
let mut strict_validator = QueryValidator::with_config(strict_config);
let perf_query = "SELECT * FROM users ORDER BY name";
let statement6 = parse_statement(perf_query).expect("Query should parse");
let strict_result = strict_validator
.validate(&statement6)
.expect("Validation should not error");
assert!(
!strict_result.warnings.is_empty(),
"Should have performance warnings"
);
println!(
" ✓ Strict validation configuration produced {} warnings",
strict_result.warnings.len()
);
println!(
"\n🎉 All query validator integration tests passed! HyperQL validation system is working correctly."
);
}
}