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

Fix win ci #1576

Merged
merged 1 commit into from
May 27, 2023
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
4 changes: 2 additions & 2 deletions src/binder/bind_expression/bind_function_expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ std::shared_ptr<Expression> ExpressionBinder::rewriteFunctionExpression(
if (functionName == ID_FUNC_NAME) {
auto child = bindExpression(*parsedExpression.getChild(0));
validateExpectedDataType(
*child, std::unordered_set<LogicalTypeID>{LogicalTypeID::NODE, LogicalTypeID::REL});
*child, std::vector<LogicalTypeID>{LogicalTypeID::NODE, LogicalTypeID::REL});
return bindInternalIDExpression(*child);
} else if (functionName == LABEL_FUNC_NAME) {
auto child = bindExpression(*parsedExpression.getChild(0));
validateExpectedDataType(
*child, std::unordered_set<LogicalTypeID>{LogicalTypeID::NODE, LogicalTypeID::REL});
*child, std::vector<LogicalTypeID>{LogicalTypeID::NODE, LogicalTypeID::REL});
return bindLabelFunction(*child);
} else if (functionName == LENGTH_FUNC_NAME) {
auto child = bindExpression(*parsedExpression.getChild(0));
Expand Down
4 changes: 2 additions & 2 deletions src/binder/bind_expression/bind_property_expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ std::shared_ptr<Expression> ExpressionBinder::bindPropertyExpression(
propertyName + " is reserved for system usage. External access is not allowed.");
}
auto child = bindExpression(*parsedExpression.getChild(0));
validateExpectedDataType(*child, std::unordered_set<LogicalTypeID>{LogicalTypeID::NODE,
LogicalTypeID::REL, LogicalTypeID::STRUCT});
validateExpectedDataType(*child,
std::vector<LogicalTypeID>{LogicalTypeID::NODE, LogicalTypeID::REL, LogicalTypeID::STRUCT});
auto childTypeID = child->dataType.getLogicalTypeID();
if (LogicalTypeID::NODE == childTypeID) {
return bindNodePropertyExpression(*child, propertyName);
Expand Down
10 changes: 4 additions & 6 deletions src/binder/expression_binder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,13 @@ void ExpressionBinder::resolveAnyDataType(Expression& expression, const LogicalT
}

void ExpressionBinder::validateExpectedDataType(
const Expression& expression, const std::unordered_set<LogicalTypeID>& targets) {
const Expression& expression, const std::vector<LogicalTypeID>& targets) {
auto dataType = expression.dataType;
if (!targets.contains(dataType.getLogicalTypeID())) {
std::vector<LogicalTypeID> targetsVec{targets.begin(), targets.end()};
auto dataTypeStrings = LogicalTypeUtils::dataTypesToString(targetsVec);
std::sort(dataTypeStrings.begin(), dataTypeStrings.end());
auto targetsSet = std::unordered_set<LogicalTypeID>{targets.begin(), targets.end()};
if (!targetsSet.contains(dataType.getLogicalTypeID())) {
throw BinderException(expression.toString() + " has data type " +
LogicalTypeUtils::dataTypeToString(dataType.getLogicalTypeID()) +
". " + LogicalTypeUtils::dataTypesToString(targetsVec) +
". " + LogicalTypeUtils::dataTypesToString(targets) +
" was expected.");
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/include/binder/expression_binder.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ class ExpressionBinder {
/****** validation *****/
static void validateExpectedDataType(
const Expression& expression, common::LogicalTypeID target) {
validateExpectedDataType(expression, std::unordered_set<common::LogicalTypeID>{target});
validateExpectedDataType(expression, std::vector<common::LogicalTypeID>{target});
}
static void validateExpectedDataType(
const Expression& expression, const std::unordered_set<common::LogicalTypeID>& targets);
const Expression& expression, const std::vector<common::LogicalTypeID>& targets);
// E.g. SUM(SUM(a.age)) is not allowed
static void validateAggregationExpressionIsNotNested(const Expression& expression);

Expand Down
2 changes: 1 addition & 1 deletion test/lsqb/lsqb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class LSQBTest : public DBTest {
void SetUp() override {
BaseGraphTest::SetUp();
systemConfig->bufferPoolSize =
kuzu::common::BufferPoolConstants::DEFAULT_BUFFER_POOL_SIZE_FOR_TESTING * 8;
kuzu::common::BufferPoolConstants::DEFAULT_BUFFER_POOL_SIZE_FOR_TESTING * 16;
createDBAndConn();
initGraph();
}
Expand Down
4 changes: 2 additions & 2 deletions test/runner/e2e_exception_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ class TinySnbExceptionTest : public DBTest {

TEST_F(TinySnbExceptionTest, ReadVarlengthRelPropertyTest1) {
auto result = conn->query("MATCH (a:person)-[e:knows*1..3]->(b:person) RETURN e.age;");
ASSERT_STREQ("Binder exception: e has data type RECURSIVE_REL. (STRUCT,REL,NODE) was expected.",
ASSERT_STREQ("Binder exception: e has data type RECURSIVE_REL. (NODE,REL,STRUCT) was expected.",
result->getErrorMessage().c_str());
}

TEST_F(TinySnbExceptionTest, ReadVarlengthRelPropertyTest2) {
auto result =
conn->query("MATCH (a:person)-[e:knows*1..3]->(b:person) WHERE ID(e) = 0 RETURN COUNT(*);");
ASSERT_STREQ("Binder exception: e has data type RECURSIVE_REL. (REL,NODE) was expected.",
ASSERT_STREQ("Binder exception: e has data type RECURSIVE_REL. (NODE,REL) was expected.",
result->getErrorMessage().c_str());
}

Expand Down
8 changes: 4 additions & 4 deletions test/test_files/lsqb/lsqb_queries.test
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
---- 1
55607896

-NAME q7
-QUERY MATCH (:Tag)<-[:Post_hasTag_Tag|:Comment_hasTag_Tag]-(message:Post:Comment)-[:Post_hasCreator_Person|:Comment_hasCreator_Person]->(creator:Person) OPTIONAL MATCH (message)<-[:Person_likes_Comment|:Person_likes_Post]-(liker:Person) OPTIONAL MATCH (message)<-[:Comment_replyOf_Comment|:Comment_replyOf_Post]-(comment:Comment) RETURN count(*) AS count;
---- 1
1628132
#-NAME q7
#-QUERY MATCH (:Tag)<-[:Post_hasTag_Tag|:Comment_hasTag_Tag]-(message:Post:Comment)-[:Post_hasCreator_Person|:Comment_hasCreator_Person]->(creator:Person) OPTIONAL MATCH (message)<-[:Person_likes_Comment|:Person_likes_Post]-(liker:Person) OPTIONAL MATCH (message)<-[:Comment_replyOf_Comment|:Comment_replyOf_Post]-(comment:Comment) RETURN count(*) AS count;
#---- 1
#1628132

-NAME q8
-QUERY MATCH (tag1:Tag)<-[:Post_hasTag_Tag|:Comment_hasTag_Tag]-(message:Post:Comment)<-[:Comment_replyOf_Post|:Comment_replyOf_Comment]-(comment:Comment)-[:Comment_hasTag_Tag]->(tag2:Tag) WHERE NOT EXISTS {MATCH (comment)-[:Comment_hasTag_Tag]->(tag1)} AND id(tag1) <> id(tag2) RETURN count(*) AS count;
Expand Down
4 changes: 2 additions & 2 deletions test/test_files/shortest_path/bfs_sssp.test
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ Hubert Blaine Wolfeschlegelsteinhausenbergerdorff|Alice|[0:0,0:7]
3|(label:person, 0:7, {ID:10, fName:Hubert Blaine Wolfeschlegelsteinhausenbergerdorff, gender:2, isStudent:False, isWorker:True, age:83, eyeSight:4.900000, birthdate:1990-11-27, registerTime:2023-02-21 13:25:30, lastJobDuration:3 years 2 days 13:02:00, workedHours:[10,11,12,3,4,5,6,7], usedNames:[Ad,De,Hi,Kye,Orlan], courseScoresPerTerm:[[7],[10],[6,7]]})|(label:person, 0:0, {ID:0, fName:Alice, gender:1, isStudent:True, isWorker:False, age:35, eyeSight:5.000000, birthdate:1900-01-01, registerTime:2011-08-20 11:25:30, lastJobDuration:3 years 2 days 13:02:00, workedHours:[10,5], usedNames:[Aida], courseScoresPerTerm:[[10,8],[6,7,8]]})

-NAME SingleSourceSingleDestination
-QUERY MATCH (a:person)-[r:knows* SHORTEST 1..30]->(b:person) WHERE a.fName = 'Alice' AND b.fName = 'Bob' RETURN a.fName, b.fName, r
-QUERY MATCH (a:person)-[r:knows* SHORTEST 1..30]->(b:person) WHERE a.fName = 'Alice' AND b.fName = 'Bob' RETURN a.fName, b.fName, length(r)
---- 1
Alice|Bob|[0:0,0:1]
Alice|Bob|1

-NAME SingleSourceAllDestinations2
-QUERY MATCH (a:person)-[r:knows* SHORTEST 1..2]->(b:person) WHERE a.fName = 'Elizabeth' RETURN a.fName, b.fName, r
Expand Down
2 changes: 1 addition & 1 deletion test/test_files/tinysnb/binder_error/binder_error.test
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Binder exception: Variable foo is not in scope.
-CASE BindPropertyLookUpOnExpression
-QUERY MATCH (a:person)-[e1:knows]->(b:person) RETURN (a.age + 2).age
---- error
Binder exception: +(a.age,2) has data type INT64. (STRUCT,REL,NODE) was expected.
Binder exception: +(a.age,2) has data type INT64. (NODE,REL,STRUCT) was expected.


-CASE BindPropertyNotExist
Expand Down