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

#include <ResultSetRecyclerHolder.h>

Public Member Functions

const ResultSetPtr getCachedQueryResultSet (const size_t key)
 
std::optional< std::vector
< TargetMetaInfo > > 
getOutputMetaInfo (QueryPlanHash key)
 
bool hasCachedQueryResultSet (const size_t key)
 
void putQueryResultSetToCache (const size_t key, const std::unordered_set< size_t > &input_table_keys, const ResultSetPtr query_result, size_t resultset_size, std::vector< std::shared_ptr< Analyzer::Expr >> &target_exprs)
 
std::optional< ChunkMetadataMapgetCachedChunkMetadata (const size_t key)
 
void putChunkMetadataToCache (const size_t key, const std::unordered_set< size_t > &input_table_keys, const ChunkMetadataMap &chunk_metadata)
 
std::vector< std::shared_ptr
< Analyzer::Expr > > & 
getTargetExprs (QueryPlanHash key) const
 

Static Public Member Functions

static auto invalidateCache ()
 
static auto markCachedItemAsDirty (size_t table_key)
 
static ResultSetRecyclergetResultSetRecycler ()
 
static ChunkMetadataRecyclergetChunkMetadataRecycler ()
 

Static Private Attributes

static std::unique_ptr
< ResultSetRecycler
query_resultset_cache_
 
static std::unique_ptr
< ChunkMetadataRecycler
chunk_metadata_cache_
 

Detailed Description

Definition at line 22 of file ResultSetRecyclerHolder.h.

Member Function Documentation

std::optional< ChunkMetadataMap > ResultSetRecyclerHolder::getCachedChunkMetadata ( const size_t  key)

Definition at line 59 of file ResultSetRecyclerHolder.cpp.

References CHUNK_METADATA, chunk_metadata_cache_, and CHUNK_METADATA_CACHE_DEVICE_IDENTIFIER.

