generated from duckdb/extension-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |