OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TableDescriptor.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 TABLE_DESCRIPTOR_H
18 #define TABLE_DESCRIPTOR_H
19 
20 #include <cstdint>
21 #include <string>
22 #include "../DataMgr/MemoryLevel.h"
23 #include "../Fragmenter/AbstractFragmenter.h"
24 #include "../Shared/sqldefs.h"
25 
33  int32_t tableId;
34  int32_t shard;
35  std::string tableName;
36  int32_t userId;
37  int32_t nColumns;
38  bool isView;
39  std::string viewSQL;
40  std::string fragments; // placeholder for fragmentation information
42  fragType; // fragmentation type. Only INSERT_ORDER is supported now.
43  int32_t maxFragRows; // max number of rows per fragment
44  int64_t maxChunkSize; // max number of rows per fragment
45  int32_t fragPageSize; // page size
46  int64_t maxRows; // max number of rows in the table
47  std::string partitions; // distributed partition scheme
48  std::string
49  keyMetainfo; // meta-information about shard keys and shared dictionary, as JSON
50 
52  fragmenter; // point to fragmenter object for the table. it's instantiated upon
53  // first use.
54  int32_t
55  nShards; // # of shards, i.e. physical tables for this logical table (default: 0)
56  int shardedColumnId; // Id of the column to be sharded on
57  int sortedColumnId; // Id of the column to be sorted on
59  bool hasDeletedCol; // Does table has a delete col, Yes (VACUUM = DELAYED)
60  // No (VACUUM = IMMEDIATE)
61  // Spi means Sequential Positional Index which is equivalent to the input index in a
62  // RexInput node
63  std::vector<int> columnIdBySpi_; // spi = 1,2,3,...
64 
65  // write mutex, only to be used inside catalog package
66  std::shared_ptr<std::mutex> mutex_;
67 
69  : tableId(-1)
70  , shard(-1)
71  , nShards(0)
72  , shardedColumnId(0)
73  , sortedColumnId(0)
74  , persistenceLevel(Data_Namespace::MemoryLevel::DISK_LEVEL)
76  , mutex_(std::make_shared<std::mutex>()) {}
77 };
78 
79 inline bool table_is_replicated(const TableDescriptor* td) {
80  return td->partitions == "REPLICATED";
81 }
82 
83 // compare for lowest id
84 inline bool compare_td_id(const TableDescriptor* first, const TableDescriptor* second) {
85  return (first->tableId < second->tableId);
86 }
87 
88 #endif // TABLE_DESCRIPTOR
std::string partitions
bool compare_td_id(const TableDescriptor *first, const TableDescriptor *second)
std::string tableName
std::string fragments
std::vector< int > columnIdBySpi_
std::shared_ptr< std::mutex > mutex_
bool g_enable_smem_group_by true
std::string keyMetainfo
bool table_is_replicated(const TableDescriptor *td)
Fragmenter_Namespace::FragmenterType fragType
Data_Namespace::MemoryLevel persistenceLevel
std::string viewSQL
specifies the content in-memory of a row in the table metadata table
Fragmenter_Namespace::AbstractFragmenter * fragmenter