-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat: support reading form csv file #550
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2022 RisingLight Project Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
#include <unordered_map> | ||
#include <utility> | ||
#include <vector> | ||
|
||
#include "common/util/hash_util.h" | ||
#include "container/hash/hash_function.h" | ||
#include "execution/executor_context.h" | ||
#include "execution/executors/abstract_executor.h" | ||
#include "execution/executors/copy_file_executor.h" | ||
#include "execution/expressions/abstract_expression.h" | ||
#include "execution/plans/aggregation_plan.h" | ||
#include "storage/table/tuple.h" | ||
#include "type/value_factory.h" | ||
|
||
namespace bustub { | ||
class CopyFileExecutor : public AbstractExecutor { | ||
public: | ||
void Init() override; | ||
|
||
private: | ||
const PhysicalCopyFileNode *plan_; | ||
} | ||
} // namespace bustub | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably need to add a new line to avoid lint warnings |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//===----------------------------------------------------------------------===// | ||
// Copyright 2018-2023 Stichting DuckDB Foundation | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
|
||
// The above copyright notice and this permission notice (including the next paragraph) | ||
// shall be included in all copies or substantial portions of the Software. | ||
|
||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
//===----------------------------------------------------------------------===// | ||
|
||
#pragma once | ||
|
||
#include <vector> | ||
|
||
#include "buffer/buffer_pool_manager.h" | ||
#include "catalog/catalog.h" | ||
#include "concurrency/transaction.h" | ||
#include "concurrency/transaction_manager.h" | ||
#include "execution/executor_context.h" | ||
#include "execution/executor_factory.h" | ||
#include "execution/executors/init_check_executor.h" | ||
#include "execution/plans/abstract_plan.h" | ||
#include "storage/table/tuple.h" | ||
|
||
namespace bustub { | ||
class BaseCsvReader { | ||
public: | ||
BaseCsvReader(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no implementation yet? 🤪 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, I still read the duckdb code and I'm a little slow to catch on that. |
||
~BaseCsvReader(); | ||
}; | ||
} // namespace bustub |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <utility> | ||
|
||
#include "catalog/catalog.h" | ||
#include "execution/expressions/abstract_expression.h" | ||
#include "execution/plans/abstract_plan.h" | ||
#include "fmt/core.h" | ||
|
||
namespace bustub { | ||
|
||
class PhysicalCopyFileNode : public AbstractPlanNode { | ||
public: | ||
/** | ||
* Creates a new physical copy file plan node. | ||
* @param output the output format of this scan plan node | ||
*/ | ||
explicit PhysicalCopyFileNode(SchemaRef output) : AbstractPlanNode(std::move(output), {}) {} | ||
|
||
auto GetType() const -> PlanType override { return PlanType::PhysicalCopyFile; } | ||
|
||
BUSTUB_PLAN_NODE_CLONE_WITH_CHILDREN(PhysicalCopyFileNode); | ||
|
||
protected: | ||
auto PlanNodeToString() const -> std::string override { | ||
return fmt::format("PhysicalCopy {{ file_path={} }}", path_); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In BusTub we don't add |
||
} | ||
|
||
private: | ||
/** the relative file path */ | ||
std::string path_; | ||
|
||
// column_type | ||
|
||
// file_format(specify csv format) | ||
}; | ||
|
||
} // namespace bustub |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name, id, favorite food | ||
quincy, 1, hot dogs | ||
beau, 2, cereal | ||
abbey, 3, pizza | ||
mrugesh, 4, ice cream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not include in submission files, because it will not be modified by students