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 copy options case #1447

Merged
merged 1 commit into from
Apr 6, 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 dataset/tinysnb/copy.cypher
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
COPY person FROM "dataset/tinysnb/vPerson.csv" (HEADER=true);
COPY person FROM "dataset/tinysnb/vPerson.csv" (HeaDER=true, deLim=',');
COPY organisation FROM "dataset/tinysnb/vOrganisation.csv";
COPY movies FROM "dataset/tinysnb/vMovies.csv";
COPY knows FROM "dataset/tinysnb/eKnows.csv";
COPY studyAt FROM "dataset/tinysnb/eStudyAt.csv" (HEADER=true);
COPY studyAt FROM "dataset/tinysnb/eStudyAt.csv" (HEADeR=true);
COPY workAt FROM "dataset/tinysnb/eWorkAt.csv"
COPY meets FROM "dataset/tinysnb/eMeets.csv"
COPY marries FROM "dataset/tinysnb/eMarries.csv"
1 change: 1 addition & 0 deletions src/binder/bind/bind_copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ CSVReaderConfig Binder::bindParsingOptions(
CSVReaderConfig csvReaderConfig;
for (auto& parsingOption : *parsingOptions) {
auto copyOptionName = parsingOption.first;
StringUtils::toUpper(copyOptionName);
bool isValidStringParsingOption = validateStringParsingOptionName(copyOptionName);
auto copyOptionExpression = parsingOption.second.get();
auto boundCopyOptionExpression = expressionBinder.bindExpression(*copyOptionExpression);
Expand Down
4 changes: 2 additions & 2 deletions src/main/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ std::string Connection::getNodePropertyNames(const std::string& tableName) {
lock_t lck{mtx};
auto catalog = database->catalog.get();
if (!catalog->getReadOnlyVersion()->containNodeTable(tableName)) {
throw Exception("Cannot find node table " + tableName);
throw RuntimeException("Cannot find node table " + tableName);
}
std::string result = tableName + " properties: \n";
auto tableID = catalog->getReadOnlyVersion()->getTableID(tableName);
Expand All @@ -246,7 +246,7 @@ std::string Connection::getRelPropertyNames(const std::string& relTableName) {
lock_t lck{mtx};
auto catalog = database->catalog.get();
if (!catalog->getReadOnlyVersion()->containRelTable(relTableName)) {
throw Exception("Cannot find rel table " + relTableName);
throw RuntimeException("Cannot find rel table " + relTableName);
}
auto relTableID = catalog->getReadOnlyVersion()->getTableID(relTableName);
auto srcTableID =
Expand Down
2 changes: 1 addition & 1 deletion test/binder/binder_error_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ TEST_F(BinderErrorTest, CreateNodeTableDuplicatedColumnName) {
}

TEST_F(BinderErrorTest, CopyCSVInvalidParsingOption) {
std::string expectedException = "Binder exception: Unrecognized parsing csv option: pk.";
std::string expectedException = "Binder exception: Unrecognized parsing csv option: PK.";
auto input = R"(COPY person FROM "person_0_0.csv" (pk=","))";
ASSERT_STREQ(expectedException.c_str(), getBindingError(input).c_str());
}
Expand Down