66//
77// Identification: src/executor/copy_executor.cpp
88//
9- // Copyright (c) 2015-17 , Carnegie Mellon University Database Group
9+ // Copyright (c) 2015-2018 , Carnegie Mellon University Database Group
1010//
1111// ===----------------------------------------------------------------------===//
1212
13+ #include " executor/copy_executor.h"
14+
15+ #include < sys/stat.h>
16+ #include < sys/mman.h>
17+
1318#include " common/logger.h"
1419#include " catalog/catalog.h"
1520#include " concurrency/transaction_manager_factory.h"
16- #include " executor/copy_executor.h"
1721#include " executor/executor_context.h"
1822#include " executor/logical_tile_factory.h"
19- #include " planner/copy_plan .h"
23+ #include " planner/export_external_file_plan .h"
2024#include " storage/table_factory.h"
2125#include " network/postgres_protocol_handler.h"
2226#include " common/exception.h"
2327#include " common/macros.h"
24- #include < sys/stat.h>
25- #include < sys/mman.h>
2628
2729namespace peloton {
2830namespace executor {
@@ -35,7 +37,7 @@ CopyExecutor::CopyExecutor(const planner::AbstractPlan *node,
3537 ExecutorContext *executor_context)
3638 : AbstractExecutor(node, executor_context) {}
3739
38- CopyExecutor::~CopyExecutor () {}
40+ CopyExecutor::~CopyExecutor () = default ;
3941
4042/* *
4143 * @brief Basic initialization.
@@ -45,21 +47,19 @@ bool CopyExecutor::DInit() {
4547 PELOTON_ASSERT (children_.size () == 1 );
4648
4749 // Grab info from plan node and check it
48- const planner::CopyPlan &node = GetPlanNode<planner::CopyPlan >();
50+ const auto &node = GetPlanNode<planner::ExportExternalFilePlan >();
4951
50- bool success = InitFileHandle (node.file_path .c_str (), " w" );
52+ bool success = InitFileHandle (node.GetFileName () .c_str (), " w" );
5153
5254 if (success == false ) {
53- throw ExecutorException (" Failed to create file " + node.file_path +
55+ throw ExecutorException (" Failed to create file " + node.GetFileName () +
5456 " . Try absolute path and make sure you have the "
5557 " permission to access this file." );
56- return false ;
5758 }
58- LOG_DEBUG (" Created target copy output file: %s" , node.file_path .c_str ());
59+ LOG_DEBUG (" Created target copy output file: %s" , node.GetFileName () .c_str ());
5960 return true ;
6061}
6162
62-
6363bool CopyExecutor::InitFileHandle (const char *name, const char *mode) {
6464 auto file = fopen (name, mode);
6565 if (file == NULL ) {
0 commit comments