| 728 | |
| 729 | #[test] |
| 730 | fn debug_multi_hop_pattern() { |
| 731 | let fixture = TestFixture::with_fraud_data().expect("Failed to create test fixture"); |
| 732 | |
| 733 | log::debug!("=== Test 1: Basic multi-hop pattern ==="); |
| 734 | let query1 = "MATCH (a1:Account)-[:Transaction]->(m:Merchant)<-[:Transaction]-(a2:Account) RETURN count(*) as shared_merchants"; |
| 735 | |
| 736 | let result1 = fixture.query(query1); |
| 737 | match &result1 { |
| 738 | Ok(r) => log::debug!("✅ Basic works: {} rows", r.rows.len()), |
| 739 | Err(e) => log::debug!("❌ Basic failed: {:?}", e), |
| 740 | } |
| 741 | |
| 742 | // Test 1.5: Simple two-hop without WHERE to see if a2 is bound at all |
| 743 | log::debug!("=== Test 1.5: Two-hop without WHERE ==="); |
| 744 | let query1_5 = "MATCH (a1:Account)-[:Transaction]->(m:Merchant)<-[:Transaction]-(a2:Account) RETURN a1, a2, a1.account_number, a2.account_number LIMIT 3"; |
| 745 | |
| 746 | let result1_5 = fixture.query(query1_5); |
| 747 | match &result1_5 { |
| 748 | Ok(r) => { |
| 749 | log::debug!("✅ Two-hop without WHERE works: {} rows", r.rows.len()); |
| 750 | if let Some(first_row) = r.rows.first() { |
| 751 | log::debug!( |
| 752 | " Available variables: {:?}", |
| 753 | first_row.values.keys().collect::<Vec<_>>() |
| 754 | ); |
| 755 | // Print first few actual values to debug |
| 756 | for (key, value) in first_row.values.iter().take(4) { |
| 757 | log::debug!(" {} = {:?}", key, value); |
| 758 | } |
| 759 | } |
| 760 | } |
| 761 | Err(e) => log::debug!("❌ Two-hop without WHERE failed: {:?}", e), |
| 762 | } |
| 763 | |
| 764 | log::debug!("=== Test 2: With != operator ==="); |
| 765 | let query2 = "MATCH (a1:Account)-[:Transaction]->(m:Merchant)<-[:Transaction]-(a2:Account) WHERE a1 != a2 RETURN count(*) as shared_merchants"; |
| 766 | |
| 767 | let result2 = fixture.query(query2); |
| 768 | match &result2 { |
| 769 | Ok(r) => log::debug!("✅ != works: {} rows", r.rows.len()), |
| 770 | Err(e) => log::debug!("❌ != failed: {:?}", e), |
| 771 | } |
| 772 | |
| 773 | log::debug!("=== Test 3: With <> operator ==="); |
| 774 | let query3 = "MATCH (a1:Account)-[:Transaction]->(m:Merchant)<-[:Transaction]-(a2:Account) WHERE a1 <> a2 RETURN count(*) as shared_merchants"; |
| 775 | |
| 776 | let result3 = fixture.query(query3); |
| 777 | match &result3 { |
| 778 | Ok(r) => log::debug!("✅ <> works: {} rows", r.rows.len()), |
| 779 | Err(e) => log::debug!("❌ <> failed: {:?}", e), |
| 780 | } |
| 781 | |
| 782 | // Test 4: Debug the physical plan generation |
| 783 | log::debug!("=== Test 4: Debug physical plan ==="); |
| 784 | log::debug!("Let me check if I can trace the physical plan generation..."); |
| 785 | |
| 786 | // For now, let's test if a simpler variable pattern works |
| 787 | let simple_query = "MATCH (a:Account) RETURN a.account_number LIMIT 1"; |