-
Notifications
You must be signed in to change notification settings - Fork 17
feat(query): implement CREATE/DROP GRAPH DDL statements for issue #124 #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
XL-Zhao-23
wants to merge
6
commits into
TuGraph-family:master
Choose a base branch
from
XL-Zhao-23:feature/issue-124-basic-ddl
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(query): implement CREATE/DROP GRAPH DDL statements for issue #124 #141
XL-Zhao-23
wants to merge
6
commits into
TuGraph-family:master
from
XL-Zhao-23:feature/issue-124-basic-ddl
Conversation
This file contains hidden or 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
4a91545 to
f8a2883
Compare
Implement bound types using project-standard LabelSet and NodeTypeRef: - BoundVertexType: vertex type with key, labels (LabelSet), and properties - BoundEdgeType: edge type with direction, labels, and node references - NodeTypeRef: enum for Alias/Filler/Empty node type references - NodeOrEdgeTypeFiller: inline type definition support Add binder to convert AST to bound types: - bind_graph_element_type(): entry point for binding - bind_node_type() and bind_edge_type(): specific binding logic - string_to_label_id(): hash-based LabelId generation - bind_node_type_ref(): handle node type reference binding - Support for all value types (numeric, string, temporal, vector) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add plan nodes for DDL catalog operations: - CreateGraph: plan node with graph name, type, and CreateKind - DropGraph: plan node with graph name and if_exists flag - CreateKind enum: Create/CreateIfNotExists/CreateOrReplace - BoundGraphType: Nested variant for graph type definitions Update PlanNode enum with PhysicalCreateGraph and PhysicalDropGraph variants. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add logical planning for CREATE/DROP GRAPH statements: - bind_create_graph(): bind CREATE GRAPH with graph type - bind_drop_graph(): bind DROP GRAPH with if_exists flag - plan_create_graph(): create CreateGraph plan node - plan_drop_graph(): create DropGraph plan node Integrate with existing binder and planner infrastructure. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add optimizer support for catalog modification operations: - Handle CreateGraph plan nodes (pass-through to physical) - Handle DropGraph plan nodes (pass-through to physical) DDL operations don't require complex optimization, so they directly convert from logical to physical plans. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Implement full executor support for DDL operations: CreateGraphBuilder: - Handles Create/CreateIfNotExists/CreateOrReplace semantics - Creates MemoryGraphTypeCatalog from BoundGraphElementType - Registers labels and builds label registry (LabelId → String) - Resolves NodeTypeRef (Alias/Filler/Empty) to VertexTypeRef - Creates MemoryVertexTypeCatalog and MemoryEdgeTypeCatalog - Adds graph to schema catalog with GraphStorage DropGraphBuilder: - Handles if_exists flag - Removes graph from schema catalog Key implementation details: - Two-pass label registration to handle forward references - Label registry to map LabelId back to strings for catalog - resolve_vertex_type_from_node_ref() for flexible node type resolution - get_or_create_vertex_type_by_name() for alias resolution - Full compatibility with minigu_catalog LabelSet and provider traits Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1e9f546 to
b99d7fe
Compare
Add end-to-end test for CREATE GRAPH and DROP GRAPH: Test case (create_drop_graph.gql): - CREATE GRAPH with vertex types (Person, City) - CREATE GRAPH with edge type (Person)-[:LIVES_IN]->(City) - DROP GRAPH to clean up Test verifies: - Complete DDL flow from parsing to execution - Graph type catalog creation with LabelSet - Vertex and edge type registration - NodeTypeRef resolution (Alias references) - Proper catalog cleanup with DROP GRAPH Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
b99d7fe to
aa4cdb5
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Title
feat(query): implement CREATE/DROP GRAPH DDL statements
Type
feat: (new feature)Scope
query: (query engine)parser: (frontend parser)planner: (frontend planner)optimizer: (query optimizer)executor: (execution engine)storage: (storage engine)mvcc: (multi version concurrency control)schema: (graph model and topology)tool: (tools)cli: (cli)sdk: (sdk)none: (N/A)Description
Issue: #124
This PR implements basic DDL support for GQL (Graph Query Language), specifically the
CREATE GRAPHandDROP GRAPHstatements. This enables users to dynamically define graph schemas with vertex types, edge types, and their properties.Example Usage:
CREATE GRAPH mygraph { (Person :Person {lastname STRING, firstname STRING, joined DATE}), (City :City {name STRING, state STRING, country STRING}), (Person)-[:LIVES_IN]->(City) }; DROP GRAPH mygraph;masterbranch.