@@ -401,7 +401,63 @@ def test_arrow_memory_backed_csr_arrow_rel_table(conn_db_empty: ConnDB) -> None:
401401 conn .drop_arrow_table ("arrow_csr_people" )
402402
403403
404- def test_arrow_memory_backed_native_node_and_arrow_rel_table (
404+ def test_arrow_memory_backed_csr_rel_table_custom_dst_col (
405+ conn_db_empty : ConnDB ,
406+ ) -> None :
407+ """Test Arrow CSR relationship table with a custom destination column name."""
408+ conn , _ = conn_db_empty
409+
410+ import ladybug as lb
411+
412+ pa = pytest .importorskip ("pyarrow" )
413+
414+ people = pa .Table .from_arrays (
415+ [pa .array ([1 , 2 , 3 ], type = pa .int64 ())],
416+ names = ["id" ],
417+ )
418+ conn .create_arrow_table ("csr_custom_dst_people" , people )
419+
420+ # Use "destination" instead of the default "to"
421+ indices = pa .Table .from_arrays (
422+ [
423+ pa .array ([1 , 2 , 2 ], type = pa .uint64 ()),
424+ pa .array ([10 , 20 , 30 ], type = pa .int64 ()),
425+ ],
426+ names = ["destination" , "weight" ],
427+ )
428+ indptr = pa .Table .from_arrays (
429+ [pa .array ([0 , 2 , 3 , 3 ], type = pa .uint64 ())],
430+ names = ["indptr" ],
431+ )
432+ conn .create_arrow_rel_table (
433+ "csr_custom_dst_knows" ,
434+ indices ,
435+ "csr_custom_dst_people" ,
436+ "csr_custom_dst_people" ,
437+ layout = lb .ArrowRelTableLayout .CSR ,
438+ indptr_dataframe = indptr ,
439+ dst_col_name = "destination" ,
440+ )
441+
442+ result = conn .execute (
443+ "MATCH (a:csr_custom_dst_people)-[r:csr_custom_dst_knows]->(b:csr_custom_dst_people) "
444+ "RETURN a.id, b.id, r.weight ORDER BY a.id, b.id"
445+ )
446+ rows = []
447+ while result .has_next ():
448+ rows .append (result .get_next ())
449+
450+ assert rows == [
451+ [1 , 2 , 10 ],
452+ [1 , 3 , 20 ],
453+ [2 , 3 , 30 ],
454+ ]
455+
456+ conn .drop_arrow_table ("csr_custom_dst_knows" )
457+ conn .drop_arrow_table ("csr_custom_dst_people" )
458+
459+
460+ def test_arrow_memory_backed_rel_table_over_native_node_tables (
405461 conn_db_empty : ConnDB ,
406462) -> None :
407463 """Test an Arrow memory-backed relationship over native node tables."""
0 commit comments