Skip to content

Commit

Permalink
Support the tck format for the output of EXPLAIN
Browse files Browse the repository at this point in the history
  • Loading branch information
AntiTopQuark authored and xtcyclist committed Mar 29, 2023
1 parent 6afe749 commit e2c35ea
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions src/graph/service/QueryInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,31 +113,14 @@ Status QueryInstance::validateAndOptimize() {
return Status::OK();
}

// Check format type string, if it is "tck", return true, otherwise return false
static bool isTckFmtType(const std::string& formatType) {
if (formatType.empty()) {
return false;
}

std::string fmtType = formatType;
std::transform(formatType.cbegin(), formatType.cend(), fmtType.begin(), [](char c) {
return std::tolower(c);
});

return fmtType == "tck";
}

bool QueryInstance::explainOrContinue() {
if (sentence_->kind() != Sentence::Kind::kExplain) {
return true;
}
auto &resp = qctx_->rctx()->resp();
resp.planDesc = std::make_unique<PlanDescription>();
DCHECK_NOTNULL(qctx_->plan())->describe(resp.planDesc.get());
const auto *explainSentence = static_cast<const ExplainSentence *>(sentence_.get());
auto is_profile = explainSentence->isProfile();
auto is_tck_fmt_type = isTckFmtType(explainSentence->formatType());
return is_profile || is_tck_fmt_type;
return static_cast<const ExplainSentence *>(sentence_.get())->isProfile();
}

void QueryInstance::onFinish() {
Expand Down

0 comments on commit e2c35ea

Please sign in to comment.