Skip to content

Commit

Permalink
Merge pull request #101 from cwida/56-make-columns-clause-optional
Browse files Browse the repository at this point in the history
Make COLUMNS optional
  • Loading branch information
Dtenwolde authored Mar 4, 2024
2 parents b0cb5b4 + 7aac01b commit 36cd285
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 11 deletions.
88 changes: 88 additions & 0 deletions test/sql/optional_columns.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# name: test/sql/sqlpgq/snb.test
# group: [duckpgq]

require duckpgq

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

statement ok
-CREATE PROPERTY GRAPH snb
VERTEX TABLES (
Person LABEL Person,
Organisation LABEL Organisation IN typemask(company, university)
)
EDGE TABLES (
Person_knows_person SOURCE KEY (Person1Id) REFERENCES Person (id)
DESTINATION KEY (Person2Id) REFERENCES Person (id)
LABEL Knows,
person_workAt_Organisation SOURCE KEY (PersonId) REFERENCES Person (id)
DESTINATION KEY (OrganisationId) REFERENCES Organisation (id)
LABEL workAt_Organisation
);

query IIIIIIIIIII
-FROM GRAPH_TABLE (snb MATCH (p:Person)) limit 1;
----
2010-01-03 23:10:31.499+00 14 Hossein Forouhar male 1984-03-11 77.245.239.11 Firefox 1166 fa;ku;en [email protected]

query I
-FROM GRAPH_TABLE (snb MATCH (p:Person) COLUMNS (p.id)) limit 10;
----
14
16
32
2199023255557
2199023255573
2199023255594
4398046511139
6597069766702
8796093022234
8796093022237

query I
-SELECT p_id FROM GRAPH_TABLE (snb MATCH (p:Person) COLUMNS (p.id as p_id,)) limit 10;
----
14
16
32
2199023255557
2199023255573
2199023255594
4398046511139
6597069766702
8796093022234
8796093022237

query I
-FROM GRAPH_TABLE (snb MATCH (p:Person) COLUMNS (p.id as p_id)) limit 10;
----
14
16
32
2199023255557
2199023255573
2199023255594
4398046511139
6597069766702
8796093022234
8796093022237

query II
-FROM GRAPH_TABLE (snb MATCH (p:Person) COLUMNS (p.id, p.firstname as first_name)) limit 10;
----
14 Hossein
16 Jan
32 Miguel
2199023255557 Eric
2199023255573 Arbaaz
2199023255594 Ali
4398046511139 Ayesha
6597069766702 Alejandro
8796093022234 Rahul
8796093022237 Lei

query I
-SELECT count(*) FROM GRAPH_TABLE (snb MATCH (p:Person)) GROUP BY ALL limit 10;
----
50
20 changes: 10 additions & 10 deletions test/sql/path-finding/subpath_match.test
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ EDGE TABLES (
PROPERTIES ( id ) LABEL Knows
);

#query II
#-SELECT study.a_id, study.name
#FROM GRAPH_TABLE (pg
# MATCH
# (a:Person WHERE a.id = 0)
# COLUMNS (a.id as a_id, a.name)
# ) study
#----
#0 Daniel
#
query II
-SELECT study.a_id, study.name
FROM GRAPH_TABLE (pg
MATCH
(a:Person WHERE a.id = 0)
COLUMNS (a.id as a_id, a.name)
) study
----
0 Daniel

#query II
#-SELECT study.a_id, study.b_id
#FROM GRAPH_TABLE (pg
Expand Down

0 comments on commit 36cd285

Please sign in to comment.