diff --git a/.linters/cpp/checkKeyword.py b/.linters/cpp/checkKeyword.py index deba075b2ebaad29fb4c983317d53780a5a3a5fb..bd9b9304951bf94e0886f8ba67d8b3adb1786336 100755 --- a/.linters/cpp/checkKeyword.py +++ b/.linters/cpp/checkKeyword.py @@ -93,6 +93,8 @@ reserved_key_words = [ 'KW_FLUSH', 'KW_SUBMIT', 'KW_ASC', + 'KW_ASCENDING', + 'KW_DESCENDING', 'KW_DISTINCT', 'KW_FETCH', 'KW_PROP', diff --git a/src/parser/parser.yy b/src/parser/parser.yy index 52058c83c19e413b95fc283681a384e9a42a4408..d68ff21dd0a385f4ab156c4a3da4a299f20c6cf0 100644 --- a/src/parser/parser.yy +++ b/src/parser/parser.yy @@ -165,7 +165,7 @@ static constexpr size_t MAX_ABS_INTEGER = 9223372036854775808ULL; %token KW_GET KW_DECLARE KW_GRAPH KW_META KW_STORAGE %token KW_TTL KW_TTL_DURATION KW_TTL_COL KW_DATA KW_STOP %token KW_FETCH KW_PROP KW_UPDATE KW_UPSERT KW_WHEN -%token KW_ORDER KW_ASC KW_LIMIT KW_OFFSET +%token KW_ORDER KW_ASC KW_LIMIT KW_OFFSET KW_ASCENDING KW_DESCENDING %token KW_DISTINCT KW_ALL KW_OF %token KW_BALANCE KW_LEADER KW_RESET KW_PLAN %token KW_SHORTEST KW_PATH KW_NOLOOP @@ -1696,6 +1696,12 @@ order_factor | expression KW_DESC { $$ = new OrderFactor($1, OrderFactor::DESCEND); } + | expression KW_ASCENDING { + $$ = new OrderFactor($1, OrderFactor::ASCEND); + } + | expression KW_DESCENDING { + $$ = new OrderFactor($1, OrderFactor::DESCEND); + } ; order_factors diff --git a/src/parser/scanner.lex b/src/parser/scanner.lex index 08717ba707bb7514792c44778f729c065dc30460..22f29abc2955b1c4c54c59fa205080092c24d70d 100644 --- a/src/parser/scanner.lex +++ b/src/parser/scanner.lex @@ -120,6 +120,8 @@ IP_OCTET ([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]) "FLUSH" { return TokenType::KW_FLUSH; } "SUBMIT" { return TokenType::KW_SUBMIT; } "ASC" { return TokenType::KW_ASC; } +"ASCENDING" { return TokenType::KW_ASCENDING; } +"DESCENDING" { return TokenType::KW_DESCENDING; } "DISTINCT" { return TokenType::KW_DISTINCT; } "FETCH" { return TokenType::KW_FETCH; } "PROP" { return TokenType::KW_PROP; } diff --git a/tests/tck/features/match/MatchById.IntVid.feature b/tests/tck/features/match/MatchById.IntVid.feature index 565fb2783c08392a5e4c97890ed233a3c2cccac8..5228c3aa5d9d487282e2b7064ededc2fd7033e96 100644 --- a/tests/tck/features/match/MatchById.IntVid.feature +++ b/tests/tck/features/match/MatchById.IntVid.feature @@ -260,7 +260,7 @@ Feature: Integer Vid Match By Id MATCH (v1) -[:like]-> (v) WHERE id(v1) == hash('Dejounte Murray') RETURN v.name AS Name, v.age AS Age - ORDER BY Age DESC, Name ASC + ORDER BY Age DESC, Name ASCENDING LIMIT 3 """ Then the result should be, in any order, with relax comparison: @@ -273,7 +273,7 @@ Feature: Integer Vid Match By Id MATCH (v1) -[:like]-> (v) WHERE id(v1) == hash('Dejounte Murray') RETURN v.name AS Name, v.age AS Age - ORDER BY Age DESC, Name ASC + ORDER BY Age DESCENDING, Name ASC SKIP 3 """ Then the result should be, in any order, with relax comparison: