cwida / duckpgq-extension

DuckDB extension that adds support for SQL/PGQ
https://duckpgq.notion.site/b8ac652667964f958bfada1c3e53f1bb?v=3b47a8d44bdf4e0c8b503bf23f1b76f2
MIT License
73 stars 7 forks source link

Edge table not found in weakly_connected_component function #148

Closed pkoppstein closed 1 month ago

pkoppstein commented 1 month ago

What happens?

Invalid Error: Table edges not found in property graph my_graph

Note: the documentation indicates the "<edge table>" should be used:

weakly_connected_component(<pg>, <vertex table>, <edge table>)

To Reproduce

LOAD duckpgq;

CREATE or replace TABLE edges (
    source INTEGER,
    target INTEGER
);

-- Insert some sample data (directed edges)
INSERT INTO edges VALUES (1, 2), (2, 3), (4, 5), (2, 4), (10,11);

CREATE OR REPLACE TABLE nodes AS
   (SELECT DISTINCT id FROM
    (SELECT DISTINCT source AS id FROM edges
    UNION
    SELECT DISTINCT target AS id FROM edges
    ) );

CREATE OR REPLACE PROPERTY GRAPH my_graph
  VERTEX TABLES (
   nodes LABEL nodes
 )
  EDGE TABLES (
    edges SOURCE KEY (source) REFERENCES nodes (id)
          DESTINATION KEY (target) REFERENCES nodes (id)
          LABEL knows
  );

SELECT * FROM weakly_connected_component(my_graph, nodes, edges);

OS:

macOS

DuckDB Version:

v1.0.0

DuckDB Client:

CLI

Full Name:

Peter Koppstein

Affiliation:

Princeton University

How did you load the extension?

Latest version

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

Did you include all code required to reproduce the issue?

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

Dtenwolde commented 1 month ago

You gave the edge table edges the label knows. The weakly_connected_components table function now won't work with edges, but instead expects knows. This is a bit confusing, especially as the error message is not helpful.

SELECT * FROM weakly_connected_components(my_graph, nodes, knows); 

This should work 🙂

I'll rework the error message