-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1174 from kuzudb/issue-1073
Issue 1073
- Loading branch information
Showing
21 changed files
with
2,282 additions
and
2,366 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
add_library(kuzu_processor_operator_copy_csv | ||
OBJECT | ||
copy_csv.cpp | ||
copy_node_csv.cpp | ||
copy_rel_csv.cpp) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "processor/operator/copy_csv/copy_csv.h" | ||
|
||
namespace kuzu { | ||
namespace processor { | ||
|
||
string CopyCSV::execute(TaskScheduler* taskScheduler, ExecutionContext* executionContext) { | ||
registerProfilingMetrics(executionContext->profiler); | ||
metrics->executionTime.start(); | ||
errorIfTableIsNonEmpty(); | ||
auto numTuplesCopied = executeInternal(taskScheduler, executionContext); | ||
metrics->executionTime.stop(); | ||
metrics->numOutputTuple.increase(numTuplesCopied); | ||
return getOutputMsg(numTuplesCopied); | ||
} | ||
|
||
void CopyCSV::errorIfTableIsNonEmpty() { | ||
auto numTuples = getNumTuplesInTable(); | ||
if (numTuples > 0) { | ||
auto tableName = catalog->getReadOnlyVersion()->getTableSchema(tableID)->tableName; | ||
throw CopyCSVException( | ||
"COPY CSV commands can be executed only on completely empty tables. Table: " + | ||
tableName + " has " + to_string(numTuples) + " many tuples."); | ||
} | ||
} | ||
|
||
std::string CopyCSV::getOutputMsg(uint64_t numTuplesCopied) { | ||
return StringUtils::string_format("%d number of tuples has been copied to table: %s.", | ||
numTuplesCopied, catalog->getReadOnlyVersion()->getTableName(tableID).c_str()); | ||
} | ||
|
||
} // namespace processor | ||
} // namespace kuzu |
Oops, something went wrong.