Skip to content

Commit

Permalink
Merge branch 'master' into enhancement/pattern-expression
Browse files Browse the repository at this point in the history
  • Loading branch information
Sophie-Xie authored Nov 29, 2022
2 parents 27ca400 + 298c7d9 commit c011382
Show file tree
Hide file tree
Showing 53 changed files with 430 additions and 227 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,18 @@ jobs:
OSS_DIR: nebula-graph/package/nightly
container:
image: vesoft/nebula-dev:${{ matrix.os }}
services:
elasticsearch:
image: elasticsearch:7.17.7
ports:
- 9200:9200
env:
discovery.type: single-node
options: >-
--health-cmd "curl elasticsearch:9200"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: webiny/action-post-run@2.0.1
with:
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ jobs:
volumes:
- /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}:/tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
options: --cap-add=SYS_PTRACE
services:
elasticsearch:
image: elasticsearch:7.17.7
ports:
- 9200:9200
env:
discovery.type: single-node
options: >-
--health-cmd "curl elasticsearch:9200"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: webiny/action-post-run@2.0.1
with:
Expand Down
58 changes: 58 additions & 0 deletions conf/nebula-storaged-listener.conf.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
########## nebula-storaged-listener ###########
########## basics ##########
# Whether to run as a daemon process
--daemonize=true
# The file to host the process id
--pid_file=pids_listener/nebula-storaged.pid
# Whether to use the configuration obtained from the configuration file
--local_config=true

########## logging ##########
# The directory to host logging files
--log_dir=logs_listener
# Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively
--minloglevel=0
# Verbose log level, 1, 2, 3, 4, the higher of the level, the more verbose of the logging
--v=0
# Maximum seconds to buffer the log messages
--logbufsecs=0
# Whether to redirect stdout and stderr to separate output files
--redirect_stdout=true
# Destination filename of stdout and stderr, which will also reside in log_dir.
--stdout_log_file=storaged-stdout.log
--stderr_log_file=storaged-stderr.log
# Copy log messages at or above this level to stderr in addition to logfiles. The numbers of severity levels INFO, WARNING, ERROR, and FATAL are 0, 1, 2, and 3, respectively.
--stderrthreshold=2
# Wether logging files' name contain timestamp.
--timestamp_in_logfile_name=true

########## networking ##########
# Meta server address
--meta_server_addrs=127.0.0.1:9559
# Local ip
--local_ip=127.0.0.1
# Storage daemon listening port
--port=9789
# HTTP service ip
--ws_ip=127.0.0.1
# HTTP service port
--ws_http_port=19789
# heartbeat with meta service
--heartbeat_interval_secs=10

