OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fragmenter_Namespace::FragmentInfo Class Reference

Used by Fragmenter classes to store info about each fragment - the fragment id and number of tuples(rows) currently stored by that fragment. More...

#include <Fragmenter.h>

+ Collaboration diagram for Fragmenter_Namespace::FragmentInfo:

Public Member Functions

 FragmentInfo ()
 
void setChunkMetadataMap (const ChunkMetadataMap &chunk_metadata_map)
 
void setChunkMetadata (const int col, std::shared_ptr< ChunkMetadata > chunkMetadata)
 
const ChunkMetadataMapgetChunkMetadataMap () const
 
const ChunkMetadataMapgetChunkMetadataMapPhysical () const
 
ChunkMetadataMap getChunkMetadataMapPhysicalCopy () const
 
size_t getNumTuples () const
 
size_t getPhysicalNumTuples () const
 
bool isEmptyPhysicalFragment () const
 
void setPhysicalNumTuples (const size_t physNumTuples)
 
void invalidateChunkMetadataMap () const
 
void invalidateNumTuples () const
 

Static Public Member Functions

static void setUnconditionalVacuum (const double unconditionalVacuum)
 

Public Attributes

int fragmentId
 
size_t shadowNumTuples
 
std::vector< int > deviceIds
 
int physicalTableId
 
int shard
 
ChunkMetadataMap shadowChunkMetadataMap
 
ResultSetresultSet
 
std::shared_ptr< std::mutex > resultSetMutex
 

Private Attributes

size_t numTuples
 
ChunkMetadataMap chunkMetadataMap
 
bool synthesizedNumTuplesIsValid
 
bool synthesizedMetadataIsValid
 

Static Private Attributes

static bool unconditionalVacuum_ {false}
 

Friends

class InsertOrderFragmenter
 

Detailed Description

Used by Fragmenter classes to store info about each fragment - the fragment id and number of tuples(rows) currently stored by that fragment.

Definition at line 86 of file Fragmenter.h.

Constructor & Destructor Documentation

Fragmenter_Namespace::FragmentInfo::FragmentInfo ( )
inline

Member Function Documentation

const ChunkMetadataMap & Fragmenter_Namespace::FragmentInfo::getChunkMetadataMap ( ) const

Definition at line 528 of file InputMetadata.cpp.

References chunkMetadataMap, g_enable_data_recycler, g_enable_filter_push_down, g_use_chunk_metadata_cache, Executor::getExecutor(), resultSet, synthesize_metadata(), synthesizedMetadataIsValid, and Executor::UNITARY_EXECUTOR_ID.

Referenced by Executor::canSkipFragmentForFpQual(), ColumnFetcher::getOneColumnFragment(), Executor::isFragmentFullyDeleted(), and Executor::skipFragment().

528  {
530  bool need_to_compute_metadata = true;
531  // we disable chunk metadata recycler when filter pushdown is enabled
532  // since re-executing the query invalidates the cached metdata
533  // todo(yoonmin): relax this
534  bool enable_chunk_metadata_cache = g_enable_data_recycler &&
538  if (enable_chunk_metadata_cache) {
539  std::optional<ChunkMetadataMap> cached =
540  executor->getResultSetRecyclerHolder().getCachedChunkMetadata(
541  resultSet->getQueryPlanHash());
542  if (cached) {
543  chunkMetadataMap = *cached;
544  need_to_compute_metadata = false;
545  }
546  }
547  if (need_to_compute_metadata) {
549  if (enable_chunk_metadata_cache && !chunkMetadataMap.empty()) {
550  executor->getResultSetRecyclerHolder().putChunkMetadataToCache(
551  resultSet->getQueryPlanHash(),
552  resultSet->getInputTableKeys(),
554  }
555  }
557  }
558  return chunkMetadataMap;
559 }
ChunkMetadataMap synthesize_metadata(const ResultSet *rows)
bool g_enable_data_recycler
Definition: Execute.cpp:158
bool g_use_chunk_metadata_cache
Definition: Execute.cpp:161
static std::shared_ptr< Executor > getExecutor(const ExecutorId id, const std::string &debug_dir="", const std::string &debug_file="", const SystemParameters &system_parameters=SystemParameters())
Definition: Execute.cpp:513
bool g_enable_filter_push_down
Definition: Execute.cpp:102
static constexpr ExecutorId UNITARY_EXECUTOR_ID
Definition: Execute.h:423

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const ChunkMetadataMap& Fragmenter_Namespace::FragmentInfo::getChunkMetadataMapPhysical ( ) const
inline

Definition at line 108 of file Fragmenter.h.

References chunkMetadataMap.

Referenced by Fragmenter_Namespace::get_chunks(), and Fragmenter_Namespace::InsertOrderFragmenter::getChunksForAllColumns().

108 { return chunkMetadataMap; }

+ Here is the caller graph for this function:

ChunkMetadataMap Fragmenter_Namespace::FragmentInfo::getChunkMetadataMapPhysicalCopy ( ) const

Definition at line 561 of file InputMetadata.cpp.

Referenced by UpdelRoll::initializeUnsetMetadata().

