/*------------------------------------------------------------------------------* * Architecture & Implementation of DBMS * *------------------------------------------------------------------------------* * Copyright 2022 Databases and Information Systems Group TU Dortmund * * Visit us at * * http://dbis.cs.tu-dortmund.de/cms/en/home/ * * * * 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. * * * * Authors: * * Maximilian Berens * * Roland Kühn * * Jan Mühlig * *------------------------------------------------------------------------------* */ #pragma once #include "node/node_interface.h" #include #include namespace beedb::plan::logical { class Builder { public: static std::unique_ptr build(Database &database, const std::unique_ptr &query); static std::unique_ptr build(Database &database, parser::SelectQuery *select_query); static std::unique_ptr build(Database &database, parser::CreateTableStatement *create_statement); static std::unique_ptr build(Database &database, parser::CreateIndexStatement *create_index_statement); static std::unique_ptr build(Database &database, parser::InsertStatement *insert_statement); static std::unique_ptr build(Database &database, parser::UpdateStatement *update_statement); static std::unique_ptr build(Database &database, parser::DeleteStatement *delete_statement); static std::unique_ptr build(Database &database, parser::TransactionStatement *transaction_statement); private: [[nodiscard]] static std::unique_ptr create_from( Database &database, std::vector &&from, std::optional> &&join); [[nodiscard]] static std::unique_ptr parse_select_expression( std::unique_ptr &&top_node, std::vector &projection_terms, std::vector> &aggregations, std::unique_ptr &&select_expression, bool add_to_projection); [[nodiscard]] static std::vector> split_logical_and( std::unique_ptr &&root); static void split_logical_and(std::unique_ptr &&root, std::vector> &container); }; } // namespace beedb::plan::logical