########## storage ##########
# Listener wal directory. only one path is allowed.
--listener_path=data/listener
# This parameter can be ignored for compatibility. let's fill A default value of "data"
--data_path=data
# The type of part manager, [memory | meta]
--part_man_type=memory
# The default reserved bytes for one batch operation
--rocksdb_batch_size=4096
# The default block cache size used in BlockBasedTable.
# The unit is MB.
--rocksdb_block_cache=4
# The type of storage engine, `rocksdb', `memory', etc.
--engine_type=rocksdb
# The type of part, `simple', `consensus'...
--part_type=simple
4 changes: 2 additions & 2 deletions src/codec/RowReaderV1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ Value RowReaderV1::getValueByName(const std::string& prop) const noexcept {

Value RowReaderV1::getValueByIndex(const int64_t index) const noexcept {
if (index < 0 || static_cast<size_t>(index) >= schema_->getNumFields()) {
return Value(NullType::UNKNOWN_PROP);
return Value(NullType::__NULL__);
}
auto vType = getSchema()->getFieldType(index);
if (PropertyType::UNKNOWN == vType) {
return Value(NullType::UNKNOWN_PROP);
return Value(NullType::__NULL__);
}
switch (vType) {
case PropertyType::BOOL:
Expand Down
2 changes: 1 addition & 1 deletion src/codec/RowReaderV2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Value RowReaderV2::getValueByName(const std::string& prop) const noexcept {

Value RowReaderV2::getValueByIndex(const int64_t index) const noexcept {
if (index < 0 || static_cast<size_t>(index) >= schema_->getNumFields()) {
return Value(NullType::UNKNOWN_PROP);
return Value(NullType::__NULL__);
}

auto field = schema_->field(index);
Expand Down
2 changes: 1 addition & 1 deletion src/common/datatypes/Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct Map {
const Value& at(const std::string& key) const {
auto iter = kvs.find(key);
if (iter == kvs.end()) {
return Value::kNullUnknownProp;
return Value::kNullValue;
}
return iter->second;
}
Expand Down
4 changes: 0 additions & 4 deletions src/common/datatypes/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const Value Value::kNullNaN(NullType::NaN);
const Value Value::kNullBadData(NullType::BAD_DATA);
const Value Value::kNullBadType(NullType::BAD_TYPE);
const Value Value::kNullOverflow(NullType::ERR_OVERFLOW);
const Value Value::kNullUnknownProp(NullType::UNKNOWN_PROP);
const Value Value::kNullDivByZero(NullType::DIV_BY_ZERO);
const Value Value::kNullOutOfRange(NullType::OUT_OF_RANGE);

Expand Down Expand Up @@ -320,7 +319,6 @@ const std::string& Value::typeName() const {
{NullType::BAD_DATA, "BAD_DATA"},
{NullType::BAD_TYPE, "BAD_TYPE"},
{NullType::ERR_OVERFLOW, "ERR_OVERFLOW"},
{NullType::UNKNOWN_PROP, "UNKNOWN_PROP"},
{NullType::DIV_BY_ZERO, "DIV_BY_ZERO"},
};

Expand Down Expand Up @@ -1564,8 +1562,6 @@ std::string Value::toString() const {
return "__NULL_OVERFLOW__";
case NullType::NaN:
return "__NULL_NaN__";
case NullType::UNKNOWN_PROP:
return "__NULL_UNKNOWN_PROP__";
case NullType::OUT_OF_RANGE:
return "__NULL_OUT_OF_RANGE__";
}
Expand Down
6 changes: 2 additions & 4 deletions src/common/datatypes/Value.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ enum class NullType {
BAD_DATA = 2,
BAD_TYPE = 3,
ERR_OVERFLOW = 4,
UNKNOWN_PROP = 5,
DIV_BY_ZERO = 6,
OUT_OF_RANGE = 7,
};
Expand All @@ -52,7 +51,6 @@ struct Value {
static const Value kNullBadData;
static const Value kNullBadType;
static const Value kNullOverflow;
static const Value kNullUnknownProp;
static const Value kNullDivByZero;
static const Value kNullOutOfRange;

Expand Down Expand Up @@ -157,8 +155,8 @@ struct Value {
}
auto& null = value_.nVal;
return null == NullType::NaN || null == NullType::BAD_DATA || null == NullType::BAD_TYPE ||
null == NullType::ERR_OVERFLOW || null == NullType::UNKNOWN_PROP ||
null == NullType::DIV_BY_ZERO || null == NullType::OUT_OF_RANGE;
null == NullType::ERR_OVERFLOW || null == NullType::DIV_BY_ZERO ||
null == NullType::OUT_OF_RANGE;
}
bool isNumeric() const {
return type_ == Type::INT || type_ == Type::FLOAT;
Expand Down
2 changes: 0 additions & 2 deletions src/common/datatypes/test/ValueTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,6 @@ TEST(Value, typeName) {
EXPECT_EQ("BAD_DATA", Value::kNullBadData.typeName());
EXPECT_EQ("BAD_TYPE", Value::kNullBadType.typeName());
EXPECT_EQ("ERR_OVERFLOW", Value::kNullOverflow.typeName());
EXPECT_EQ("UNKNOWN_PROP", Value::kNullUnknownProp.typeName());
EXPECT_EQ("DIV_BY_ZERO", Value::kNullDivByZero.typeName());
}

Expand All @@ -1582,7 +1581,6 @@ TEST(Value, DecodeEncode) {
Value(NullType::BAD_DATA),
Value(NullType::ERR_OVERFLOW),
Value(NullType::OUT_OF_RANGE),
Value(NullType::UNKNOWN_PROP),

// int
Value(0),
Expand Down
2 changes: 1 addition & 1 deletion src/common/datatypes/test/ValueToJsonTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ TEST(ValueToJson, DecodeEncode) {
Value(NullType::BAD_DATA),
Value(NullType::ERR_OVERFLOW),
Value(NullType::OUT_OF_RANGE),
Value(NullType::UNKNOWN_PROP),
Value(NullType::__NULL__),

// int
Value(0),
Expand Down
2 changes: 1 addition & 1 deletion src/common/expression/AttributeExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const Value &AttributeExpression::eval(ExpressionContext &ctx) {
return iter->second;
}
}
return Value::kNullUnknownProp;
return Value::kNullValue;
}
case Value::Type::EDGE: {
DCHECK(!rvalue.getStr().empty());
Expand Down
6 changes: 3 additions & 3 deletions src/common/expression/test/AttributeExpressionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ TEST_F(AttributeExpressionTest, DateTimeAttribute) {
auto *right = LabelExpression::make(&pool, "not exist attribute");
auto expr = AttributeExpression::make(&pool, left, right);
auto value = Expression::eval(expr, gExpCtxt);
ASSERT_EQ(Value::kNullUnknownProp, value);
ASSERT_EQ(Value::kNullValue, value);
}
{
auto *left = ConstantExpression::make(&pool, Value(dt));
Expand All @@ -148,7 +148,7 @@ TEST_F(AttributeExpressionTest, DateTimeAttribute) {
auto *right = LabelExpression::make(&pool, "not exist attribute");
auto expr = AttributeExpression::make(&pool, left, right);
auto value = Expression::eval(expr, gExpCtxt);
ASSERT_EQ(Value::kNullUnknownProp, value);
ASSERT_EQ(Value::kNullValue, value);
}
{
auto *left = ConstantExpression::make(&pool, Value(d));
Expand All @@ -162,7 +162,7 @@ TEST_F(AttributeExpressionTest, DateTimeAttribute) {
auto *right = LabelExpression::make(&pool, "not exist attribute");
auto expr = AttributeExpression::make(&pool, left, right);
auto value = Expression::eval(expr, gExpCtxt);
ASSERT_EQ(Value::kNullUnknownProp, value);
ASSERT_EQ(Value::kNullValue, value);
}
{
auto *left = ConstantExpression::make(&pool, Value(t));
Expand Down
1 change: 0 additions & 1 deletion src/common/expression/test/SubscriptExpressionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ TEST_F(SubscriptExpressionTest, MapSubscript) {
auto expr = SubscriptExpression::make(&pool, map, key);
auto value = Expression::eval(expr, gExpCtxt);
ASSERT_TRUE(value.isNull());
ASSERT_TRUE(value.isBadNull());
}
// {"key1":1,"key2":2, "key3":3}[0]
{
Expand Down
6 changes: 3 additions & 3 deletions src/common/time/TimeUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class TimeUtils {
} else if (lowerProp == "microsecond") {
return static_cast<int>(dt.microsec);
} else {
return Value::kNullUnknownProp;
return Value::kNullValue;
}
}

Expand Down Expand Up @@ -160,7 +160,7 @@ class TimeUtils {
} else if (lowerProp == "day") {
return d.day;
} else {
return Value::kNullUnknownProp;
return Value::kNullValue;
}
}

Expand Down Expand Up @@ -203,7 +203,7 @@ class TimeUtils {
} else if (lowerProp == "microsecond") {
return t.microsec;
} else {
return Value::kNullUnknownProp;
return Value::kNullValue;
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/common/utils/IndexKeyUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ StatusOr<Value> IndexKeyUtils::readValueWithLatestSche(RowReader* reader,
const std::string propName,
const meta::SchemaProviderIf* latestSchema) {
auto value = reader->getValueByName(propName);
if (latestSchema == nullptr || !value.isNull() || value.getNull() != NullType::UNKNOWN_PROP) {
if (latestSchema == nullptr || !value.isNull() || value.getNull() != NullType::__NULL__) {
return value;
}
auto field = latestSchema->field(propName);
Expand All @@ -230,9 +230,6 @@ Status IndexKeyUtils::checkValue(const Value& v, bool isNullable) {
}

switch (v.getNull()) {
case nebula::NullType::UNKNOWN_PROP: {
return Status::Error("Unknown prop");
}
case nebula::NullType::__NULL__: {
if (!isNullable) {
return Status::Error("Not allowed to be null");
Expand Down
1 change: 1 addition & 0 deletions src/graph/context/ast/QueryAstContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ struct SubgraphContext final : public AstContext {
Expression* tagFilter{nullptr};
Expression* edgeFilter{nullptr};
std::vector<std::string> colNames;
std::unordered_set<std::string> edgeNames;
std::unordered_set<EdgeType> edgeTypes;
std::unordered_set<EdgeType> biDirectEdgeTypes;
std::vector<Value::Type> colType;
Expand Down
4 changes: 2 additions & 2 deletions src/graph/executor/logic/ArgumentExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ folly::Future<Status> ArgumentExecutor::execute() {
ds.rows.reserve(iter->size());
std::unordered_set<Value> unique;
for (; iter->valid(); iter->next()) {
auto val = iter->getColumn(alias);
auto &val = iter->getColumn(alias);
if (!val.isVertex()) {
return Status::Error("Argument only support vertex, but got %s, which is type %s, ",
val.toString().c_str(),
val.typeName().c_str());
}
if (unique.emplace(val.getVertex().vid).second) {
Row row;
row.values.emplace_back(std::move(val));
row.values.emplace_back(val);
ds.rows.emplace_back(std::move(row));
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/graph/planner/match/MatchPathPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ Status MatchPathPlanner::findStarts(
auto nodeFinder = finder();
if (nodeFinder->match(&nodeCtx)) {
auto plan = nodeFinder->transform(&nodeCtx);
if (!plan.ok()) {
return plan.status();
}
NG_RETURN_IF_ERROR(plan);
matchClausePlan = std::move(plan).value();
startIndex = i;
foundStart = true;
Expand All @@ -153,9 +151,7 @@ Status MatchPathPlanner::findStarts(
auto edgeFinder = finder();
if (edgeFinder->match(&edgeCtx)) {
auto plan = edgeFinder->transform(&edgeCtx);
if (!plan.ok()) {
return plan.status();
}
NG_RETURN_IF_ERROR(plan);
matchClausePlan = std::move(plan).value();
startFromEdge = true;
startIndex = i;
Expand Down
2 changes: 1 addition & 1 deletion src/graph/planner/plan/Logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void Argument::cloneMembers(const Argument& arg) {
}

std::unique_ptr<PlanNodeDescription> Argument::explain() const {
auto desc = PlanNode::explain();
auto desc = SingleInputNode::explain();
addDescription("inputVar", inputVar(), desc.get());
return desc;
}
Expand Down
Loading

0 comments on commit c011382

Please sign in to comment.