Skip to content

Commit

Permalink
Merge branch 'master' into add_vertex_key
Browse files Browse the repository at this point in the history
  • Loading branch information
cangfengzhs authored Dec 6, 2021
2 parents 21473fe + dd06a53 commit 21987fb
Show file tree
Hide file tree
Showing 25 changed files with 232 additions and 70 deletions.
14 changes: 7 additions & 7 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -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.
<!-- Please check the [FAQ](https://docs.nebula-graph.com.cn/master/20.appendix/0.FAQ/) 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.
<!-- A clear and concise description of what the bug is. -->

**Your Environments (__required__)**

Expand All @@ -32,8 +32,8 @@ Steps to reproduce the behavior:

**Expected behavior**

A clear and concise description of what you expected to happen.
<!-- 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.
<!-- Provide logs and configs, or any other context to trace the problem. -->
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/enhancement.md
Original file line number Diff line number Diff line change
@@ -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**
<!-- concise introduction to problem, motivation, and overview of proposed solution -->

## Contents
**Contents**
<!-- Please describe the enhancement what you want in this section -->

## Related work
**Related work**
<!-- In this section you can add other related tasks to help assigner to complete the task more easily -->
14 changes: 7 additions & 7 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -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 [...]
<!-- 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.
<!-- 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.
<!-- 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.
<!-- Add any other context or screenshots about the feature request here. -->
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ about: I want to ask a question.
labels: question
---

## General Question
**General Question**

<!--
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -109,7 +108,6 @@ jobs:
-DENABLE_COVERAGE=on \
-B build
echo "::set-output name=j::10"
echo "::set-output name=t::6"
;;
esac
;;
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions src/graph/optimizer/rule/CollapseProjectRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/graph/optimizer/rule/PushLimitDownGetNeighborsRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
26 changes: 26 additions & 0 deletions src/graph/planner/plan/Query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@
#include <folly/json.h>
#include <thrift/lib/cpp/util/EnumUtils.h>

#include "graph/util/ExpressionUtils.h"
#include "graph/util/ToJson.h"

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<PlanNodeDescription> Explore::explain() const {
auto desc = SingleInputNode::explain();
addDescription("space", folly::to<std::string>(space_), desc.get());
Expand Down Expand Up @@ -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<PlanNodeDescription> Limit::explain() const {
auto desc = SingleInputNode::explain();
addDescription("offset", folly::to<std::string>(offset_), desc.get());
Expand Down Expand Up @@ -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<PlanNodeDescription> Sample::explain() const {
auto desc = SingleInputNode::explain();
addDescription("count", count_->toString(), desc.get());
Expand Down
26 changes: 3 additions & 23 deletions src/graph/planner/plan/Query.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/graph/util/FTIndexUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 0 additions & 1 deletion src/graph/util/FTIndexUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions src/graph/validator/FindPathValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/graph/validator/MutateValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
8 changes: 8 additions & 0 deletions src/graph/visitor/EvaluableExprVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
};

Expand Down
2 changes: 2 additions & 0 deletions src/graph/visitor/VidExtractVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include "graph/visitor/VidExtractVisitor.h"

#include "graph/util/ExpressionUtils.h"

namespace nebula {
namespace graph {

Expand Down
4 changes: 1 addition & 3 deletions src/mock/MockCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions src/parser/Clauses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 21987fb

Please sign in to comment.