OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{TableOptimizer.cpp} Namespace Reference

Functions

template<typename T >
read_scalar_target_value (const TargetValue &tv)
 
bool set_metadata_from_results (ChunkMetadata &chunk_metadata, const std::vector< TargetValue > &row, const SQLTypeInfo &ti, const bool has_nulls)
 
RelAlgExecutionUnit build_ra_exe_unit (const std::shared_ptr< const InputColDescriptor > input_col_desc, const std::vector< Analyzer::Expr * > &target_exprs)
 
CompilationOptions get_compilation_options (const ExecutorDeviceType &device_type)
 
ExecutionOptions get_execution_options ()
 
std::set< ChunkKeyget_uncached_cpu_chunk_keys (const Catalog_Namespace::Catalog &catalog, int32_t table_id, int32_t fragment_id)
 
void delete_cpu_chunks (const Catalog_Namespace::Catalog &catalog, const std::set< ChunkKey > &cpu_chunks_to_delete)
 

Function Documentation

RelAlgExecutionUnit anonymous_namespace{TableOptimizer.cpp}::build_ra_exe_unit ( const std::shared_ptr< const InputColDescriptor input_col_desc,
const std::vector< Analyzer::Expr * > &  target_exprs 
)

Definition at line 94 of file TableOptimizer.cpp.

Referenced by TableOptimizer::getDeletedColumnStats(), and TableOptimizer::recomputeColumnMetadata().

96  {
97  return RelAlgExecutionUnit{{input_col_desc->getScanDesc()},
98  {input_col_desc},
99  {},
100  {},
101  {},
102  {},
103  target_exprs,
104  {},
105  nullptr,
106  SortInfo(),
107  0};
108 }

+ Here is the caller graph for this function:

void anonymous_namespace{TableOptimizer.cpp}::delete_cpu_chunks ( const Catalog_Namespace::Catalog catalog,
const std::set< ChunkKey > &  cpu_chunks_to_delete 
)

Definition at line 489 of file TableOptimizer.cpp.

References Data_Namespace::CPU_LEVEL, Data_Namespace::DataMgr::deleteChunksWithPrefix(), and Catalog_Namespace::Catalog::getDataMgr().

Referenced by TableOptimizer::vacuumFragments().

490  {
491  auto& data_mgr = catalog.getDataMgr();
492  for (const auto& chunk_key : cpu_chunks_to_delete) {
494  }
495 }
Data_Namespace::DataMgr & getDataMgr() const
Definition: Catalog.h:266
void deleteChunksWithPrefix(const ChunkKey &keyPrefix)
Definition: DataMgr.cpp:572

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CompilationOptions anonymous_namespace{TableOptimizer.cpp}::get_compilation_options ( const ExecutorDeviceType device_type)
inline

Definition at line 110 of file TableOptimizer.cpp.

References Default.

Referenced by TableOptimizer::getDeletedColumnStats(), and TableOptimizer::recomputeColumnMetadata().

110  {
111  return CompilationOptions{device_type, false, ExecutorOptLevel::Default, false};
112 }

+ Here is the caller graph for this function:

ExecutionOptions anonymous_namespace{TableOptimizer.cpp}::get_execution_options ( )
inline

Definition at line 114 of file TableOptimizer.cpp.

Referenced by TableOptimizer::getDeletedColumnStats(), and TableOptimizer::recomputeColumnMetadata().

114  {
115  return ExecutionOptions{false,
116  false,
117  false,
118  false,
119  false,
120  false,
121  false,
122  false,
123  false,
124  0,
125  false,
126  false,
127  0,
128  false,
129  false};
130 }

+ Here is the caller graph for this function:

std::set<ChunkKey> anonymous_namespace{TableOptimizer.cpp}::get_uncached_cpu_chunk_keys ( const Catalog_Namespace::Catalog catalog,
int32_t  table_id,
int32_t  fragment_id 
)

Definition at line 461 of file TableOptimizer.cpp.

References Data_Namespace::CPU_LEVEL, Catalog_Namespace::Catalog::getAllColumnMetadataForTable(), Catalog_Namespace::Catalog::getDatabaseId(), and Catalog_Namespace::Catalog::getDataMgr().

Referenced by TableOptimizer::vacuumFragments().

