Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d7422b6

Browse files
jude-zhuknightXunlaura-dingCPWstaticShylock-Hg
authored
* remove bigint because we dont support it (vesoft-inc#2031) Co-authored-by: dutor <[email protected]> (cherry picked from commit 3423df1) * fix crash (vesoft-inc#2042) Co-authored-by: dutor <[email protected]> (cherry picked from commit eea7407) * Sampling apply to all edges starting from a vertex. (vesoft-inc#2013) * Sampling from all edges. * Update test for sampling multi edges. * Testing both inbound and outbound. * Fix clang compiling problem. * Update the sampling. Co-authored-by: dutor <[email protected]> (cherry picked from commit 8810ecc) * Fix the error when vertex/edge not exist if update. (vesoft-inc#2025) * Fix the error when vertex/edge not exist if update. * Optimize the atomic error logical. * Fix one alignment. Co-authored-by: dutor <[email protected]> (cherry picked from commit 9fc4e7f) * Correct issue 2009 which the timestamp default value for edge not treat. (vesoft-inc#2038) * Correct issue 2009 which the timestamp default value for edge not treat. * Add the cover cases. * Fix one typo. Co-authored-by: dutor <[email protected]> (cherry picked from commit 4aa9217) Co-authored-by: flyingcat <[email protected]> Co-authored-by: laura-ding <[email protected]> Co-authored-by: CPWstatic <[email protected]> Co-authored-by: Shylock Hg <[email protected]>
1 parent 2ea95f3 commit d7422b6

25 files changed

+270
-161
lines changed

.linters/cpp/checkKeyword.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
'KW_INDEXES',
4949
'KW_REBUILD',
5050
'KW_INT',
51-
'KW_BIGINT',
5251
'KW_DOUBLE',
5352
'KW_STRING',
5453
'KW_BOOL',

src/common/filter/Expressions.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,6 @@ std::string columnTypeToString(ColumnType type) {
615615
return "string";
616616
case ColumnType::DOUBLE:
617617
return "double";
618-
case ColumnType::BIGINT:
619-
return "bigint";
620618
case ColumnType::BOOL:
621619
return "bool";
622620
case ColumnType::TIMESTAMP:
@@ -656,8 +654,6 @@ OptVariantType TypeCastingExpression::eval(Getters &getters) const {
656654
return Expression::toDouble(result.value());
657655
case ColumnType::BOOL:
658656
return Expression::toBool(result.value());
659-
case ColumnType::BIGINT:
660-
return Status::Error("Type bigint not supported yet");
661657
}
662658
LOG(FATAL) << "casting to unknown type: " << static_cast<int>(type_);
663659
}

src/common/filter/Expressions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Cord;
1919
using OptVariantType = StatusOr<VariantType>;
2020

2121
enum class ColumnType {
22-
INT, STRING, DOUBLE, BIGINT, BOOL, TIMESTAMP,
22+
INT, STRING, DOUBLE, BOOL, TIMESTAMP,
2323
};
2424

2525
std::string columnTypeToString(ColumnType type);

src/graph/TraverseExecutor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ nebula::cpp2::SupportedType TraverseExecutor::calculateExprType(Expression* exp)
142142
case Expression::kInputProp: {
143143
auto* propExp = static_cast<const AliasPropertyExpression*>(exp);
144144
const auto* propName = propExp->prop();
145-
if (inputs_ == nullptr) {
145+
if (inputs_ == nullptr || !inputs_->hasData()) {
146146
return nebula::cpp2::SupportedType::UNKNOWN;
147147
} else {
148148
return inputs_->getColumnType(*propName);

src/graph/UpdateEdgeExecutor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void UpdateEdgeExecutor::updateEdge(bool reversely) {
249249
return;
250250
default:
251251
std::string errMsg =
252-
folly::stringPrintf("Maybe edge does not exist or filter failed, "
252+
folly::stringPrintf("Maybe edge does not exist, "
253253
"part: %d, error code: %d!",
254254
code.get_part_id(),
255255
static_cast<int32_t>(code.get_code()));

src/graph/UpdateVertexExecutor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void UpdateVertexExecutor::execute() {
223223
break;
224224
default:
225225
std::string errMsg =
226-
folly::stringPrintf("Maybe vertex does not exist or filter failed, "
226+
folly::stringPrintf("Maybe vertex does not exist, "
227227
"part: %d, error code: %d!",
228228
code.get_part_id(),
229229
static_cast<int32_t>(code.get_code()));

src/graph/test/FetchVerticesTest.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,5 +422,17 @@ TEST_F(FetchVerticesTest, NonexistentProp) {
422422
ASSERT_EQ(cpp2::ErrorCode::E_EXECUTION_ERROR, code);
423423
}
424424
}
425+
426+
TEST_F(FetchVerticesTest, EmptyInput) {
427+
// YIELD has input prop, and input is empty
428+
{
429+
cpp2::ExecutionResponse resp;
430+
auto query = "GO FROM 11 over like YIELD like._dst as id "
431+
"| FETCH PROP ON player 11 YIELD $-.id";
432+
auto code = client_->execute(query, resp);
433+
ASSERT_EQ(cpp2::ErrorCode::E_SYNTAX_ERROR, code);
434+
}
435+
}
436+
425437
} // namespace graph
426438
} // namespace nebula

src/graph/test/SchemaTest.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,5 +1090,34 @@ TEST_F(SchemaTest, TestTagAndEdge) {
10901090
LOG(FATAL) << "Space still exists after sleep " << retry << " seconds";
10911091
}
10921092

1093+
TEST_F(SchemaTest, issue2009) {
1094+
auto client = gEnv->getClient();
1095+
ASSERT_NE(nullptr, client);
1096+
{
1097+
cpp2::ExecutionResponse resp;
1098+
std::string query = "CREATE SPACE issue2009; USE issue2009";
1099+
auto code = client->execute(query, resp);
1100+
ASSERT_EQ(code, cpp2::ErrorCode::SUCCEEDED);
1101+
}
1102+
{
1103+
cpp2::ExecutionResponse resp;
1104+
std::string query = "CREATE EDGE IF NOT EXISTS relation"
1105+
"(intimacy int default 0, "
1106+
"isReversible bool default false, "
1107+
"name string default \"N/A\", "
1108+
"startTime timestamp default 0)";
1109+
auto code = client->execute(query, resp);
1110+
ASSERT_EQ(code, cpp2::ErrorCode::SUCCEEDED);
1111+
}
1112+
::sleep(FLAGS_heartbeat_interval_secs + 1);
1113+
{
1114+
cpp2::ExecutionResponse resp;
1115+
std::string query = "INSERT EDGE relation (intimacy) VALUES "
1116+
"hash(\"person.Tom\") -> hash(\"person.Marry\")@0:(3)";
1117+
auto code = client->execute(query, resp);
1118+
ASSERT_EQ(code, cpp2::ErrorCode::SUCCEEDED);
1119+
}
1120+
}
1121+
10931122
} // namespace graph
10941123
} // namespace nebula

src/meta/processors/schemaMan/CreateEdgeProcessor.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,21 @@ void CreateEdgeProcessor::process(const cpp2::CreateEdgeReq& req) {
102102
}
103103
defaultValue = value->get_string_value();
104104
break;
105-
default:
105+
case nebula::cpp2::SupportedType::TIMESTAMP:
106+
if (value->getType() != nebula::cpp2::Value::Type::timestamp) {
107+
LOG(ERROR) << "Create Edge Failed: " << name
108+
<< " type mismatch";
109+
handleErrorCode(cpp2::ErrorCode::E_CONFLICT);
110+
onFinished();
111+
return;
112+
}
113+
defaultValue = folly::to<std::string>(value->get_timestamp());
106114
break;
115+
default:
116+
LOG(ERROR) << "Unknown type " << static_cast<int>(column.get_type().get_type());
117+
handleErrorCode(cpp2::ErrorCode::E_INVALID_PARM);
118+
onFinished();
119+
return;
107120
}
108121
VLOG(3) << "Get Edge Default value: Property Name " << name
109122
<< ", Value " << defaultValue;

src/meta/processors/schemaMan/CreateTagProcessor.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ void CreateTagProcessor::process(const cpp2::CreateTagReq& req) {
114114
defaultValue = folly::to<std::string>(value->get_timestamp());
115115
break;
116116
default:
117-
LOG(ERROR) << "Unsupported type";
117+
LOG(ERROR) << "Unknown type " << static_cast<int>(column.get_type().get_type());
118+
handleErrorCode(cpp2::ErrorCode::E_INVALID_PARM);
119+
onFinished();
118120
return;
119121
}
120122

0 commit comments

Comments
 (0)