From 7d0bfedbfe5f39c087b2d28a3885c0283a99b942 Mon Sep 17 00:00:00 2001 From: Yee <2520865+yixinglu@users.noreply.github.com> Date: Fri, 3 Dec 2021 11:29:53 +0800 Subject: [PATCH 1/8] Increase the number of jobs at compile time (#3401) --- .github/workflows/nightly.yml | 4 +--- .github/workflows/pull_request.yml | 6 +----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index f5e7f5f3f19..19004ffab4c 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -126,12 +126,10 @@ jobs: -DENABLE_COVERAGE=on \ -B build echo "::set-output name=j::8" - echo "::set-output name=t::6" - name: Make run: | ccache -z - cmake --build build/ -j ${{ steps.cmake.outputs.j }} --target nebula-metad nebula-storaged nebula-graphd - cmake --build build/ -j ${{ steps.cmake.outputs.t }} + cmake --build build/ -j $(nproc) ccache -s - name: CTest env: diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 7757ba606d2..08bfd000fbc 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -97,7 +97,6 @@ jobs: -DENABLE_TESTING=on \ -B build echo "::set-output name=j::10" - echo "::set-output name=t::$(nproc)" ;; ubuntu2004) # build with Debug type @@ -109,7 +108,6 @@ jobs: -DENABLE_COVERAGE=on \ -B build echo "::set-output name=j::10" - echo "::set-output name=t::6" ;; esac ;; @@ -123,14 +121,12 @@ jobs: -DENABLE_TESTING=on \ -B build echo "::set-output name=j::6" - echo "::set-output name=t::10" ;; esac - name: Make run: | ccache -z - cmake --build build/ -j $(nproc) --target nebula-metad nebula-storaged nebula-graphd - cmake --build build/ -j ${{ steps.cmake.outputs.t }} + cmake --build build/ -j $(nproc) ccache -s - name: CTest env: From 69bd48f392578f7f9c222af6a960c92623d9e342 Mon Sep 17 00:00:00 2001 From: "kyle.cao" Date: Fri, 3 Dec 2021 15:16:51 +0800 Subject: [PATCH 2/8] fix evaluableExprVisitor (#3389) --- src/graph/visitor/EvaluableExprVisitor.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/graph/visitor/EvaluableExprVisitor.h b/src/graph/visitor/EvaluableExprVisitor.h index 6e8aec319f3..9c1beb7c7d8 100644 --- a/src/graph/visitor/EvaluableExprVisitor.h +++ b/src/graph/visitor/EvaluableExprVisitor.h @@ -56,6 +56,14 @@ class EvaluableExprVisitor : public ExprVisitorImpl { void visit(SubscriptRangeExpression *) override { isEvaluable_ = false; } + void visitBinaryExpr(BinaryExpression *expr) override { + expr->left()->accept(this); + // Evaluable sub-expression should be obscured by the non-evaluable sub-expression. + if (isEvaluable_) { + expr->right()->accept(this); + } + } + bool isEvaluable_{true}; }; From 43e4585e319ac31842878af3659dc3149755b88a Mon Sep 17 00:00:00 2001 From: "kyle.cao" Date: Mon, 6 Dec 2021 11:18:13 +0800 Subject: [PATCH 3/8] small optimization to avoid recompilation (#3398) --- .../optimizer/rule/CollapseProjectRule.cpp | 1 + .../OptimizeEdgeIndexScanByFilterRule.cpp | 1 + .../rule/OptimizeTagIndexScanByFilterRule.cpp | 1 + .../rule/PushLimitDownGetNeighborsRule.cpp | 1 + .../PushStepLimitDownGetNeighborsRule.cpp | 1 + .../PushStepSampleDownGetNeighborsRule.cpp | 1 + src/graph/planner/plan/Query.cpp | 26 +++++++++++++++++++ src/graph/planner/plan/Query.h | 26 +++---------------- src/graph/util/FTIndexUtils.cpp | 1 + src/graph/util/FTIndexUtils.h | 1 - src/graph/validator/FindPathValidator.cpp | 1 + src/graph/validator/MutateValidator.cpp | 1 + src/graph/visitor/VidExtractVisitor.cpp | 2 ++ src/mock/MockCluster.h | 4 +-- src/parser/Clauses.cpp | 11 ++++++++ src/parser/Clauses.h | 10 +------ 16 files changed, 53 insertions(+), 36 deletions(-) diff --git a/src/graph/optimizer/rule/CollapseProjectRule.cpp b/src/graph/optimizer/rule/CollapseProjectRule.cpp index c2f6764229a..a40974c1c0d 100644 --- a/src/graph/optimizer/rule/CollapseProjectRule.cpp +++ b/src/graph/optimizer/rule/CollapseProjectRule.cpp @@ -9,6 +9,7 @@ #include "graph/optimizer/OptGroup.h" #include "graph/planner/plan/PlanNode.h" #include "graph/planner/plan/Query.h" +#include "graph/util/ExpressionUtils.h" using nebula::graph::PlanNode; using nebula::graph::QueryContext; diff --git a/src/graph/optimizer/rule/OptimizeEdgeIndexScanByFilterRule.cpp b/src/graph/optimizer/rule/OptimizeEdgeIndexScanByFilterRule.cpp index 92964ec0f47..3471d0947d1 100644 --- a/src/graph/optimizer/rule/OptimizeEdgeIndexScanByFilterRule.cpp +++ b/src/graph/optimizer/rule/OptimizeEdgeIndexScanByFilterRule.cpp @@ -11,6 +11,7 @@ #include "graph/optimizer/OptimizerUtils.h" #include "graph/planner/plan/PlanNode.h" #include "graph/planner/plan/Scan.h" +#include "graph/util/ExpressionUtils.h" using nebula::Expression; using nebula::graph::EdgeIndexFullScan; diff --git a/src/graph/optimizer/rule/OptimizeTagIndexScanByFilterRule.cpp b/src/graph/optimizer/rule/OptimizeTagIndexScanByFilterRule.cpp index 008cce33843..60bf9ab1f80 100644 --- a/src/graph/optimizer/rule/OptimizeTagIndexScanByFilterRule.cpp +++ b/src/graph/optimizer/rule/OptimizeTagIndexScanByFilterRule.cpp @@ -12,6 +12,7 @@ #include "graph/optimizer/rule/IndexScanRule.h" #include "graph/planner/plan/PlanNode.h" #include "graph/planner/plan/Scan.h" +#include "graph/util/ExpressionUtils.h" using nebula::graph::Filter; using nebula::graph::OptimizerUtils; diff --git a/src/graph/optimizer/rule/PushLimitDownGetNeighborsRule.cpp b/src/graph/optimizer/rule/PushLimitDownGetNeighborsRule.cpp index ce806640403..85a2ee6ff92 100644 --- a/src/graph/optimizer/rule/PushLimitDownGetNeighborsRule.cpp +++ b/src/graph/optimizer/rule/PushLimitDownGetNeighborsRule.cpp @@ -9,6 +9,7 @@ #include "graph/optimizer/OptGroup.h" #include "graph/planner/plan/PlanNode.h" #include "graph/planner/plan/Query.h" +#include "graph/util/ExpressionUtils.h" using nebula::graph::GetNeighbors; using nebula::graph::Limit; diff --git a/src/graph/optimizer/rule/PushStepLimitDownGetNeighborsRule.cpp b/src/graph/optimizer/rule/PushStepLimitDownGetNeighborsRule.cpp index 460725bc90f..4cc457b95bc 100644 --- a/src/graph/optimizer/rule/PushStepLimitDownGetNeighborsRule.cpp +++ b/src/graph/optimizer/rule/PushStepLimitDownGetNeighborsRule.cpp @@ -9,6 +9,7 @@ #include "graph/optimizer/OptGroup.h" #include "graph/planner/plan/PlanNode.h" #include "graph/planner/plan/Query.h" +#include "graph/util/ExpressionUtils.h" using nebula::graph::GetNeighbors; using nebula::graph::Limit; diff --git a/src/graph/optimizer/rule/PushStepSampleDownGetNeighborsRule.cpp b/src/graph/optimizer/rule/PushStepSampleDownGetNeighborsRule.cpp index 30d9afb4c74..39beb7be84d 100644 --- a/src/graph/optimizer/rule/PushStepSampleDownGetNeighborsRule.cpp +++ b/src/graph/optimizer/rule/PushStepSampleDownGetNeighborsRule.cpp @@ -9,6 +9,7 @@ #include "graph/optimizer/OptGroup.h" #include "graph/planner/plan/PlanNode.h" #include "graph/planner/plan/Query.h" +#include "graph/util/ExpressionUtils.h" using nebula::graph::GetNeighbors; using nebula::graph::PlanNode; diff --git a/src/graph/planner/plan/Query.cpp b/src/graph/planner/plan/Query.cpp index 988f8b33245..b45c4bb88a6 100644 --- a/src/graph/planner/plan/Query.cpp +++ b/src/graph/planner/plan/Query.cpp @@ -10,6 +10,7 @@ #include #include +#include "graph/util/ExpressionUtils.h" #include "graph/util/ToJson.h" using folly::stringPrintf; @@ -17,6 +18,11 @@ using folly::stringPrintf; namespace nebula { namespace graph { +int64_t Explore::limit() const { + QueryExpressionContext ctx; + DCHECK(ExpressionUtils::isEvaluableExpr(limit_)); + return DCHECK_NOTNULL(limit_)->eval(ctx).getInt(); +} std::unique_ptr Explore::explain() const { auto desc = SingleInputNode::explain(); addDescription("space", folly::to(space_), desc.get()); @@ -318,6 +324,17 @@ void Sort::cloneMembers(const Sort& p) { factors_ = std::move(factors); } +// Get constant count value +int64_t Limit::count() const { + if (count_ == nullptr) { + return -1; + } + DCHECK(ExpressionUtils::isEvaluableExpr(count_)); + QueryExpressionContext ctx; + auto s = count_->eval(ctx).getInt(); + DCHECK_GE(s, 0); + return s; +} std::unique_ptr Limit::explain() const { auto desc = SingleInputNode::explain(); addDescription("offset", folly::to(offset_), desc.get()); @@ -364,6 +381,15 @@ void TopN::cloneMembers(const TopN& l) { count_ = l.count_; } +// Get constant count +int64_t Sample::count() const { + DCHECK(ExpressionUtils::isEvaluableExpr(count_)); + QueryExpressionContext qec; + auto count = count_->eval(qec).getInt(); + DCHECK_GE(count, 0); + return count; +} + std::unique_ptr Sample::explain() const { auto desc = SingleInputNode::explain(); addDescription("count", count_->toString(), desc.get()); diff --git a/src/graph/planner/plan/Query.h b/src/graph/planner/plan/Query.h index 2f74d3883d7..076b7471b53 100644 --- a/src/graph/planner/plan/Query.h +++ b/src/graph/planner/plan/Query.h @@ -35,11 +35,7 @@ class Explore : public SingleInputNode { bool dedup() const { return dedup_; } // Get the constant limit value - int64_t limit() const { - QueryExpressionContext ctx; - DCHECK(ExpressionUtils::isEvaluableExpr(limit_)); - return DCHECK_NOTNULL(limit_)->eval(ctx).getInt(); - } + int64_t limit() const; // Get the limit value in runtime int64_t limit(QueryExpressionContext& ctx) const { @@ -682,17 +678,7 @@ class Limit final : public SingleInputNode { int64_t offset() const { return offset_; } // Get constant count value - int64_t count() const { - if (count_ == nullptr) { - return -1; - } - DCHECK(ExpressionUtils::isEvaluableExpr(count_)); - QueryExpressionContext ctx; - auto s = count_->eval(ctx).getInt(); - DCHECK_GE(s, 0); - return s; - } - + int64_t count() const; // Get count in runtime int64_t count(QueryExpressionContext& ctx) const { if (count_ == nullptr) { @@ -801,13 +787,7 @@ class Sample final : public SingleInputNode { } // Get constant count - int64_t count() const { - DCHECK(ExpressionUtils::isEvaluableExpr(count_)); - QueryExpressionContext qec; - auto count = count_->eval(qec).getInt(); - DCHECK_GE(count, 0); - return count; - } + int64_t count() const; // Get Runtime count int64_t count(QueryExpressionContext& qec) const { diff --git a/src/graph/util/FTIndexUtils.cpp b/src/graph/util/FTIndexUtils.cpp index 289d0d20606..82d97cee8f4 100644 --- a/src/graph/util/FTIndexUtils.cpp +++ b/src/graph/util/FTIndexUtils.cpp @@ -6,6 +6,7 @@ #include "graph/util/FTIndexUtils.h" #include "common/expression/Expression.h" +#include "graph/util/ExpressionUtils.h" DECLARE_uint32(ft_request_retry_times); diff --git a/src/graph/util/FTIndexUtils.h b/src/graph/util/FTIndexUtils.h index 43ae6319220..cbca1bd4444 100644 --- a/src/graph/util/FTIndexUtils.h +++ b/src/graph/util/FTIndexUtils.h @@ -9,7 +9,6 @@ #include "clients/meta/MetaClient.h" #include "common/base/StatusOr.h" #include "common/plugin/fulltext/elasticsearch/ESGraphAdapter.h" -#include "graph/util/ExpressionUtils.h" #include "graph/util/SchemaUtil.h" #include "parser/MaintainSentences.h" diff --git a/src/graph/validator/FindPathValidator.cpp b/src/graph/validator/FindPathValidator.cpp index 8fcf186f2df..bfd39c137d6 100644 --- a/src/graph/validator/FindPathValidator.cpp +++ b/src/graph/validator/FindPathValidator.cpp @@ -7,6 +7,7 @@ #include "graph/planner/plan/Algo.h" #include "graph/planner/plan/Logic.h" +#include "graph/util/ExpressionUtils.h" #include "graph/util/ValidateUtil.h" namespace nebula { diff --git a/src/graph/validator/MutateValidator.cpp b/src/graph/validator/MutateValidator.cpp index 9048dab224f..9fbb5500a85 100644 --- a/src/graph/validator/MutateValidator.cpp +++ b/src/graph/validator/MutateValidator.cpp @@ -7,6 +7,7 @@ #include "common/expression/LabelAttributeExpression.h" #include "graph/planner/plan/Mutate.h" #include "graph/planner/plan/Query.h" +#include "graph/util/ExpressionUtils.h" #include "graph/util/SchemaUtil.h" #include "graph/visitor/RewriteSymExprVisitor.h" diff --git a/src/graph/visitor/VidExtractVisitor.cpp b/src/graph/visitor/VidExtractVisitor.cpp index c70b75c4420..82cc0e1dff4 100644 --- a/src/graph/visitor/VidExtractVisitor.cpp +++ b/src/graph/visitor/VidExtractVisitor.cpp @@ -5,6 +5,8 @@ #include "graph/visitor/VidExtractVisitor.h" +#include "graph/util/ExpressionUtils.h" + namespace nebula { namespace graph { diff --git a/src/mock/MockCluster.h b/src/mock/MockCluster.h index 8548a0e51f4..cd8d565a445 100644 --- a/src/mock/MockCluster.h +++ b/src/mock/MockCluster.h @@ -41,9 +41,7 @@ class MockCluster { void startMeta(const std::string& rootPath, HostAddr addr = HostAddr("127.0.0.1", 0)); - void startStorage(HostAddr addr, - const std::string& rootPath, - SchemaVer schemaVerCount = 1); + void startStorage(HostAddr addr, const std::string& rootPath, SchemaVer schemaVerCount = 1); /** * Init a meta client connect to current meta server. diff --git a/src/parser/Clauses.cpp b/src/parser/Clauses.cpp index bd483639584..e5eddbb8399 100644 --- a/src/parser/Clauses.cpp +++ b/src/parser/Clauses.cpp @@ -5,8 +5,19 @@ #include "parser/Clauses.h" +#include "graph/util/ExpressionUtils.h" + namespace nebula { +bool YieldColumns::hasAgg() const { + for (auto &col : columns_) { + if (graph::ExpressionUtils::findAny(col->expr(), {Expression::Kind::kAggregate})) { + return true; + } + } + return false; +} + std::string StepClause::toString() const { std::string buf; buf.reserve(256); diff --git a/src/parser/Clauses.h b/src/parser/Clauses.h index 5ca7d024e2c..4d7fa6c9b41 100644 --- a/src/parser/Clauses.h +++ b/src/parser/Clauses.h @@ -7,7 +7,6 @@ #include "common/base/Base.h" #include "common/expression/Expression.h" -#include "graph/util/ExpressionUtils.h" #include "interface/gen-cpp2/storage_types.h" namespace nebula { @@ -275,14 +274,7 @@ class YieldColumns final { YieldColumn *back() { return columns_.back().get(); } - bool hasAgg() const { - for (auto &col : columns_) { - if (graph::ExpressionUtils::findAny(col->expr(), {Expression::Kind::kAggregate})) { - return true; - } - } - return false; - } + bool hasAgg() const; private: std::vector> columns_; From dd06a5390e0b5387853e14e0a2c0271bb232174b Mon Sep 17 00:00:00 2001 From: Sophie-Xie <84560950+Sophie-Xie@users.noreply.github.com> Date: Mon, 6 Dec 2021 13:34:21 +0800 Subject: [PATCH 4/8] enhancement issue template (#3410) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * “enhancement-template” * “fix-feature-request” * Update feature_request.md Co-authored-by: Shylock Hg <33566796+Shylock-Hg@users.noreply.github.com> --- .github/ISSUE_TEMPLATE/bug-report.md | 14 +++++++------- .github/ISSUE_TEMPLATE/enhancement.md | 10 +++++----- .github/ISSUE_TEMPLATE/feature_request.md | 14 +++++++------- .github/ISSUE_TEMPLATE/question.md | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index f05425a1117..ae5f80c3df0 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -1,19 +1,19 @@ --- -name: Bug report -about: Help us to improve this project +name: Bug Report +about: I want to report a bug. title: '' -labels: bug +labels: type/bug assignees: '' --- **Please check the FAQ documentation before raising an issue** -Please check the [FAQ](https://github.com/vesoft-inc/nebula/blob/master/docs/manual-EN/1.overview/2.quick-start/2.FAQ.md) documentation and old issues before raising an issue in case someone has asked the same question that you are asking. + **Describe the bug (__required__)** -A clear and concise description of what the bug is. + **Your Environments (__required__)** @@ -32,8 +32,8 @@ Steps to reproduce the behavior: **Expected behavior** -A clear and concise description of what you expected to happen. + **Additional context** -Provide logs and configs, or any other context to trace the problem. + diff --git a/.github/ISSUE_TEMPLATE/enhancement.md b/.github/ISSUE_TEMPLATE/enhancement.md index 17621bcdaea..f59770fc787 100644 --- a/.github/ISSUE_TEMPLATE/enhancement.md +++ b/.github/ISSUE_TEMPLATE/enhancement.md @@ -1,16 +1,16 @@ --- name: Enhancement -about: make the code neat or more efficient. +about: Suggest an enhancement to make the code neat or more efficient. title: '' -labels: enhancement +labels: type/enhancement assignees: '' --- -## Introduction +**Introduction** -## Contents +**Contents** -## Related work +**Related work** diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 56458012d0c..a019e6a33e5 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,20 +1,20 @@ --- -name: Feature request -about: Suggest an idea for this project +name: Feature Request +about: Suggest a feature for this project. title: '' -labels: feature req +labels: type/feature req assignees: '' --- **Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + **Describe the solution you'd like** -A clear and concise description of what you want to happen. + **Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. + **Additional context** -Add any other context or screenshots about the feature request here. + diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index 6a047bd99a0..3017396f6a6 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -4,7 +4,7 @@ about: I want to ask a question. labels: question --- -## General Question +**General Question**