Skip to content

Commit

Permalink
Cleanup header file includes and conform to style guide
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbaden authored and andrewseidl committed Aug 27, 2019
1 parent 31e8b4a commit 13472df
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 74 deletions.
69 changes: 68 additions & 1 deletion QueryEngine/Descriptors/RelAlgExecutionDescriptor.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -15,9 +15,76 @@
*/

#include "RelAlgExecutionDescriptor.h"

#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/topological_sort.hpp>

#include "QueryEngine/RelAlgAbstractInterpreter.h"

ExecutionResult::ExecutionResult(const std::shared_ptr<ResultSet>& rows,
const std::vector<TargetMetaInfo>& targets_meta)
: result_(rows), targets_meta_(targets_meta), filter_push_down_enabled_(false) {}

ExecutionResult::ExecutionResult(ResultSetPtr&& result,
const std::vector<TargetMetaInfo>& 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<PushedDownFilterInfo>& 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<PushedDownFilterInfo>& 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::
Expand Down
69 changes: 14 additions & 55 deletions QueryEngine/Descriptors/RelAlgExecutionDescriptor.h
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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<ResultSet>& rows,
const std::vector<TargetMetaInfo>& targets_meta)
: result_(rows), targets_meta_(targets_meta), filter_push_down_enabled_(false) {}
const std::vector<TargetMetaInfo>& targets_meta);

ExecutionResult(ResultSetPtr&& result, const std::vector<TargetMetaInfo>& targets_meta)
: targets_meta_(targets_meta), filter_push_down_enabled_(false) {
result_ = std::move(result);
}
ExecutionResult(ResultSetPtr&& result, const std::vector<TargetMetaInfo>& 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<PushedDownFilterInfo>& 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<ResultSet>& getRows() const { return result_; }

Expand All @@ -81,9 +45,7 @@ class ExecutionResult {

const std::vector<TargetMetaInfo>& getTargetsMeta() const { return targets_meta_; }

const std::vector<PushedDownFilterInfo>& getPushedDownFilterInfo() const {
return pushed_down_filter_info_;
}
const std::vector<PushedDownFilterInfo>& getPushedDownFilterInfo() const;

const bool isFilterPushDownEnabled() const { return filter_push_down_enabled_; }

Expand All @@ -101,6 +63,8 @@ class ExecutionResult {
bool filter_push_down_enabled_;
};

class RelAlgNode;

class RaExecutionDesc {
public:
RaExecutionDesc(const RelAlgNode* body)
Expand All @@ -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_;
Expand All @@ -129,5 +90,3 @@ class RaExecutionDesc {
std::vector<RaExecutionDesc> get_execution_descriptors(const RelAlgNode*);
std::vector<RaExecutionDesc> get_execution_descriptors(
const std::vector<const RelAlgNode*>&);

#endif // QUERYENGINE_RELALGEXECUTIONDESCRIPTOR_H
13 changes: 5 additions & 8 deletions QueryEngine/JoinFilterPushDown.h
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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 <cstddef>
#include <numeric>

#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;
Expand Down Expand Up @@ -82,5 +81,3 @@ std::vector<PushedDownFilterInfo> find_push_down_filters(
const RelAlgExecutionUnit& ra_exe_unit,
const std::vector<size_t>& input_permutation,
const std::vector<size_t>& left_deep_join_input_sizes);

#endif // QUERYENGINE_JOINFILTERPUSHDOWN_H
14 changes: 11 additions & 3 deletions QueryEngine/TableOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@

#include "TableOptimizer.h"

#include <Analyzer/Analyzer.h>
#include <Shared/scope.h>

#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 <typename T>
Expand Down
10 changes: 3 additions & 7 deletions QueryEngine/TableOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@

#pragma once

#include "Execute.h"
#include "Catalog/Catalog.h"

#include <Shared/measure.h>
#include "Shared/Logger.h"
class Executor;

/**
* @brief Driver for running cleanup processes on a table.
Expand All @@ -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.
Expand Down
1 change: 1 addition & 0 deletions Tests/UpdelStorageTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 13472df

Please sign in to comment.