cwida / duckpgq-extension

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

Improve error element_id #68

Open Dtenwolde opened 9 months ago

Dtenwolde commented 9 months ago

The current error when using element_id(o) is:

Catalog Error: Scalar Function with name element_id does not exist!
Did you mean "element_at"?

As the way element_id is implemented is by checking the column list and seeing if there is a function named element_id, matching a named subpath. If the named subpath is not found, this will throw the above error, which is confusing. Change it to a more helpful error message.

Dtenwolde commented 9 months ago

Same goes for vertices(), edges(), and path_length(). Which are currently implemented using list_slice and len(list). Perhaps these should be implemented as new UDFs, though they risk having the same parallelism issue as shortestpath.

Dtenwolde commented 8 months ago

A related issue is in the following test case in shortest_path.test

-FROM GRAPH_TABLE (pg
    MATCH
    p = ANY SHORTEST (a:Person)-[k:knows]->{1,3}(b:Person)
    WHERE a.name = 'Daniel'
    COLUMNS (p, a.name as name, b.name as b_name)
    ) study;

Binder Error: Referenced column "p" not found in FROM clause!

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Dtenwolde commented 1 month ago

A cleaner way to implement this is to rename the UDFs shortestpath to element_id, iterativelength to path_length and create UDFs for vertices, edges. Or at least register these functions such that the error above will suggest to use this UDF. The actual implementation will completely rewrite the query of course and might not even trigger the UDF if the path finding operator is introduced. To be continued