diff --git a/src/graph/util/ExpressionUtils.h b/src/graph/util/ExpressionUtils.h index b68c3323ed5..f42241f348b 100644 --- a/src/graph/util/ExpressionUtils.h +++ b/src/graph/util/ExpressionUtils.h @@ -167,7 +167,6 @@ class ExpressionUtils { static bool checkExprDepth(const Expression* expr); - private: static constexpr int32_t kMaxDepth = 512; }; diff --git a/src/parser/parser.yy b/src/parser/parser.yy index f1bb729f342..21164635d67 100644 --- a/src/parser/parser.yy +++ b/src/parser/parser.yy @@ -558,7 +558,9 @@ expression : expression_internal { if(!graph::ExpressionUtils::checkExprDepth($1)){ delete $1; - throw nebula::GraphParser::syntax_error(@1, "The above expression's depth exceeds the maximum depth:512!"); + std::ostringstream errStr; + errStr << "The above expression's depth exceeds the maximum depth:" << graph::ExpressionUtils::kMaxDepth; + throw nebula::GraphParser::syntax_error(@1, errStr.str()); } $$ = $1; } diff --git a/tests/tck/features/expression/Depth.feature b/tests/tck/features/expression/Depth.feature index 6555b42cd4d..71bf5e3498e 100644 --- a/tests/tck/features/expression/Depth.feature +++ b/tests/tck/features/expression/Depth.feature @@ -75,7 +75,7 @@ Feature: Check Expression Depth 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 AS result """ - Then a SyntaxError should be raised at runtime: The above expression's depth exceeds the maximum depth! + Then a SyntaxError should be raised at runtime: The above expression's depth exceeds the maximum depth When executing query: """ YIELD 1 IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS @@ -156,4 +156,4 @@ Feature: Check Expression Depth NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL IS NULL AS result """ - Then a SyntaxError should be raised at runtime: The above expression's depth exceeds the maximum depth! + Then a SyntaxError should be raised at runtime: The above expression's depth exceeds the maximum depth