duckgql
Fügt DuckDB ISO-GQL-Graphabfragen und Graphalgorithmen hinzu
Maintainer: rahul-iyer
Installation und Laden
INSTALL duckgql FROM community;LOAD duckgql;Beispiel
COPY ( SELECT * FROM (VALUES ('p1', 'Ada', 'Person'), ('p2', 'Grace', 'Person') ) nodes(":ID(People)", "name:string", ":LABEL")) TO 'duckgql_nodes.csv' (FORMAT CSV, HEADER);
COPY ( SELECT * FROM (VALUES ('p1', 'p2', 'KNOWS') ) edges(":START_ID(People)", ":END_ID(People)", ":TYPE")) TO 'duckgql_edges.csv' (FORMAT CSV, HEADER);
CREATE GRAPH social ANY;
COPY GRAPH social FROM ( VERTICES 'duckgql_nodes.csv', EDGES 'duckgql_edges.csv') FORMAT GRAPH;
SESSION SET GRAPH social;
MATCH (person:Person)-[:KNOWS]->(friend:Person)RETURN person.name, friend.name;Über duckgql
DuckGQL ist eine experimentelle C++17-Erweiterung, die eine wachsende Teilmenge von ISO/IEC 39075:2024 GQL zu DuckDB hinzufügt. Sie verbindet Graph-Pattern-Abfragen und Mutationen mit DuckDBs nativer relationaler Speicher- und Ausführungs-Engine sowie einer expliziten CSR-Schicht für Graphalgorithmen.
Was in v0.1.1 funktioniert
- Verwaltete Property Graphs, die auf typisierten DuckDB-Vertex- und Kantentabellen basieren.
- Inline typisierte Graphschemas, die im Katalog persistieren und sofort
eingeschränkte Vertex- und Kantentabellen materialisieren, ohne
COPY GRAPH. - Graph-Header-CSV, komprimiertes CSV und Parquet-Bulk-Import mit optionaler Endpunkt- und Identitätsvalidierung.
- Gerichtetes
MATCH,OPTIONAL MATCH, Filterung, Projektion, Aggregation, Sortierung, Paging, feste Multi-Hop-Muster und eine begrenzte Teilmenge variabler Pfade. - Eigenständiges Knoten- und gerichtetes Pfad-
INSERT, festes gerichtetesMATCH-und-INSERT, Ein-Knoten-INSERT RETURN, Property- und Label- Mutation sowie Kanten-/Knotendeletion. - Native DuckDB-ART-Indizes für selektive Gleichheitslookups auf Vertex-Properties.
- Explizites CSR-gestütztes BFS, DFS, ungewichtetes SSSP, PageRank, schwache und starke Zusammenhangskomponenten, Louvain-Community-Detection, Degree, Closeness, lokaler Clustering-Koeffizient und Triangle Counting.
Speicher- und Ausführungsmodell
Vertices und Kanten bleiben autoritative gewöhnliche DuckDB-Tabellen und nicht Entity-Attribute-Value-Zeilen. Knoten behalten ihre vollständige Label-Menge, und jede Kante hat genau einen unveränderlichen Typ. DuckGQL senkt Graphabfragen auf native relationale DuckDB-Pläne, sodass DuckDB Scans, Joins, Aggregation, Sortierung und rekursive CTEs ausführt. Der Graph-Optimizer kann Tabellen-Scans, native Property-Indizes, Node-Label-Postings und selektive Fixed-Hop-CSR-Expansion wählen. CSR-Snapshots werden explizit abgeleitet und sind kein zweiter autoritativer Graphspeicher.
Projektstatus
DuckGQL v0.1.1 ist noch keine vollständige oder konforme ISO-GQL-Implementierung. Grammatikerkennung impliziert keine semantische oder transaktionale Konformität. Das maschinenlesbare Conformance-Manifest klassifiziert derzeit 24 Feature- Familien als partiell und 12 als geplant. Wichtige Einschränkungen umfassen Graph-Lebenszyklus- und CSR-Operationen nur mit Autocommit, verbindungs-lokale CSR- Snapshots, eine einzige Vertex- und Kanteneingabe pro Bulk-Load sowie unvollständige allgemeine Pfadsuchen, Query-Komposition, Prozeduren und das vollständige GQL- Werte-/Typsystem.
Siehe die Dokumentation, inspizieren Sie das Conformance-Manifest oder testen Sie den Browser-Playground.
Hinzugefügte Funktionen
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| bfs | table | NULL | NULL | |
| closeness | table | NULL | NULL | |
| degree | table | NULL | NULL | |
| dfs | table | NULL | NULL | |
| gql_algorithm_call | table | NULL | NULL | |
| gql_algorithm_result | table | NULL | NULL | |
| gql_build_csr | table | NULL | NULL | |
| gql_clear_properties_source | table | NULL | NULL | |
| gql_create_property_index | table | NULL | NULL | |
| gql_csr_edge_stats | table | NULL | NULL | |
| gql_csr_expand | table | NULL | NULL | |
| gql_csr_path_expand | table | NULL | NULL | |
| gql_csr_stats | table | NULL | NULL | |
| gql_csr_vertices | table | NULL | NULL | |
| gql_drop_property_index | table | NULL | NULL | |
| gql_edge_fetch | table | NULL | NULL | |
| gql_graphs | table | NULL | NULL | |
| gql_insert_ids | table | NULL | NULL | |
| gql_insert_result | table | NULL | NULL | |
| gql_insert_target | table | NULL | NULL | |
| gql_match_insert_ids | table | NULL | NULL | |
| gql_match_recursive | table | NULL | NULL | |
| gql_match_relational | table | NULL | NULL | |
| gql_merge_id | table | NULL | NULL | |
| gql_merge_target | table | NULL | NULL | |
| gql_mutation_control | table | NULL | NULL | |
| gql_mutation_graph | table | NULL | NULL | |
| gql_mutation_target | table | NULL | NULL | |
| gql_neighbors | table | NULL | NULL | |
| gql_property_indexes | table | NULL | NULL | |
| gql_vertex_fetch | table | NULL | NULL | |
| lcc | table | NULL | NULL | |
| louvain | table | NULL | NULL | |
| pagerank | table | NULL | NULL | |
| scc | table | NULL | NULL | |
| sssp | table | NULL | NULL | |
| triangle_count | table | NULL | NULL | |
| wcc | table | NULL | NULL |
Überladene Funktionen
Diese Erweiterung fügt keine Funktionsüberladungen hinzu.
Hinzugefügte Typen
Diese Erweiterung fügt keine Typen hinzu.
Hinzugefügte Einstellungen
Diese Erweiterung fügt keine Einstellungen hinzu.