mirror of https://gitee.com/bigwinds/arangodb
Bug fix 3.5/allow not like (#9991)
* allow NOT LIKE, NOT =~ and !~ in grammar * updated CHANGELOG * added derive files
This commit is contained in:
parent
c7b0e68026
commit
8830aad557
|
@ -1,6 +1,10 @@
|
|||
v3.5.1 (XXXX-XX-XX)
|
||||
-------------------
|
||||
|
||||
* Added support for AQL expressions such as `a NOT LIKE b`, `a NOT =~ b` and
|
||||
`a NOT !~ b`. Previous versions of ArangoDB did not support these expressions,
|
||||
and using them in an AQL query resulted in a parse error.
|
||||
|
||||
* Disallow creation of TTL indexes on sub-attributes.
|
||||
|
||||
Creation of such indexes was not caught before, but the resulting
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,9 @@
|
|||
/* A Bison parser, made by GNU Bison 3.0.5. */
|
||||
/* A Bison parser, made by GNU Bison 3.3.2. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,6 +31,9 @@
|
|||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
/* Undocumented macros, especially those whose name start with YY_,
|
||||
are private implementation details. Do not rely on them. */
|
||||
|
||||
#ifndef YY_AQL_AQL_GRAMMAR_HPP_INCLUDED
|
||||
# define YY_AQL_AQL_GRAMMAR_HPP_INCLUDED
|
||||
/* Debug traces. */
|
||||
|
@ -126,7 +130,7 @@ extern int Aqldebug;
|
|||
|
||||
union YYSTYPE
|
||||
{
|
||||
#line 35 "Aql/grammar.y" /* yacc.c:1910 */
|
||||
#line 35 "Aql/grammar.y" /* yacc.c:1921 */
|
||||
|
||||
arangodb::aql::AstNode* node;
|
||||
struct {
|
||||
|
@ -136,7 +140,7 @@ union YYSTYPE
|
|||
bool boolval;
|
||||
int64_t intval;
|
||||
|
||||
#line 140 "Aql/grammar.hpp" /* yacc.c:1910 */
|
||||
#line 144 "Aql/grammar.hpp" /* yacc.c:1921 */
|
||||
};
|
||||
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/* A Bison parser, made by GNU Bison 3.0.5. */
|
||||
/* A Bison parser, made by GNU Bison 3.3.2. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,6 +31,9 @@
|
|||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
/* Undocumented macros, especially those whose name start with YY_,
|
||||
are private implementation details. Do not rely on them. */
|
||||
|
||||
#ifndef YY_AQL_AQL_GRAMMAR_HPP_INCLUDED
|
||||
# define YY_AQL_AQL_GRAMMAR_HPP_INCLUDED
|
||||
/* Debug traces. */
|
||||
|
@ -126,7 +130,7 @@ extern int Aqldebug;
|
|||
|
||||
union YYSTYPE
|
||||
{
|
||||
#line 35 "Aql/grammar.y" /* yacc.c:1910 */
|
||||
#line 35 "Aql/grammar.y" /* yacc.c:1921 */
|
||||
|
||||
arangodb::aql::AstNode* node;
|
||||
struct {
|
||||
|
@ -136,7 +140,7 @@ union YYSTYPE
|
|||
bool boolval;
|
||||
int64_t intval;
|
||||
|
||||
#line 140 "Aql/grammar.hpp" /* yacc.c:1910 */
|
||||
#line 144 "Aql/grammar.hpp" /* yacc.c:1921 */
|
||||
};
|
||||
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
|
|
|
@ -1382,6 +1382,26 @@ operator_binary:
|
|||
| expression T_NOT T_IN expression {
|
||||
$$ = parser->ast()->createNodeBinaryOperator(NODE_TYPE_OPERATOR_BINARY_NIN, $1, $4);
|
||||
}
|
||||
| expression T_NOT T_LIKE expression {
|
||||
AstNode* arguments = parser->ast()->createNodeArray(2);
|
||||
arguments->addMember($1);
|
||||
arguments->addMember($4);
|
||||
AstNode* expression = parser->ast()->createNodeFunctionCall(TRI_CHAR_LENGTH_PAIR("LIKE"), arguments);
|
||||
$$ = parser->ast()->createNodeUnaryOperator(NODE_TYPE_OPERATOR_UNARY_NOT, expression);
|
||||
}
|
||||
| expression T_NOT T_REGEX_MATCH expression {
|
||||
AstNode* arguments = parser->ast()->createNodeArray(2);
|
||||
arguments->addMember($1);
|
||||
arguments->addMember($4);
|
||||
AstNode* expression = parser->ast()->createNodeFunctionCall(TRI_CHAR_LENGTH_PAIR("REGEX_TEST"), arguments);
|
||||
$$ = parser->ast()->createNodeUnaryOperator(NODE_TYPE_OPERATOR_UNARY_NOT, expression);
|
||||
}
|
||||
| expression T_NOT T_REGEX_NON_MATCH expression {
|
||||
AstNode* arguments = parser->ast()->createNodeArray(2);
|
||||
arguments->addMember($1);
|
||||
arguments->addMember($4);
|
||||
$$ = parser->ast()->createNodeFunctionCall(TRI_CHAR_LENGTH_PAIR("REGEX_TEST"), arguments);
|
||||
}
|
||||
| expression T_LIKE expression {
|
||||
AstNode* arguments = parser->ast()->createNodeArray(2);
|
||||
arguments->addMember($1);
|
||||
|
|
|
@ -428,8 +428,52 @@ function ahuacatlParseTestSuite () {
|
|||
assertEqual(7, sub[1].subNodes[0].value);
|
||||
assertEqual("value", sub[1].subNodes[1].type);
|
||||
assertEqual(8, sub[1].subNodes[1].value);
|
||||
}
|
||||
},
|
||||
|
||||
testNotLike : function() {
|
||||
let result = AQL_PARSE("RETURN 'a' NOT LIKE 'b'").ast;
|
||||
|
||||
assertEqual("root", result[0].type);
|
||||
result = result[0].subNodes;
|
||||
|
||||
assertEqual("return", result[0].type);
|
||||
result = result[0].subNodes;
|
||||
|
||||
assertEqual("unary not", result[0].type);
|
||||
let sub = result[0].subNodes[0];
|
||||
|
||||
assertEqual("function call", sub.type);
|
||||
assertEqual("LIKE", sub.name);
|
||||
},
|
||||
|
||||
testNotMatches : function() {
|
||||
let result = AQL_PARSE("RETURN 'a' NOT =~ 'b'").ast;
|
||||
|
||||
assertEqual("root", result[0].type);
|
||||
result = result[0].subNodes;
|
||||
|
||||
assertEqual("return", result[0].type);
|
||||
result = result[0].subNodes;
|
||||
|
||||
assertEqual("unary not", result[0].type);
|
||||
let sub = result[0].subNodes[0];
|
||||
|
||||
assertEqual("function call", sub.type);
|
||||
assertEqual("REGEX_TEST", sub.name);
|
||||
},
|
||||
|
||||
testNotNotMatches : function() {
|
||||
let result = AQL_PARSE("RETURN 'a' NOT !~ 'b'").ast;
|
||||
|
||||
assertEqual("root", result[0].type);
|
||||
result = result[0].subNodes;
|
||||
|
||||
assertEqual("return", result[0].type);
|
||||
result = result[0].subNodes;
|
||||
|
||||
assertEqual("function call", result[0].type);
|
||||
assertEqual("REGEX_TEST", result[0].name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue