Mayil-AI-Sandbox / kuzudb_jan15

MIT License
0 stars 0 forks source link

Better error message for not supporting multi-label node queries (hashtag2753) #39

Open vikramsubramanian opened 4 months ago

vikramsubramanian commented 4 months ago

We support multi-label relationship queries but not multi-label node queries. The error we give when one tries is not explicit:

kuzu> MATCH (a:UniKG_r|UniKG_l) RETURN *;
Error: Parser exception: Invalid input <MATCH (a:UniKG_r|>: expected rule oC_SingleQuery (line: 1, offset: 16)
"MATCH (a:UniKG_r|UniKG_l) RETURN *"

)

mayil-ai[bot] commented 4 months ago

Summary: Error message for not supporting multi-label node queries is not explicit.

Possible Solution

Based on the error message provided and the code snippets, the issue seems to be with the syntax of the MATCH clause in the query MATCH (a:UniKG_r|UniKG_l) RETURN *;. The parser is expecting a single label for a node but is receiving a pattern that looks like it's trying to match nodes with multiple labels, which is not supported.

To resolve the issue:

Here's a potential solution if you want to update the error message:

In src/parser/antlr_parser/kuzu_cypher_parser.cpp, add a new function to handle the specific error for multi-label node queries:

void KuzuCypherParser::notifyInvalidMultiLabelNodeQuery(antlr4::Token* startToken) {
    auto errorMsg = "Multi-label node queries are not supported. Please specify a single label for each node.";
    notifyErrorListeners(startToken, errorMsg, nullptr);
}

Then, in the parsing logic (not provided in the snippets), you would call this new function when the parser detects a multi-label pattern for a node. This would provide users with a more informative error message when they attempt to use unsupported syntax.

Code snippets to check