-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix aysn block revert nebula-python url disable homonymic parameter variable support sdk interface of map/list support go from parameter support list and map fix tck support fetch small fix for point initialization fix tck add tck support subgraph support find path small change
- Loading branch information
Showing
51 changed files
with
647 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* Copyright (c) 2021 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
#include "common/expression/ParameterExpression.h" | ||
|
||
#include "common/expression/ExprVisitor.h" | ||
|
||
namespace nebula { | ||
|
||
const Value& ParameterExpression::eval(ExpressionContext& ectx) { return ectx.getVar(name_); } | ||
|
||
std::string ParameterExpression::toString() const { return '$' + name_; } | ||
|
||
bool ParameterExpression::operator==(const Expression& rhs) const { | ||
if (kind_ != rhs.kind()) { | ||
return false; | ||
} | ||
const auto& expr = static_cast<const ParameterExpression&>(rhs); | ||
return name_ == expr.name(); | ||
} | ||
|
||
void ParameterExpression::writeTo(Encoder& encoder) const { | ||
encoder << kind_; | ||
encoder << name_; | ||
} | ||
|
||
void ParameterExpression::resetFrom(Decoder& decoder) { name_ = decoder.readStr(); } | ||
|
||
void ParameterExpression::accept(ExprVisitor* visitor) { visitor->visit(this); } | ||
|
||
} // namespace nebula |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* Copyright (c) 2021 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "common/expression/Expression.h" | ||
|
||
// The ParameterExpression use for parameterized statement | ||
namespace nebula { | ||
|
||
class ParameterExpression : public Expression { | ||
public: | ||
ParameterExpression& operator=(const ParameterExpression& rhs) = delete; | ||
ParameterExpression& operator=(ParameterExpression&&) = delete; | ||
|
||
static ParameterExpression* make(ObjectPool* pool, const std::string& name = "") { | ||
return pool->add(new ParameterExpression(pool, name)); | ||
} | ||
|
||
bool operator==(const Expression& rhs) const override; | ||
|
||
const Value& eval(ExpressionContext& ctx) override; | ||
|
||
const std::string& name() const { return name_; } | ||
|
||
std::string toString() const override; | ||
|
||
void accept(ExprVisitor* visitor) override; | ||
|
||
Expression* clone() const override { return ParameterExpression::make(pool_, name()); } | ||
|
||
protected: | ||
explicit ParameterExpression(ObjectPool* pool, const std::string& name = "") | ||
: Expression(pool, Kind::kParam), name_(name) {} | ||
|
||
void writeTo(Encoder& encoder) const override; | ||
void resetFrom(Decoder& decoder) override; | ||
|
||
protected: | ||
std::string name_; | ||
Value result_; | ||
}; | ||
|
||
} // namespace nebula |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* Copyright (c) 2021 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
#include "common/expression/test/TestBase.h" | ||
|
||
namespace nebula { | ||
|
||
class ParameterExpressionTest : public ExpressionTest {}; | ||
|
||
TEST_F(ParameterExpressionTest, ParamExprToString) { | ||
auto expr = ParameterExpression::make(&pool, "param1"); | ||
ASSERT_EQ("$param1", expr->toString()); | ||
} | ||
|
||
TEST_F(ParameterExpressionTest, ParamEvaluate) { | ||
auto expr = ParameterExpression::make(&pool, "param1"); | ||
auto value = Expression::eval(expr, gExpCtxt); | ||
ASSERT_TRUE(value.isInt()); | ||
ASSERT_EQ(1, value.getInt()); | ||
} | ||
} // namespace nebula | ||
|
||
int main(int argc, char **argv) { | ||
testing::InitGoogleTest(&argc, argv); | ||
folly::init(&argc, &argv, true); | ||
google::SetStderrLogging(google::INFO); | ||
|
||
return RUN_ALL_TESTS(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.