-
Notifications
You must be signed in to change notification settings - Fork 230
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
added IS NULL and IS NOT NULL unary operators #632
Conversation
char *values[6] = {"1", "1.2", "true", "false", "'string'", "[1,2,3]"}; | ||
for (int i = 0; i < 6; i++) | ||
{ | ||
char buff[100]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buff[1024] just to be aligned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. 128
@@ -182,8 +182,8 @@ static void _buildOperatorsWhitelist(void) { | |||
CYPHER_OP_STARTS_WITH, | |||
CYPHER_OP_ENDS_WITH, | |||
CYPHER_OP_CONTAINS, | |||
// CYPHER_OP_IS_NULL, | |||
// CYPHER_OP_IS_NOT_NULL, | |||
CYPHER_OP_IS_NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
@@ -788,36 +788,10 @@ static AST_Validation _Validate_DELETE_Clauses(const AST *ast, char **reason) { | |||
return AST_VALID; | |||
} | |||
|
|||
// Verify that we handle the projected types. An example of an unsupported projection is: | |||
// RETURN count(a) > 0 | |||
static AST_Validation _Validate_ReturnedTypes(const cypher_astnode_t *return_clause, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
src/ast/ast_build_filter_tree.c
Outdated
@@ -121,7 +126,8 @@ static FT_FilterNode *_convertFalseOperator() { | |||
return FilterTree_CreateExpressionFilter(exp); | |||
} | |||
|
|||
static FT_FilterNode *_convertIntegerOperator(RecordMap *record_map, const cypher_astnode_t *expr) { | |||
static FT_FilterNode *_convertIntegerOperator(RecordMap *record_map, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a single line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
case OP_IS_NOT_NULL: | ||
return FilterTree_CreateExpressionFilter(AR_EXP_FromExpression(record_map, op_node)); | ||
default: | ||
return _CreateFilterSubtree(record_map, op, arg, NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give an example of Unary operator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOT
This line was the function original execution code before the switch scope
src/ast/ast_build_ar_exp.c
Outdated
@@ -164,6 +168,14 @@ static AR_ExpNode *_AR_EXP_FromUnaryOpExpression(RecordMap *record_map, | |||
AR_ExpNode *op = AR_EXP_NewOpNodeFromAST(OP_NOT, 1); | |||
op->op.children[0] = _AR_EXP_FromExpression(record_map, arg); | |||
return op; | |||
} else if(operator == CYPHER_OP_IS_NULL) { | |||
AR_ExpNode *op = AR_EXP_NewOpNodeFromAST(OP_IS_NULL, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place AR_ExpNode *op
at the beginning of the function, such that it is declared once,
AR_ExpNode *op = NULL
have a single else where we assert false.
at the very end simply return op.
397397f
to
217582d
Compare
217582d
to
4bd833e
Compare
* added IS NULL and IS NOT NULL * changed according to PR comments
Added both IS NULL and IS NOT NULL unary operators to the arsenal. They can be used both as an expression the evaluate in RETURN clause, or as a leaf in a filter tree.
Added a test in test_arithmetic_expression.cpp
Enabled some TCK scenarios
Added a flow test for filter testing, since currently no TCK tests are enabled with those tests