From 13472df78f705179593493c6be520ef42b74a01a Mon Sep 17 00:00:00 2001 From: Alex Baden Date: Tue, 20 Aug 2019 18:21:17 -0700 Subject: [PATCH] Cleanup header file includes and conform to style guide --- .../Descriptors/RelAlgExecutionDescriptor.cpp | 69 ++++++++++++++++++- .../Descriptors/RelAlgExecutionDescriptor.h | 69 ++++--------------- QueryEngine/JoinFilterPushDown.h | 13 ++-- QueryEngine/TableOptimizer.cpp | 14 +++- QueryEngine/TableOptimizer.h | 10 +-- Tests/UpdelStorageTest.cpp | 1 + 6 files changed, 102 insertions(+), 74 deletions(-) diff --git a/QueryEngine/Descriptors/RelAlgExecutionDescriptor.cpp b/QueryEngine/Descriptors/RelAlgExecutionDescriptor.cpp index eec75d007a..1ec57d0a3b 100644 --- a/QueryEngine/Descriptors/RelAlgExecutionDescriptor.cpp +++ b/QueryEngine/Descriptors/RelAlgExecutionDescriptor.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2017 MapD Technologies, Inc. + * Copyright 2019 OmniSci, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,9 +15,76 @@ */ #include "RelAlgExecutionDescriptor.h" + #include #include +#include "QueryEngine/RelAlgAbstractInterpreter.h" + +ExecutionResult::ExecutionResult(const std::shared_ptr& rows, + const std::vector& targets_meta) + : result_(rows), targets_meta_(targets_meta), filter_push_down_enabled_(false) {} + +ExecutionResult::ExecutionResult(ResultSetPtr&& result, + const std::vector& targets_meta) + : targets_meta_(targets_meta), filter_push_down_enabled_(false) { + result_ = std::move(result); +} + +ExecutionResult::ExecutionResult(const ExecutionResult& that) + : targets_meta_(that.targets_meta_) + , pushed_down_filter_info_(that.pushed_down_filter_info_) + , filter_push_down_enabled_(that.filter_push_down_enabled_) { + if (!pushed_down_filter_info_.empty() || + (filter_push_down_enabled_ && pushed_down_filter_info_.empty())) { + return; + } + result_ = that.result_; +} + +ExecutionResult::ExecutionResult(ExecutionResult&& that) + : targets_meta_(std::move(that.targets_meta_)) + , pushed_down_filter_info_(std::move(that.pushed_down_filter_info_)) + , filter_push_down_enabled_(std::move(that.filter_push_down_enabled_)) { + if (!pushed_down_filter_info_.empty() || + (filter_push_down_enabled_ && pushed_down_filter_info_.empty())) { + return; + } + result_ = std::move(that.result_); +} + +ExecutionResult::ExecutionResult( + const std::vector& pushed_down_filter_info, + bool filter_push_down_enabled) + : pushed_down_filter_info_(pushed_down_filter_info) + , filter_push_down_enabled_(filter_push_down_enabled) {} + +ExecutionResult& ExecutionResult::operator=(const ExecutionResult& that) { + if (!that.pushed_down_filter_info_.empty() || + (that.filter_push_down_enabled_ && that.pushed_down_filter_info_.empty())) { + pushed_down_filter_info_ = that.pushed_down_filter_info_; + filter_push_down_enabled_ = that.filter_push_down_enabled_; + return *this; + } + result_ = that.result_; + targets_meta_ = that.targets_meta_; + return *this; +} + +const std::vector& ExecutionResult::getPushedDownFilterInfo() + const { + return pushed_down_filter_info_; +} + +void RaExecutionDesc::setResult(const ExecutionResult& result) { + result_ = result; + body_->setContextData(this); +} + +const RelAlgNode* RaExecutionDesc::getBody() const { + return body_; +} + namespace { using DAG = boost:: diff --git a/QueryEngine/Descriptors/RelAlgExecutionDescriptor.h b/QueryEngine/Descriptors/RelAlgExecutionDescriptor.h index 946e954dd7..5897ce249c 100644 --- a/QueryEngine/Descriptors/RelAlgExecutionDescriptor.h +++ b/QueryEngine/Descriptors/RelAlgExecutionDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright 2017 MapD Technologies, Inc. + * Copyright 2019 OmniSci, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,64 +14,28 @@ * limitations under the License. */ -#ifndef QUERYENGINE_RELALGEXECUTIONDESCRIPTOR_H -#define QUERYENGINE_RELALGEXECUTIONDESCRIPTOR_H +#pragma once #include "../GroupByAndAggregate.h" #include "../JoinFilterPushDown.h" -#include "../RelAlgAbstractInterpreter.h" class ResultSet; class ExecutionResult { public: ExecutionResult(const std::shared_ptr& rows, - const std::vector& targets_meta) - : result_(rows), targets_meta_(targets_meta), filter_push_down_enabled_(false) {} + const std::vector& targets_meta); - ExecutionResult(ResultSetPtr&& result, const std::vector& targets_meta) - : targets_meta_(targets_meta), filter_push_down_enabled_(false) { - result_ = std::move(result); - } + ExecutionResult(ResultSetPtr&& result, const std::vector& targets_meta); - ExecutionResult(const ExecutionResult& that) - : targets_meta_(that.targets_meta_) - , pushed_down_filter_info_(that.pushed_down_filter_info_) - , filter_push_down_enabled_(that.filter_push_down_enabled_) { - if (!pushed_down_filter_info_.empty() || - (filter_push_down_enabled_ && pushed_down_filter_info_.empty())) { - return; - } - result_ = that.result_; - } + ExecutionResult(const ExecutionResult& that); - ExecutionResult(ExecutionResult&& that) - : targets_meta_(std::move(that.targets_meta_)) - , pushed_down_filter_info_(std::move(that.pushed_down_filter_info_)) - , filter_push_down_enabled_(std::move(that.filter_push_down_enabled_)) { - if (!pushed_down_filter_info_.empty() || - (filter_push_down_enabled_ && pushed_down_filter_info_.empty())) { - return; - } - result_ = std::move(that.result_); - } + ExecutionResult(ExecutionResult&& that); ExecutionResult(const std::vector& pushed_down_filter_info, - bool filter_push_down_enabled) - : pushed_down_filter_info_(pushed_down_filter_info) - , filter_push_down_enabled_(filter_push_down_enabled) {} - - ExecutionResult& operator=(const ExecutionResult& that) { - if (!that.pushed_down_filter_info_.empty() || - (that.filter_push_down_enabled_ && that.pushed_down_filter_info_.empty())) { - pushed_down_filter_info_ = that.pushed_down_filter_info_; - filter_push_down_enabled_ = that.filter_push_down_enabled_; - return *this; - } - result_ = that.result_; - targets_meta_ = that.targets_meta_; - return *this; - } + bool filter_push_down_enabled); + + ExecutionResult& operator=(const ExecutionResult& that); const std::shared_ptr& getRows() const { return result_; } @@ -81,9 +45,7 @@ class ExecutionResult { const std::vector& getTargetsMeta() const { return targets_meta_; } - const std::vector& getPushedDownFilterInfo() const { - return pushed_down_filter_info_; - } + const std::vector& getPushedDownFilterInfo() const; const bool isFilterPushDownEnabled() const { return filter_push_down_enabled_; } @@ -101,6 +63,8 @@ class ExecutionResult { bool filter_push_down_enabled_; }; +class RelAlgNode; + class RaExecutionDesc { public: RaExecutionDesc(const RelAlgNode* body) @@ -114,12 +78,9 @@ class RaExecutionDesc { const ExecutionResult& getResult() const { return result_; } - void setResult(const ExecutionResult& result) { - result_ = result; - body_->setContextData(this); - } + void setResult(const ExecutionResult& result); - const RelAlgNode* getBody() const { return body_; } + const RelAlgNode* getBody() const; private: const RelAlgNode* body_; @@ -129,5 +90,3 @@ class RaExecutionDesc { std::vector get_execution_descriptors(const RelAlgNode*); std::vector get_execution_descriptors( const std::vector&); - -#endif // QUERYENGINE_RELALGEXECUTIONDESCRIPTOR_H diff --git a/QueryEngine/JoinFilterPushDown.h b/QueryEngine/JoinFilterPushDown.h index b1fa96fde1..ac7bafc977 100644 --- a/QueryEngine/JoinFilterPushDown.h +++ b/QueryEngine/JoinFilterPushDown.h @@ -1,5 +1,5 @@ /* - * Copyright 2018 MapD Technologies, Inc. + * Copyright 2019 OmniSci, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,15 +14,14 @@ * limitations under the License. */ -#ifndef QUERYENGINE_JOINFILTERPUSHDOWN_H -#define QUERYENGINE_JOINFILTERPUSHDOWN_H - -#include "Execute.h" -#include "RangeTableIndexVisitor.h" +#pragma once #include #include +#include "QueryEngine/InputMetadata.h" +#include "QueryEngine/RangeTableIndexVisitor.h" + extern bool g_enable_filter_push_down; extern float g_filter_push_down_low_frac; extern float g_filter_push_down_high_frac; @@ -82,5 +81,3 @@ std::vector find_push_down_filters( const RelAlgExecutionUnit& ra_exe_unit, const std::vector& input_permutation, const std::vector& left_deep_join_input_sizes); - -#endif // QUERYENGINE_JOINFILTERPUSHDOWN_H \ No newline at end of file diff --git a/QueryEngine/TableOptimizer.cpp b/QueryEngine/TableOptimizer.cpp index 59b6a0cae3..24e255a275 100644 --- a/QueryEngine/TableOptimizer.cpp +++ b/QueryEngine/TableOptimizer.cpp @@ -16,9 +16,17 @@ #include "TableOptimizer.h" -#include -#include - +#include "Analyzer/Analyzer.h" +#include "QueryEngine/Execute.h" +#include "Shared/Logger.h" +#include "Shared/scope.h" + +TableOptimizer::TableOptimizer(const TableDescriptor* td, + Executor* executor, + const Catalog_Namespace::Catalog& cat) + : td_(td), executor_(executor), cat_(cat) { + CHECK(td); +} namespace { template diff --git a/QueryEngine/TableOptimizer.h b/QueryEngine/TableOptimizer.h index 76da2f5aa6..5b0ed8a2bb 100644 --- a/QueryEngine/TableOptimizer.h +++ b/QueryEngine/TableOptimizer.h @@ -16,10 +16,9 @@ #pragma once -#include "Execute.h" +#include "Catalog/Catalog.h" -#include -#include "Shared/Logger.h" +class Executor; /** * @brief Driver for running cleanup processes on a table. @@ -33,10 +32,7 @@ class TableOptimizer { public: TableOptimizer(const TableDescriptor* td, Executor* executor, - const Catalog_Namespace::Catalog& cat) - : td_(td), executor_(executor), cat_(cat) { - CHECK(td); - } + const Catalog_Namespace::Catalog& cat); /** * @brief Recomputes per-chunk metadata for each fragment in the table. diff --git a/Tests/UpdelStorageTest.cpp b/Tests/UpdelStorageTest.cpp index c705759be8..46e3e4f12d 100644 --- a/Tests/UpdelStorageTest.cpp +++ b/Tests/UpdelStorageTest.cpp @@ -28,6 +28,7 @@ #include "Fragmenter/InsertOrderFragmenter.h" #include "Import/Importer.h" #include "Parser/parser.h" +#include "QueryEngine/Execute.h" #include "QueryEngine/ResultSet.h" #include "QueryEngine/TableOptimizer.h" #include "QueryRunner/QueryRunner.h"