()
| 579 | |
| 580 | #[test] |
| 581 | fn test_aggregation_performance() { |
| 582 | let fixture = TestFixture::new().expect("Failed to create test fixture"); |
| 583 | // Setup fresh graph for this test to avoid interference |
| 584 | fixture |
| 585 | .setup_graph("test_aggregation_performance") |
| 586 | .expect("Failed to setup graph"); |
| 587 | // Re-insert fraud data since we have a fresh graph |
| 588 | fixture |
| 589 | .insert_fraud_data() |
| 590 | .expect("Failed to insert fraud data"); |
| 591 | |
| 592 | // Test performance of complex aggregations |
| 593 | let start = std::time::Instant::now(); |
| 594 | |
| 595 | let result = fixture.assert_query_succeeds( |
| 596 | "MATCH (a:Account)-[t:Transaction]->(m:Merchant) |
| 597 | RETURN a.account_type, |
| 598 | m.category, |
| 599 | count(t) as transaction_count, |
| 600 | sum(t.amount) as total_amount, |
| 601 | avg(t.amount) as avg_amount, |
| 602 | min(t.amount) as min_amount, |
| 603 | max(t.amount) as max_amount, |
| 604 | count(DISTINCT a) as unique_accounts, |
| 605 | count(DISTINCT m) as unique_merchants |
| 606 | GROUP BY a.account_type, m.category |
| 607 | ORDER BY total_amount DESC", |
| 608 | ); |
| 609 | |
| 610 | let duration = start.elapsed(); |
| 611 | assert!( |
| 612 | duration.as_secs() < 15, |
| 613 | "Complex aggregation should complete within 15 seconds" |
| 614 | ); |
| 615 | assert!(!result.rows.is_empty()); |
| 616 | |
| 617 | // Test large GROUP BY performance |
| 618 | let start = std::time::Instant::now(); |
| 619 | |
| 620 | fixture.assert_query_succeeds( |
| 621 | "MATCH (a:Account) |
| 622 | RETURN a.account_number, |
| 623 | a.balance, |
| 624 | a.risk_score, |
| 625 | a.account_status |
| 626 | GROUP BY a.account_number, a.balance, a.risk_score, a.account_status |
| 627 | ORDER BY a.balance DESC", |
| 628 | ); |
| 629 | |
| 630 | let duration = start.elapsed(); |
| 631 | assert!( |
| 632 | duration.as_secs() < 10, |
| 633 | "Large GROUP BY should complete within 10 seconds" |
| 634 | ); |
| 635 | } |
| 636 | |
| 637 | #[test] |
| 638 | fn test_aggregation_edge_cases() { |
nothing calls this directly
no test coverage detected