60  {
61  return chunk_metadata_cache_->getItemFromCache(
63 }
static std::unique_ptr< ChunkMetadataRecycler > chunk_metadata_cache_
constexpr DeviceIdentifier CHUNK_METADATA_CACHE_DEVICE_IDENTIFIER
const ResultSetPtr ResultSetRecyclerHolder::getCachedQueryResultSet ( const size_t  key)

Definition at line 30 of file ResultSetRecyclerHolder.cpp.

References DataRecyclerUtil::CPU_DEVICE_IDENTIFIER, QUERY_RESULTSET, and query_resultset_cache_.

30  {
31  return query_resultset_cache_->getItemFromCache(key,
34  std::nullopt);
35 }
static std::unique_ptr< ResultSetRecycler > query_resultset_cache_
static constexpr DeviceIdentifier CPU_DEVICE_IDENTIFIER
Definition: DataRecycler.h:136
static ChunkMetadataRecycler* ResultSetRecyclerHolder::getChunkMetadataRecycler ( )
inlinestatic

Definition at line 59 of file ResultSetRecyclerHolder.h.

References chunk_metadata_cache_.

59  {
60  return chunk_metadata_cache_.get();
61  }
static std::unique_ptr< ChunkMetadataRecycler > chunk_metadata_cache_
std::optional< std::vector< TargetMetaInfo > > ResultSetRecyclerHolder::getOutputMetaInfo ( QueryPlanHash  key)

Definition at line 37 of file ResultSetRecyclerHolder.cpp.

References query_resultset_cache_.

38  {
39  return query_resultset_cache_->getOutputMetaInfo(key);
40 }
static std::unique_ptr< ResultSetRecycler > query_resultset_cache_
static ResultSetRecycler* ResultSetRecyclerHolder::getResultSetRecycler ( )
inlinestatic

Definition at line 55 of file ResultSetRecyclerHolder.h.

References query_resultset_cache_.

55  {
56  return query_resultset_cache_.get();
57  }
static std::unique_ptr< ResultSetRecycler > query_resultset_cache_
std::vector< std::shared_ptr< Analyzer::Expr > > & ResultSetRecyclerHolder::getTargetExprs ( QueryPlanHash  key) const

Definition at line 81 of file ResultSetRecyclerHolder.cpp.

References query_resultset_cache_.

82  {
83  return query_resultset_cache_->getTargetExprs(key);
84 }
static std::unique_ptr< ResultSetRecycler > query_resultset_cache_
bool ResultSetRecyclerHolder::hasCachedQueryResultSet ( const size_t  key)

Definition at line 26 of file ResultSetRecyclerHolder.cpp.

References query_resultset_cache_.

26  {
27  return query_resultset_cache_->hasItemInCache(key);
28 }
static std::unique_ptr< ResultSetRecycler > query_resultset_cache_
static auto ResultSetRecyclerHolder::invalidateCache ( )
inlinestatic

Definition at line 24 of file ResultSetRecyclerHolder.h.

References CHECK, chunk_metadata_cache_, and query_resultset_cache_.

24  {
26  query_resultset_cache_->clearCache();
27 
29  chunk_metadata_cache_->clearCache();
30  }
static std::unique_ptr< ResultSetRecycler > query_resultset_cache_
static std::unique_ptr< ChunkMetadataRecycler > chunk_metadata_cache_
#define CHECK(condition)
Definition: Logger.h:291
static auto ResultSetRecyclerHolder::markCachedItemAsDirty ( size_t  table_key)
inlinestatic

Definition at line 32 of file ResultSetRecyclerHolder.h.

References CHECK, CHUNK_METADATA, chunk_metadata_cache_, DataRecyclerUtil::CPU_DEVICE_IDENTIFIER, QUERY_RESULTSET, and query_resultset_cache_.

32  {
35  auto resultset_cache_tbl_key =
36  query_resultset_cache_->getMappedQueryPlanDagsWithTableKey(table_key);
37  if (resultset_cache_tbl_key.has_value()) {
38  query_resultset_cache_->markCachedItemAsDirty(
39  table_key,
40  *resultset_cache_tbl_key,
43  }
44  auto chunk_metadata_cache_tbl_key =
45  chunk_metadata_cache_->getMappedQueryPlanDagsWithTableKey(table_key);
46  if (chunk_metadata_cache_tbl_key.has_value()) {
47  chunk_metadata_cache_->markCachedItemAsDirty(
48  table_key,
49  *chunk_metadata_cache_tbl_key,
52  }
53  }
static std::unique_ptr< ResultSetRecycler > query_resultset_cache_
static std::unique_ptr< ChunkMetadataRecycler > chunk_metadata_cache_
#define CHECK(condition)
Definition: Logger.h:291
static constexpr DeviceIdentifier CPU_DEVICE_IDENTIFIER
Definition: DataRecycler.h:136
void ResultSetRecyclerHolder::putChunkMetadataToCache ( const size_t  key,
const std::unordered_set< size_t > &  input_table_keys,
const ChunkMetadataMap chunk_metadata 
)

Definition at line 65 of file ResultSetRecyclerHolder.cpp.

References CHUNK_METADATA, chunk_metadata_cache_, and CHUNK_METADATA_CACHE_DEVICE_IDENTIFIER.

68  {
69  if (!chunk_metadata_map.empty()) {
70  ChunkMetadataMetaInfo meta_info{input_table_keys};
71  chunk_metadata_cache_->putItemToCache(key,
72  chunk_metadata_map,
75  0,
76  0,
77  meta_info);
78  }
79 }
static std::unique_ptr< ChunkMetadataRecycler > chunk_metadata_cache_
constexpr DeviceIdentifier CHUNK_METADATA_CACHE_DEVICE_IDENTIFIER
void ResultSetRecyclerHolder::putQueryResultSetToCache ( const size_t  key,
const std::unordered_set< size_t > &  input_table_keys,
const ResultSetPtr  query_result,
size_t  resultset_size,
std::vector< std::shared_ptr< Analyzer::Expr >> &  target_exprs 
)

Definition at line 42 of file ResultSetRecyclerHolder.cpp.

References DataRecyclerUtil::CPU_DEVICE_IDENTIFIER, ResultSetMetaInfo::keepTargetExprs(), QUERY_RESULTSET, and query_resultset_cache_.

47  {
48  ResultSetMetaInfo resultset_meta_info{input_table_keys};
49  resultset_meta_info.keepTargetExprs(target_exprs);
50  query_resultset_cache_->putItemToCache(key,
51  query_result,
54  resultset_size,
55  query_result->getExecTime(),
56  resultset_meta_info);
57 }
static std::unique_ptr< ResultSetRecycler > query_resultset_cache_
void keepTargetExprs(std::vector< std::shared_ptr< Analyzer::Expr >> &in_target_exprs)
static constexpr DeviceIdentifier CPU_DEVICE_IDENTIFIER
Definition: DataRecycler.h:136

+ Here is the call graph for this function:

Member Data Documentation

std::unique_ptr< ChunkMetadataRecycler > ResultSetRecyclerHolder::chunk_metadata_cache_
staticprivate
Initial value:
=
std::make_unique<ChunkMetadataRecycler>()

Definition at line 89 of file ResultSetRecyclerHolder.h.

Referenced by getCachedChunkMetadata(), getChunkMetadataRecycler(), invalidateCache(), markCachedItemAsDirty(), and putChunkMetadataToCache().

std::unique_ptr< ResultSetRecycler > ResultSetRecyclerHolder::query_resultset_cache_
staticprivate

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