562  {
563  ChunkMetadataMap metadata_map;
564  for (const auto& [column_id, chunk_metadata] : chunkMetadataMap) {
565  metadata_map[column_id] = std::make_shared<ChunkMetadata>(*chunk_metadata);
566  }
567  return metadata_map;
568 }
std::map< int, std::shared_ptr< ChunkMetadata >> ChunkMetadataMap

+ Here is the caller graph for this function:

size_t Fragmenter_Namespace::FragmentInfo::getNumTuples ( ) const

Definition at line 570 of file InputMetadata.cpp.

References CHECK_EQ.

Referenced by QueryFragmentDescriptor::checkDeviceMemoryUsage(), and ColumnFetcher::getOneColumnFragment().

570  {
571  std::unique_ptr<std::lock_guard<std::mutex>> lock;
572  if (resultSetMutex) {
573  lock.reset(new std::lock_guard<std::mutex>(*resultSetMutex));
574  }
577  numTuples = resultSet->rowCount();
579  }
580  return numTuples;
581 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
std::shared_ptr< std::mutex > resultSetMutex
Definition: Fragmenter.h:135

+ Here is the caller graph for this function:

size_t Fragmenter_Namespace::FragmentInfo::getPhysicalNumTuples ( ) const
inline

Definition at line 114 of file Fragmenter.h.

References numTuples.

Referenced by Fragmenter_Namespace::InsertOrderFragmenter::vacuum_fixlen_rows(), and Fragmenter_Namespace::InsertOrderFragmenter::vacuum_varlen_rows().

114 { return numTuples; }

+ Here is the caller graph for this function:

void Fragmenter_Namespace::FragmentInfo::invalidateChunkMetadataMap ( ) const
inline

Definition at line 120 of file Fragmenter.h.

References synthesizedMetadataIsValid.

void Fragmenter_Namespace::FragmentInfo::invalidateNumTuples ( ) const
inline

Definition at line 121 of file Fragmenter.h.

References synthesizedNumTuplesIsValid.

bool Fragmenter_Namespace::FragmentInfo::isEmptyPhysicalFragment ( ) const
inline

Definition at line 116 of file Fragmenter.h.

References numTuples, and physicalTableId.

Referenced by ColumnFetcher::getOneColumnFragment().

+ Here is the caller graph for this function:

void Fragmenter_Namespace::FragmentInfo::setChunkMetadata ( const int  col,
std::shared_ptr< ChunkMetadata chunkMetadata 
)
inline

Definition at line 102 of file Fragmenter.h.

References chunkMetadataMap.

102  {
103  chunkMetadataMap[col] = chunkMetadata;
104  }
void Fragmenter_Namespace::FragmentInfo::setChunkMetadataMap ( const ChunkMetadataMap chunk_metadata_map)
inline

Definition at line 98 of file Fragmenter.h.

References chunkMetadataMap.

98  {
99  this->chunkMetadataMap = chunk_metadata_map;
100  }
void Fragmenter_Namespace::FragmentInfo::setPhysicalNumTuples ( const size_t  physNumTuples)
inline

Definition at line 118 of file Fragmenter.h.

References numTuples.

Referenced by Fragmenter_Namespace::InsertOrderFragmenter::getFragmentsForQuery().

118 { numTuples = physNumTuples; }

+ Here is the caller graph for this function:

static void Fragmenter_Namespace::FragmentInfo::setUnconditionalVacuum ( const double  unconditionalVacuum)
inlinestatic

Definition at line 124 of file Fragmenter.h.

References unconditionalVacuum_.

124  {
125  unconditionalVacuum_ = unconditionalVacuum;
126  }

Friends And Related Function Documentation

friend class InsertOrderFragmenter
friend

Definition at line 143 of file Fragmenter.h.

Member Data Documentation

ChunkMetadataMap Fragmenter_Namespace::FragmentInfo::chunkMetadataMap
mutableprivate
std::vector<int> Fragmenter_Namespace::FragmentInfo::deviceIds
size_t Fragmenter_Namespace::FragmentInfo::numTuples
mutableprivate
ResultSet* Fragmenter_Namespace::FragmentInfo::resultSet
mutable

Definition at line 134 of file Fragmenter.h.

Referenced by getChunkMetadataMap().

std::shared_ptr<std::mutex> Fragmenter_Namespace::FragmentInfo::resultSetMutex
mutable

Definition at line 135 of file Fragmenter.h.

ChunkMetadataMap Fragmenter_Namespace::FragmentInfo::shadowChunkMetadataMap
int Fragmenter_Namespace::FragmentInfo::shard
bool Fragmenter_Namespace::FragmentInfo::synthesizedMetadataIsValid
mutableprivate

Definition at line 141 of file Fragmenter.h.

Referenced by getChunkMetadataMap(), and invalidateChunkMetadataMap().

bool Fragmenter_Namespace::FragmentInfo::synthesizedNumTuplesIsValid
mutableprivate

Definition at line 140 of file Fragmenter.h.

Referenced by invalidateNumTuples().

bool Fragmenter_Namespace::FragmentInfo::unconditionalVacuum_ {false}
staticprivate

The documentation for this class was generated from the following files: