Open vikramsubramanian opened 4 months ago
Summary: Lack of support for nested logical and arithmetic negations in the system.
To address the issue of supporting nested negations in Kùzu, follow these steps:
Update the grammar rules in the parser to recognize nested negations. This involves modifying the BNF (Backus-Naur Form) or whichever formal grammar is used to define the syntax of expressions in Kùzu.
NOT
operator to be applied to both boolean literals and negated expressions.-
operator to be applied to both numeric literals and negated expressions.Modify the parse_expression
function to correctly construct an abstract syntax tree (AST) that represents nested negations.
Update the evaluate_logical_expression
function to handle nested logical negations.
NOT
expressions, where NOT NOT expression
should evaluate to the value of expression
.Update the evaluate_arithmetic_expression
function to handle nested arithmetic negations.
-
expressions, where - - value
should evaluate to value
.Add error handling for unsupported expressions or incorrect usage of negations.
Write unit tests to cover cases of nested negations to ensure the parser and evaluator work as expected.
NOT
and -
operators with different types of operands.Since the issue is identified by hashtag2682, make sure to reference this in commit messages or issue tracking systems to maintain a clear link between the issue report and the code changes made to resolve it.
Ignore the provided code snippets as they do not directly relate to the implementation of the parser or evaluator functions for nested negations.
In both DuckDB and neo4j, nested logical negations and arithmetic negations are both valid. (eg.
NOT NOT TRUE
and- - 29
)We do not support this currently. )