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 tests for add property #1214

Merged
merged 1 commit into from
Jan 30, 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
2 changes: 0 additions & 2 deletions src/antlr4/Cypher.g4
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ RENAME: ( 'R' | 'r' ) ( 'E' | 'e' ) ( 'N' | 'n' ) ( 'A' | 'a' ) ( 'M' | 'm' ) (

ADD: ( 'A' | 'a' ) ( 'D' | 'd' ) ( 'D' | 'd' ) ;

COLUMN: ( 'C' | 'c' ) ( 'O' | 'o' ) ( 'L' | 'l' ) ( 'U' | 'u' ) ( 'M' | 'm' ) ( 'N' | 'n' ) ;

kU_RelConnections : kU_RelConnection ( SP? ',' SP? kU_RelConnection )* ;

kU_RelConnection: FROM SP kU_NodeLabels SP TO SP kU_NodeLabels ;
Expand Down
4 changes: 2 additions & 2 deletions test/binder/binder_error_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,14 +416,14 @@ TEST_F(BinderErrorTest, DropPrimaryKeyColumn) {

TEST_F(BinderErrorTest, AddPropertyDuplicateName) {
string expectedException = "Binder exception: Property: fName already exists.";
auto input = "alter table person add column fName STRING";
auto input = "alter table person add fName STRING";
ASSERT_STREQ(expectedException.c_str(), getBindingError(input).c_str());
}

TEST_F(BinderErrorTest, AddPropertyUnmatchedDefaultValueType) {
string expectedException = "Binder exception: Expression 3.2 has data type DOUBLE but expect "
"INT64. Implicit cast is not supported.";
auto input = "alter table person add column intCol INT64 DEFAULT 3.2";
auto input = "alter table person add intCol INT64 DEFAULT 3.2";
ASSERT_STREQ(expectedException.c_str(), getBindingError(input).c_str());
}

Expand Down
16 changes: 8 additions & 8 deletions test/runner/e2e_ddl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ class TinySnbDDLTest : public DBTest {

void addPropertyToPersonTableWithoutDefaultValue(
string propertyType, TransactionTestType transactionTestType) {
executeQueryWithoutCommit(StringUtils::string_format(
"ALTER TABLE person ADD COLUMN random %s", propertyType.c_str()));
executeQueryWithoutCommit(
StringUtils::string_format("ALTER TABLE person ADD random %s", propertyType.c_str()));
auto tableSchema = catalog->getWriteVersion()->getTableSchema(personTableID);
auto propertyID = tableSchema->getPropertyID("random");
auto hasOverflow =
Expand Down Expand Up @@ -409,7 +409,7 @@ class TinySnbDDLTest : public DBTest {
void addPropertyToPersonTableWithDefaultValue(
string propertyType, string defaultVal, TransactionTestType transactionTestType) {
executeQueryWithoutCommit(
"ALTER TABLE person ADD COLUMN random " + propertyType + " DEFAULT " + defaultVal);
"ALTER TABLE person ADD random " + propertyType + " DEFAULT " + defaultVal);
auto tableSchema = catalog->getWriteVersion()->getTableSchema(personTableID);
auto propertyID = tableSchema->getPropertyID("random");
auto hasOverflow =
Expand Down Expand Up @@ -441,8 +441,8 @@ class TinySnbDDLTest : public DBTest {

void addPropertyToStudyAtTableWithoutDefaultValue(
string propertyType, TransactionTestType transactionTestType) {
executeQueryWithoutCommit(StringUtils::string_format(
"ALTER TABLE studyAt ADD COLUMN random %s", propertyType.c_str()));
executeQueryWithoutCommit(
StringUtils::string_format("ALTER TABLE studyAt ADD random %s", propertyType.c_str()));
auto tableSchema = catalog->getWriteVersion()->getTableSchema(studyAtTableID);
auto propertyID = tableSchema->getPropertyID("random");
auto hasOverflow =
Expand Down Expand Up @@ -488,7 +488,7 @@ class TinySnbDDLTest : public DBTest {
void addPropertyToStudyAtTableWithDefaultValue(
string propertyType, string defaultVal, TransactionTestType transactionTestType) {
executeQueryWithoutCommit(
"ALTER TABLE studyAt ADD COLUMN random " + propertyType + " DEFAULT " + defaultVal);
"ALTER TABLE studyAt ADD random " + propertyType + " DEFAULT " + defaultVal);
auto relTableSchema = catalog->getWriteVersion()->getTableSchema(studyAtTableID);
auto propertyID = relTableSchema->getPropertyID("random");
auto hasOverflow =
Expand Down Expand Up @@ -915,8 +915,8 @@ TEST_F(TinySnbDDLTest, AddListOfListOfStringPropertyToStudyAtTableWithDefaultVal
}

TEST_F(TinySnbDDLTest, AddPropertyWithComplexExpression) {
ASSERT_TRUE(conn->query("ALTER TABLE person ADD COLUMN random INT64 DEFAULT 2 * abs(-2)")
->isSuccess());
ASSERT_TRUE(
conn->query("ALTER TABLE person ADD random INT64 DEFAULT 2 * abs(-2)")->isSuccess());
vector<string> expectedResult(8, "4");
ASSERT_EQ(TestHelper::convertResultToString(*conn->query("MATCH (p:person) return p.random")),
expectedResult);
Expand Down
Loading