OmniSciDB  340b00dbf6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ExpressionRewrite.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef QUERYENGINE_EXPRESSIONREWRITE_H
18 #define QUERYENGINE_EXPRESSIONREWRITE_H
19 
20 #include <llvm/IR/Value.h>
21 #include <boost/optional.hpp>
22 #include <list>
23 #include <memory>
24 #include <vector>
25 
26 #include "Analyzer/Analyzer.h"
27 #include "RelAlgExecutionUnit.h"
28 
29 namespace Analyzer {
30 
31 class Expr;
32 
33 class InValues;
34 
35 } // namespace Analyzer
36 
37 class InputColDescriptor;
38 
39 // Rewrites an OR tree where leaves are equality compare against literals.
41 
42 // Rewrites array elements that are strings to be dict encoded transient literals
44 
45 // Rewrite a FunctionOper to an AND between a BinOper and the FunctionOper if the
46 // FunctionOper is supported for overlaps joins
48  std::list<std::shared_ptr<Analyzer::Expr>> quals;
49  std::list<std::shared_ptr<Analyzer::Expr>> join_quals;
50 };
51 
52 boost::optional<OverlapsJoinConjunction> rewrite_overlaps_conjunction(
53  const std::shared_ptr<Analyzer::Expr> expr);
54 
55 std::list<std::shared_ptr<Analyzer::Expr>> strip_join_covered_filter_quals(
56  const std::list<std::shared_ptr<Analyzer::Expr>>& quals,
57  const JoinQualsPerNestingLevel& join_quals);
58 
59 std::shared_ptr<Analyzer::Expr> fold_expr(const Analyzer::Expr*);
60 
62  const Analyzer::ColumnVar* rhs,
63  const int max_rte_covered);
64 
65 const int get_max_rte_scan_table(
66  std::unordered_map<int, llvm::Value*>& scan_idx_to_hash_pos);
67 
68 #endif // QUERYENGINE_EXPRESSIONREWRITE_H
Defines data structures for the semantic analysis phase of query processing.
Analyzer::ExpressionPtr rewrite_array_elements(Analyzer::Expr const *expr)
bool self_join_not_covered_by_left_deep_tree(const Analyzer::ColumnVar *key_side, const Analyzer::ColumnVar *val_side, const int max_rte_covered)
std::list< std::shared_ptr< Analyzer::Expr > > quals
std::shared_ptr< Analyzer::Expr > ExpressionPtr
Definition: Analyzer.h:180
std::list< std::shared_ptr< Analyzer::Expr > > join_quals
std::vector< JoinCondition > JoinQualsPerNestingLevel
Analyzer::ExpressionPtr rewrite_expr(const Analyzer::Expr *expr)
std::list< std::shared_ptr< Analyzer::Expr > > strip_join_covered_filter_quals(const std::list< std::shared_ptr< Analyzer::Expr >> &quals, const JoinQualsPerNestingLevel &join_quals)
const int get_max_rte_scan_table(std::unordered_map< int, llvm::Value * > &scan_idx_to_hash_pos)
boost::optional< OverlapsJoinConjunction > rewrite_overlaps_conjunction(const std::shared_ptr< Analyzer::Expr > expr)
Execution unit for relational algebra. It&#39;s a low-level description of any relational algebra operati...
std::shared_ptr< Analyzer::Expr > fold_expr(const Analyzer::Expr *expr)