OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RangeTableEntry.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 OmniSci, 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 #pragma once
18 
19 #include "Analyzer.h"
20 
23 
24 namespace Analyzer {
25 
26 /*
27  * @type RangeTableEntry
28  * @brief Range table contains all the information about the tables/views
29  * and columns referenced in a query. It is a list of RangeTableEntry's.
30  */
32  public:
33  RangeTableEntry(const std::string& r, const TableDescriptor* t, Query* v)
34  : rangevar(r), table_desc(t), view_query(v) {}
35  virtual ~RangeTableEntry();
36  /* @brief get_column_desc tries to find the column in column_descs and returns the
37  * column descriptor if found. otherwise, look up the column from Catalog, add the
38  * descriptor to column_descs and return the descriptor. return nullptr if not found
39  * @param catalog the catalog for the current database
40  * @param name name of column to look up
41  */
43  const std::string& name);
44  const std::list<const ColumnDescriptor*>& get_column_descs() const;
45  const std::string& get_rangevar() const { return rangevar; }
46  int32_t get_table_id() const;
47  const std::string& get_table_name() const;
48  const TableDescriptor* get_table_desc() const;
49  const Query* get_view_query() const { return view_query; }
51  std::vector<std::shared_ptr<TargetEntry>>& tlist,
52  int rte_idx);
54 
55  private:
56  std::string rangevar; // range variable name, e.g., FROM emp e, dept d
58  std::list<const ColumnDescriptor*>
59  column_descs; // column descriptors for all columns referenced in this query
60  Query* view_query; // parse tree for the view query
61 };
62 
63 } // namespace Analyzer
Defines data structures for the semantic analysis phase of query processing.
void add_all_column_descs(const Catalog_Namespace::Catalog &catalog)
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:81
std::string rangevar
Query * view_query
void expand_star_in_targetlist(const Catalog_Namespace::Catalog &catalog, std::vector< std::shared_ptr< TargetEntry >> &tlist, int rte_idx)
virtual ~RangeTableEntry()
std::list< const ColumnDescriptor * > column_descs
int32_t get_table_id() const
const Query * get_view_query() const
specifies the content in-memory of a row in the column metadata table
const TableDescriptor * get_table_desc() const
const std::list< const ColumnDescriptor * > & get_column_descs() const
const std::string & get_rangevar() const
const std::string & get_table_name() const
const TableDescriptor * table_desc
const ColumnDescriptor * get_column_desc(const Catalog_Namespace::Catalog &catalog, const std::string &name)
RangeTableEntry(const std::string &r, const TableDescriptor *t, Query *v)
specifies the content in-memory of a row in the table metadata table