From 8f1b929d4416434e8ea1d91b21a5b91c24631424 Mon Sep 17 00:00:00 2001 From: dtenwolde Date: Thu, 14 Nov 2024 10:23:26 +0100 Subject: [PATCH] Create larger test, --- .../physical_path_finding_operator.cpp | 5 ++ .../path_finding/parallel_path_finding.test | 12 ++--- test/sql/path_finding/path_finding_snb.test | 51 +++++++++++++++++++ 3 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 test/sql/path_finding/path_finding_snb.test diff --git a/src/core/operator/physical_path_finding_operator.cpp b/src/core/operator/physical_path_finding_operator.cpp index 941be4ec..d751f3ea 100644 --- a/src/core/operator/physical_path_finding_operator.cpp +++ b/src/core/operator/physical_path_finding_operator.cpp @@ -391,7 +391,12 @@ PhysicalPathFinding::GetData(ExecutionContext &context, DataChunk &result, if (pf_sink.global_pairs->Count() == 0) { return SourceResultType::FINISHED; } + if (pf_bfs_state->pairs->size() > STANDARD_VECTOR_SIZE) { + + } + pf_bfs_state->result.SetCardinality(*pf_bfs_state->pairs); + result.Move(*pf_bfs_state->pairs); result.Fuse(pf_bfs_state->result); diff --git a/test/sql/path_finding/parallel_path_finding.test b/test/sql/path_finding/parallel_path_finding.test index ac8e0359..9b8b97fe 100644 --- a/test/sql/path_finding/parallel_path_finding.test +++ b/test/sql/path_finding/parallel_path_finding.test @@ -30,12 +30,12 @@ create table student(id INT); INSERT INTO student(id) VALUES (10), (20), (30), ( statement ok create table know(src INT, dst INT); INSERT INTO know(src, dst) VALUES (40, 20), (10,30), (10,10), (20,10), (30,10); -statement ok --CREATE PROPERTY GRAPH g -VERTEX TABLES (student) -EDGE TABLES (know SOURCE KEY ( src ) REFERENCES Student ( id ) - DESTINATION KEY ( dst ) REFERENCES Student ( id ) - ); +#statement ok +#-CREATE PROPERTY GRAPH g +#VERTEX TABLES (student) +#EDGE TABLES (know SOURCE KEY ( src ) REFERENCES Student ( id ) +# DESTINATION KEY ( dst ) REFERENCES Student ( id ) +# ); query III with csr_cte as ( diff --git a/test/sql/path_finding/path_finding_snb.test b/test/sql/path_finding/path_finding_snb.test new file mode 100644 index 00000000..e2a80a0f --- /dev/null +++ b/test/sql/path_finding/path_finding_snb.test @@ -0,0 +1,51 @@ + + +require duckpgq + +statement ok +set experimental_path_finding_operator=true; + +statement ok +select setseed(0.42); + +statement ok +create table person as (select * from read_csv_auto('/Users/dljtw/git/duckpgq-experiments/data/SNB1-projected|/person.csv')); + +statement ok +create table person_knows_person as (select * from read_csv_auto('/Users/dljtw/git/duckpgq-experiments/data/SNB1-projected|/person_knows_person.csv')); + + +statement ok +create or replace table snb_pairs as ( + select src, dst + from (select a.rowid as src from person a), + (select b.rowid as dst from person b) + using sample reservoir(3000 rows) repeatable (300) + ); + +statement ok +with csr_cte as ( + SELECT cast(min(create_csr_edge( + 0, + (SELECT count(a.id) FROM person a), + CAST ( + (SELECT sum(create_csr_vertex( + 0, + (SELECT count(a.id) FROM person a), + sub.dense_id, + sub.cnt)) + FROM ( + SELECT a.rowid as dense_id, count(k.person1id) as cnt + FROM person a + LEFT JOIN person_knows_person k ON k.person1id = a.id + GROUP BY a.rowid) sub + ) + AS BIGINT), + (select count() FROM person_knows_person k JOIN person a on a.id = k.person1id JOIN person c on c.id = k.person2id), + a.rowid, + c.rowid, + k.rowid)) as bigint) as csr_id + FROM person_knows_person k + JOIN person a on a.id = k.person1id + JOIN person c on c.id = k.person2id) + SELECT src as source, dst as destination, shortestpathoperator(src, dst, csr_id) as path FROM snb_pairs, csr_cte; \ No newline at end of file