Skip to content

Commit

Permalink
Syntax linter
Browse files Browse the repository at this point in the history
  • Loading branch information
rfdavid committed Jun 28, 2023
1 parent 4b15763 commit d6e4a8e
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 27 deletions.
7 changes: 4 additions & 3 deletions src/common/copier_config/copier_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ using namespace kuzu::utf8proc;

namespace kuzu {
namespace common {
CopyDescription::CopyDescription(CopyDirection copyDirection, const std::vector<std::string>& filePaths,
CSVReaderConfig csvReaderConfig, FileType fileType)
: copyDirection{copyDirection}, filePaths{filePaths}, csvReaderConfig{nullptr}, fileType{fileType} {
CopyDescription::CopyDescription(CopyDirection copyDirection,
const std::vector<std::string>& filePaths, CSVReaderConfig csvReaderConfig, FileType fileType)
: copyDirection{copyDirection}, filePaths{filePaths}, csvReaderConfig{nullptr}, fileType{
fileType} {
if (fileType == FileType::CSV) {
this->csvReaderConfig = std::make_unique<CSVReaderConfig>(csvReaderConfig);
}
Expand Down
4 changes: 2 additions & 2 deletions src/include/parser/copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace parser {

class Copy : public Statement {
public:
explicit Copy(common::CopyDescription::CopyDirection copyDirection, std::vector<std::string> filePaths,
std::string tableName,
explicit Copy(common::CopyDescription::CopyDirection copyDirection,
std::vector<std::string> filePaths, std::string tableName,
std::unordered_map<std::string, std::unique_ptr<ParsedExpression>> parsingOptions,
common::CopyDescription::FileType fileType)
: Statement{common::StatementType::COPY}, copyDirection{copyDirection},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ class LogicalCopyTo : public LogicalOperator {

inline common::table_id_t getTableID() const { return tableID; }

void computeFactorizedSchema() override;
inline void computeFactorizedSchema() { copyChildSchema(0); }

void computeFlatSchema() override;
inline void computeFlatSchema() { copyChildSchema(0); }

// void computeFactorizedSchema() override;

// void computeFlatSchema() override;

inline std::unique_ptr<LogicalOperator> copy() override {
return make_unique<LogicalCopyTo>(copyDescription, tableID, tableName, outputExpression);
Expand Down
10 changes: 5 additions & 5 deletions src/include/processor/operator/copy_to/copy_to.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "common/copier_config/copier_config.h"
#include "processor/operator/physical_operator.h"
#include "common/task_system/task_scheduler.h"
#include "processor/operator/physical_operator.h"
#include "processor/result/result_set.h"

namespace kuzu {
Expand All @@ -12,16 +12,16 @@ class CopyTo : public PhysicalOperator {
public:
CopyTo(const common::CopyDescription& copyDescription, uint32_t id,
const std::string& paramsString)
: PhysicalOperator{PhysicalOperatorType::COPY_TO, id, paramsString}, copyDescription{copyDescription} {}
: PhysicalOperator{PhysicalOperatorType::COPY_TO, id, paramsString}, copyDescription{
copyDescription} {}

bool getNextTuplesInternal(ExecutionContext* context) override {
throw common::InternalException(
"to be implemented?");
throw common::InternalException("to be implemented?");
}

std::string execute(common::TaskScheduler* taskScheduler, ExecutionContext* executionContext);

// void initLocalStateInternal(ResultSet* resultSet, ExecutionContext* context) override;
// void initLocalStateInternal(ResultSet* resultSet, ExecutionContext* context) override;

std::unique_ptr<PhysicalOperator> clone() override {
return make_unique<CopyTo>(copyDescription, id, paramsString);
Expand Down
4 changes: 2 additions & 2 deletions src/parser/transformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ std::string Transformer::transformPrimaryKey(CypherParser::KU_CreateNodeConstrai

std::unique_ptr<Statement> Transformer::transformCopyCSV(CypherParser::KU_CopyCSVContext& ctx) {
auto copyDirection = ctx.FROM() ? common::CopyDescription::CopyDirection::FROM :
common::CopyDescription::CopyDirection::TO;
common::CopyDescription::CopyDirection::TO;
auto filePaths = transformFilePaths(ctx.kU_FilePaths()->StringLiteral());
auto tableName = transformSchemaName(*ctx.oC_SchemaName());
auto parsingOptions = ctx.kU_ParsingOptions() ?
Expand All @@ -1063,7 +1063,7 @@ std::unique_ptr<Statement> Transformer::transformCopyCSV(CypherParser::KU_CopyCS

std::unique_ptr<Statement> Transformer::transformCopyNPY(CypherParser::KU_CopyNPYContext& ctx) {
auto copyDirection = ctx.FROM() ? common::CopyDescription::CopyDirection::FROM :
common::CopyDescription::CopyDirection::TO;
common::CopyDescription::CopyDirection::TO;
auto filePaths = transformFilePaths(ctx.StringLiteral());
auto tableName = transformSchemaName(*ctx.oC_SchemaName());
auto parsingOptions = std::unordered_map<std::string, std::unique_ptr<ParsedExpression>>();
Expand Down
14 changes: 7 additions & 7 deletions src/planner/operator/logical_copy_to.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
namespace kuzu {
namespace planner {

void LogicalCopyTo::computeFactorizedSchema() {
createEmptySchema();
}

void LogicalCopyTo::computeFlatSchema() {
createEmptySchema();
}
// void LogicalCopyTo::computeFactorizedSchema() {
// createEmptySchema();
// }
//
// void LogicalCopyTo::computeFlatSchema() {
// createEmptySchema();
// }

} // namespace planner
} // namespace kuzu
3 changes: 2 additions & 1 deletion src/planner/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ std::unique_ptr<LogicalPlan> Planner::planRenameProperty(const BoundStatement& s
std::unique_ptr<LogicalPlan> Planner::planCopy(
const catalog::Catalog& catalog, const BoundStatement& statement) {
auto& boundCopyStatement = (BoundCopy&)statement;
if (boundCopyStatement.getCopyDescription().copyDirection == CopyDescription::CopyDirection::FROM) {
if (boundCopyStatement.getCopyDescription().copyDirection ==
CopyDescription::CopyDirection::FROM) {
return planCopyFrom(catalog, statement);
} else {
return planCopyTo(catalog, statement);
Expand Down
3 changes: 2 additions & 1 deletion src/processor/mapper/map_ddl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ std::unique_ptr<PhysicalOperator> PlanMapper::mapLogicalCopyToToPhysical(
auto tableName = catalog->getReadOnlyVersion()->getTableName(copy->getTableID());
// stuff...

return std::make_unique<CopyTo>(copy->getCopyDescription(), getOperatorID(), copy->getExpressionsForPrinting());
return std::make_unique<CopyTo>(
copy->getCopyDescription(), getOperatorID(), copy->getExpressionsForPrinting());
}

std::unique_ptr<PhysicalOperator> PlanMapper::mapLogicalCopyToPhysical(
Expand Down
5 changes: 1 addition & 4 deletions src/processor/operator/copy_to/copy_to.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@
using namespace kuzu::common;

namespace kuzu {
namespace processor {


} // namespace processor
namespace processor {} // namespace processor
} // namespace kuzu

0 comments on commit d6e4a8e

Please sign in to comment.