MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / test_pattern_with_aggregations

Function test_pattern_with_aggregations

graphlite/tests/pattern_tests.rs:690–727  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

688
689#[test]
690fn test_pattern_with_aggregations() {
691 let fixture = TestFixture::with_fraud_data().expect("Failed to create test fixture");
692
693 // Test patterns combined with aggregations using ISO GQL compliant syntax
694 let result = fixture.assert_query_succeeds(
695 "MATCH (a:Account)-[t:Transaction]->(m:Merchant)
696 RETURN a.account_number,
697 m.name,
698 count(*) as transaction_count
699 GROUP BY a.account_number, m.name
700 HAVING count(*) > 5
701 ORDER BY count(*) DESC
702 LIMIT 10",
703 );
704 assert!(result.rows.len() <= 10);
705
706 // Test pattern aggregation with simple counting
707 let result = fixture.query(
708 "MATCH (a:Account)-[t:Transaction]->(m:Merchant)
709 RETURN count(DISTINCT a) as total_accounts,
710 count(DISTINCT m) as total_merchants,
711 count(t) as total_transactions",
712 );
713
714 match result {
715 Ok(r) => assert!(!r.rows.is_empty()),
716 Err(_) => log::debug!("Complex variable length pattern aggregation not supported"),
717 }
718
719 // Test pattern with simple aggregation (ISO GQL compliant)
720 let result = fixture.assert_query_succeeds(
721 "MATCH (a:Account)-[t:Transaction]->(m:Merchant)
722 WHERE t.amount > 10000
723 RETURN count(DISTINCT a) as accounts_with_large_transactions,
724 count(t) as large_transaction_count",
725 );
726 assert!(!result.rows.is_empty());
727}
728
729#[test]
730fn debug_multi_hop_pattern() {

Callers

nothing calls this directly

Calls 2

assert_query_succeedsMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected