Skip to content

Commit

Permalink
Add snb test and fix for larger than 1 vector of data
Browse files Browse the repository at this point in the history
  • Loading branch information
Dtenwolde committed Aug 22, 2024
1 parent 0658cc6 commit 54a09b9
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/functions/scalar/weakly_connected_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,16 @@ static void WeaklyConnectedComponentFunction(DataChunk &args,
if (!vdata_src.validity.RowIsValid(src_pos)) {
result_validity.SetInvalid(i);
} else {
auto component_id = info.componentId[src_data[src_pos]];
if (component_id == -1) {
info.componentId[src_data[src_pos]] = src_data[src_pos];
}
result_data[i] = info.componentId[src_data[src_pos]];
}
}

// Handle any unfinished lanes and assign component IDs
AssignUnfinishedLanesToComponent(result, info, vdata_src, src_data, v_size);
// // Handle any unfinished lanes and assign component IDs
// AssignUnfinishedLanesToComponent(result, info, vdata_src, src_data, v_size);


duckpgq_state->csr_to_delete.insert(info.csr_id);
Expand Down
66 changes: 66 additions & 0 deletions test/sql/scalar/weakly_connected_component.test
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,69 @@ select id, componentId from weakly_connected_component(pg_no_edge_table, student
----
Invalid Error: Table non_existent_edge not found in property graph pg_no_edge_table

statement ok
import database 'duckdb-pgq/data/SNB0.003';

statement ok
-CREATE PROPERTY GRAPH snb
VERTEX TABLES (
Person
)
EDGE TABLES (
Person_knows_person SOURCE KEY (Person1Id) REFERENCES Person (id)
DESTINATION KEY (Person2Id) REFERENCES Person (id)
LABEL Knows);

query II
from weakly_connected_component(snb, person, knows) order by componentId;
----
14 0
16 0
32 0
2199023255557 0
2199023255573 0
2199023255594 0
6597069766702 0
8796093022237 0
8796093022244 0
8796093022249 0
10995116277761 0
10995116277782 0
13194139533342 0
13194139533352 0
13194139533355 0
15393162788877 0
17592186044443 0
17592186044461 0
19791209299968 0
19791209299987 0
21990232555527 0
24189255811081 0
24189255811109 0
26388279066632 0
26388279066641 0
26388279066655 0
26388279066658 0
26388279066668 0
28587302322180 0
28587302322191 0
28587302322196 0
28587302322204 0
28587302322223 0
30786325577731 0
30786325577740 0
32985348833329 0
35184372088834 0
35184372088850 0
35184372088856 0
4398046511139 6
8796093022234 8
10995116277783 14
10995116277808 15
21990232555526 24
28587302322209 37
32985348833291 41
32985348833318 42
35184372088871 47
37383395344394 48
37383395344409 49

0 comments on commit 54a09b9

Please sign in to comment.