Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick 3.3 (1017-1020) #4761

Merged
merged 8 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/clients/meta/MetaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,9 +918,13 @@ Status MetaClient::handleResponse(const RESP& resp) {
return Status::Error("Stop job failure!");
case nebula::cpp2::ErrorCode::E_SAVE_JOB_FAILURE:
return Status::Error("Save job failure!");
case nebula::cpp2::ErrorCode::E_JOB_NOT_STOPPABLE:
case nebula::cpp2::ErrorCode::E_JOB_ALREADY_FINISH:
return Status::Error(
"Finished job or failed job can not be stopped, please start another job instead");
case nebula::cpp2::ErrorCode::E_JOB_NOT_STOPPABLE:
return Status::Error(
"The job type do not support stopping, either wait previous job done or restart the "
"cluster to start another job");
case nebula::cpp2::ErrorCode::E_BALANCER_FAILURE:
return Status::Error("Balance failure!");
case nebula::cpp2::ErrorCode::E_NO_INVALID_BALANCE_PLAN:
Expand Down
2 changes: 2 additions & 0 deletions src/common/hdfs/HdfsCommandHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Status HdfsCommandHelper::ls(const std::string& hdfsHost,
folly::Subprocess proc(std::vector<std::string>({"/bin/bash", "-c", command}));
auto result = proc.wait();
if (!result.exited()) {
LOG(INFO) << "Failed to ls: " << result.str();
return Status::Error("Failed to ls hdfs");
} else if (result.exitStatus() != 0) {
LOG(INFO) << "Failed to ls: " << result.str();
Expand All @@ -49,6 +50,7 @@ Status HdfsCommandHelper::copyToLocal(const std::string& hdfsHost,
folly::Subprocess proc(std::vector<std::string>({"/bin/bash", "-c", command}));
auto result = proc.wait();
if (!result.exited()) {
LOG(INFO) << "Failed to download: " << result.str();
return Status::Error("Failed to download from hdfs");
} else if (result.exitStatus() != 0) {
LOG(INFO) << "Failed to download: " << result.str();
Expand Down
6 changes: 2 additions & 4 deletions src/graph/context/ast/QueryAstContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,10 @@ struct GoContext final : AstContext {
bool joinInput{false};
// true when $$.tag.prop exist
bool joinDst{false};
// true when yield clause only yield distinct dst id
bool onlyYieldDistinctDstId{false};
// true when edge props only use dst id
bool edgePropsOnlyUseDstId{false};
// Optimize for some simple go sentence which only need dst id.
bool isSimple{false};
// The column name used by plan node`GetDstBySrc`
std::string dstIdColName{kDst};

ExpressionProps exprProps;

Expand Down
16 changes: 9 additions & 7 deletions src/graph/planner/match/MatchPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,19 @@ Status MatchPlanner::connectMatchPlan(SubPlan& queryPlan, MatchClauseContext* ma
if (matchCtx->isOptional) {
// connect LeftJoin match filter
auto& whereCtx = matchCtx->where;
if (whereCtx.get() != nullptr) {
auto exprs =
ExpressionUtils::collectAll(whereCtx->filter, {Expression::Kind::kLabelTagProperty});
if (whereCtx.get() != nullptr && whereCtx->filter != nullptr) {
auto exprs = ExpressionUtils::collectAll(
whereCtx->filter, {Expression::Kind::kVarProperty, Expression::Kind::kLabel});

// Check if all aliases in where clause are generated by the current match statement pattern
std::vector<std::string> aliases;
for (const auto* expr : exprs) {
DCHECK_EQ(expr->kind(), Expression::Kind::kLabelTagProperty);
auto* labelExpr = static_cast<const LabelTagPropertyExpression*>(expr)->label();
DCHECK_EQ(labelExpr->kind(), Expression::Kind::kVarProperty);
aliases.emplace_back(static_cast<const PropertyExpression*>(labelExpr)->prop());
if (expr->kind() == Expression::Kind::kVarProperty) {
aliases.emplace_back(static_cast<const PropertyExpression*>(expr)->prop());
} else {
DCHECK_EQ(expr->kind(), Expression::Kind::kLabel);
aliases.emplace_back(static_cast<const LabelExpression*>(expr)->name());
}
}
auto aliasesGenerated = matchCtx->aliasesGenerated;
if (!std::all_of(aliases.begin(), aliases.end(), [&aliasesGenerated](std::string& alias) {
Expand Down
Loading