463  {
464  auto& data_mgr = catalog.getDataMgr();
465  std::set<ChunkKey> uncached_cpu_chunk_keys;
466  for (auto cd : catalog.getAllColumnMetadataForTable(table_id, false, false, true)) {
467  ChunkKey chunk_key{catalog.getDatabaseId(), table_id, cd->columnId, fragment_id};
468  if (cd->columnType.is_varlen_indeed()) {
469  chunk_key.emplace_back(1);
470  if (!data_mgr.isBufferOnDevice(
472  uncached_cpu_chunk_keys.emplace(chunk_key);
473  }
474  chunk_key.back() = 2;
475  if (!data_mgr.isBufferOnDevice(
477  uncached_cpu_chunk_keys.emplace(chunk_key);
478  }
479  } else {
480  if (!data_mgr.isBufferOnDevice(
482  uncached_cpu_chunk_keys.emplace(chunk_key);
483  }
484  }
485  }
486  return uncached_cpu_chunk_keys;
487 }
std::vector< int > ChunkKey
Definition: types.h:36
Data_Namespace::DataMgr & getDataMgr() const
Definition: Catalog.h:266
int getDatabaseId() const
Definition: Catalog.h:326
std::list< const ColumnDescriptor * > getAllColumnMetadataForTable(const int tableId, const bool fetchSystemColumns, const bool fetchVirtualColumns, const bool fetchPhysicalColumns) const
Returns a list of pointers to constant ColumnDescriptor structs for all the columns from a particular...
Definition: Catalog.cpp:2175

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
T anonymous_namespace{TableOptimizer.cpp}::read_scalar_target_value ( const TargetValue tv)

Definition at line 38 of file TableOptimizer.cpp.

References CHECK.

38  {
39  const auto stv = boost::get<ScalarTargetValue>(&tv);
40  CHECK(stv);
41  const auto val_ptr = boost::get<T>(stv);
42  CHECK(val_ptr);
43  return *val_ptr;
44 }
#define CHECK(condition)
Definition: Logger.h:291
bool anonymous_namespace{TableOptimizer.cpp}::set_metadata_from_results ( ChunkMetadata chunk_metadata,
const std::vector< TargetValue > &  row,
const SQLTypeInfo ti,
const bool  has_nulls 
)

Definition at line 46 of file TableOptimizer.cpp.

References ChunkMetadata::fillChunkStats(), SQLTypeInfo::get_compression(), SQLTypeInfo::get_type(), kBIGINT, kBOOLEAN, kCHAR, kDATE, kDECIMAL, kDOUBLE, kENCODING_DICT, kFLOAT, kINT, kNUMERIC, kSMALLINT, kTEXT, kTIME, kTIMESTAMP, kTINYINT, and kVARCHAR.

Referenced by TableOptimizer::getDeletedColumnStats(), and TableOptimizer::recomputeColumnMetadata().

49  {
50  switch (ti.get_type()) {
51  case kBOOLEAN:
52  case kTINYINT:
53  case kSMALLINT:
54  case kINT:
55  case kBIGINT:
56  case kNUMERIC:
57  case kDECIMAL:
58  case kTIME:
59  case kTIMESTAMP:
60  case kDATE: {
61  int64_t min_val = read_scalar_target_value<int64_t>(row[0]);
62  int64_t max_val = read_scalar_target_value<int64_t>(row[1]);
63  chunk_metadata.fillChunkStats(min_val, max_val, has_nulls);
64  break;
65  }
66  case kFLOAT: {
67  float min_val = read_scalar_target_value<float>(row[0]);
68  float max_val = read_scalar_target_value<float>(row[1]);
69  chunk_metadata.fillChunkStats(min_val, max_val, has_nulls);
70  break;
71  }
72  case kDOUBLE: {
73  double min_val = read_scalar_target_value<double>(row[0]);
74  double max_val = read_scalar_target_value<double>(row[1]);
75  chunk_metadata.fillChunkStats(min_val, max_val, has_nulls);
76  break;
77  }
78  case kVARCHAR:
79  case kCHAR:
80  case kTEXT:
81  if (ti.get_compression() == kENCODING_DICT) {
82  int64_t min_val = read_scalar_target_value<int64_t>(row[0]);
83  int64_t max_val = read_scalar_target_value<int64_t>(row[1]);
84  chunk_metadata.fillChunkStats(min_val, max_val, has_nulls);
85  }
86  break;
87  default: {
88  return false; // skip column
89  }
90  }
91  return true;
92 }
Definition: sqltypes.h:76
void fillChunkStats(const T min, const T max, const bool has_nulls)
Definition: ChunkMetadata.h:51
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
Definition: sqltypes.h:79
Definition: sqltypes.h:80
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:399
Definition: sqltypes.h:68
Definition: sqltypes.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function: