OmniSciDB  c1a53651b2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TableFunctionManager Struct Reference

#include <heavydbTypes.h>

+ Collaboration diagram for TableFunctionManager:

Public Member Functions

void set_output_array_values_total_number (int32_t index, int64_t output_array_values_total_number)
 
void set_output_row_size (int64_t num_rows)
 
void disable_output_allocations ()
 
void enable_output_allocations ()
 
int32_t error_message (const char *message)
 
template<typename T >
void set_metadata (const std::string &key, const T &value)
 
template<typename T >
void get_metadata (const std::string &key, T &value)
 
int32_t getNewDictDbId ()
 
int32_t getNewDictId ()
 
StringDictionaryProxygetStringDictionaryProxy (int32_t db_id, int32_t dict_id)
 
std::string getString (int32_t db_id, int32_t dict_id, int32_t string_id)
 
const char * getCString (int32_t db_id, int32_t dict_id, int32_t string_id)
 
int32_t getOrAddTransient (int32_t db_id, int32_t dict_id, std::string str)
 
 TableFunctionManager (const TableFunctionExecutionUnit &exe_unit, Executor *executor, std::vector< const int8_t * > &col_buf_ptrs, std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, bool is_singleton)
 
size_t get_ncols () const
 
size_t get_nrows () const
 
void check_thread_id () const
 
void set_output_column (int32_t index, int8_t *ptr)
 
void set_output_array_values_total_number (int32_t index, int64_t output_array_values_total_number)
 
void allocate_output_buffers (int64_t output_num_rows)
 
const char * get_error_message () const
 
void set_error_message (const char *msg)
 
void set_metadata (const char *key, const uint8_t *raw_bytes, const size_t num_bytes, const TableFunctionMetadataType value_type) const
 
void get_metadata (const char *key, const uint8_t *&raw_bytes, size_t &num_bytes, TableFunctionMetadataType &value_type) const
 
int32_t getNewDictDbId ()
 
int32_t getNewDictId ()
 
int8_t * getStringDictionaryProxy (int32_t db_id, int32_t dict_id)
 
std::string getString (int32_t db_id, int32_t dict_id, int32_t string_id)
 
const char * getCString (int32_t db_id, int32_t dict_id, int32_t string_id)
 
const int32_t getOrAddTransient (int32_t db_id, int32_t dict_id, const std::string &str)
 
bool isSingleton () const
 
 ~TableFunctionManager ()
 

Static Public Member Functions

static TableFunctionManagerget_singleton ()
 
static TableFunctionManager *& get_singleton ()
 

Public Attributes

bool output_allocations_disabled false
 
std::unique_ptr
< QueryMemoryInitializer
query_buffers
 

Private Member Functions

void lock ()
 
void unlock ()
 

Static Private Member Functions

static void set_singleton (TableFunctionManager *instance)
 

Private Attributes

const TableFunctionExecutionUnitexe_unit_
 
Executorexecutor_
 
std::vector< const int8_t * > & col_buf_ptrs_
 
std::shared_ptr
< RowSetMemoryOwner
row_set_mem_owner_
 
std::vector< int64_t * > output_col_buf_ptrs
 
size_t output_num_rows_
 
std::vector< int64_t > output_array_values_total_number_
 
std::vector< int8_t * > output_column_ptrs
 
bool is_singleton_
 
std::thread::id thread_id_
 
std::string error_message_
 

Detailed Description

Definition at line 1214 of file heavydbTypes.h.

Constructor & Destructor Documentation

TableFunctionManager::TableFunctionManager ( const TableFunctionExecutionUnit exe_unit,
Executor executor,
std::vector< const int8_t * > &  col_buf_ptrs,
std::shared_ptr< RowSetMemoryOwner row_set_mem_owner,
bool  is_singleton 
)
inline

Definition at line 59 of file TableFunctionManager.h.

References get_ncols(), isSingleton(), output_array_values_total_number_, output_col_buf_ptrs, output_column_ptrs, and set_singleton().

64  : exe_unit_(exe_unit)
65  , executor_(executor)
66  , col_buf_ptrs_(col_buf_ptrs)
67  , row_set_mem_owner_(row_set_mem_owner)
68  , output_num_rows_(-1)
69  , is_singleton_(is_singleton)
70  , thread_id_(std::this_thread::get_id()) {
71  if (isSingleton()) {
72  set_singleton(this); // start of singleton life
73  }
74  auto num_out_columns = get_ncols();
75  output_col_buf_ptrs.reserve(num_out_columns);
76  output_column_ptrs.reserve(num_out_columns);
77  output_array_values_total_number_.reserve(num_out_columns);
78  for (size_t i = 0; i < num_out_columns; i++) {
79  output_col_buf_ptrs.emplace_back(nullptr);
80  output_column_ptrs.emplace_back(nullptr);
81  output_array_values_total_number_.emplace_back(-1);
82  }
83  }
std::vector< const int8_t * > & col_buf_ptrs_
const TableFunctionExecutionUnit & exe_unit_
std::vector< int8_t * > output_column_ptrs
std::vector< int64_t * > output_col_buf_ptrs
std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner_
std::vector< int64_t > output_array_values_total_number_
static void set_singleton(TableFunctionManager *instance)

+ Here is the call graph for this function:

TableFunctionManager::~TableFunctionManager ( )
inline

Definition at line 274 of file TableFunctionManager.h.

References isSingleton(), and set_singleton().

274  {
275  if (isSingleton()) {
276  set_singleton(nullptr); // end of singleton life
277  }
278  }
static void set_singleton(TableFunctionManager *instance)

+ Here is the call graph for this function:

Member Function Documentation

void TableFunctionManager::allocate_output_buffers ( int64_t  output_num_rows)
inline

Definition at line 120 of file TableFunctionManager.h.

References QueryMemoryDescriptor::addColSlotInfo(), QueryMemoryDescriptor::addColSlotInfoFlatBuffer(), align_to_int64(), CHECK, CHECK_EQ, CHECK_NE, check_thread_id(), col_buf_ptrs_, CPU, exe_unit_, executor_, get_ncols(), getVarlenArrayBufferSize(), initializeVarlenArray(), output_array_values_total_number_, output_col_buf_ptrs, output_column_ptrs, output_num_rows_, query_buffers, query_mem_desc, row_set_mem_owner_, QueryMemoryDescriptor::setOutputColumnar(), Column< T >::size(), TableFunction, TableFunctionExecutionUnit::target_exprs, and toString().

120  {
121  check_thread_id();
123  size_t(-1)); // re-allocation of output buffers is not supported
124 
125  output_num_rows_ = output_num_rows;
126  auto num_out_columns = get_ncols();
128  output_num_rows, // divide by row multiplier???
130  /*is_table_function=*/true);
131  query_mem_desc.setOutputColumnar(true);
132 
133  for (size_t i = 0; i < num_out_columns; i++) {
134  // All outputs have padded width set to logical column width
135  auto ti = exe_unit_.target_exprs[i]->get_type_info();
136  if (ti.is_array()) {
138  -1); // set_output_array_values_total_number(i, ...) is not called
139  /*
140  Here we compute the byte size of flatbuffer and store it in
141  query memory descriptor's ColSlotContext instance. The
142  flatbuffer memory will be allocated in
143  QueryMemoryInitializer constructor and the memory will be
144  initialized below.
145  */
146  const int64_t flatbuffer_size = getVarlenArrayBufferSize(
148  query_mem_desc.addColSlotInfoFlatBuffer(
149  flatbuffer_size); // used by QueryMemoryInitializer
150  } else {
151  const size_t col_width = ti.get_size();
152  query_mem_desc.addColSlotInfo({std::make_tuple(col_width, col_width)});
153  }
154  }
155 
156  // The members layout of Column must match with Column defined in
157  // heavydbTypes.h
158  struct Column {
159  int8_t* ptr;
160  int64_t size;
161  // just for debugging:
162  std::string toString() const {
163  return "Column{" + ::toString(ptr) + ", " + ::toString(size) + "}";
164  }
165  };
166  // We do not init output buffers for CPU currently, so CPU
167  // table functions are expected to handle their own initialization
168  query_buffers = std::make_unique<QueryMemoryInitializer>(
169  exe_unit_,
171  /*device_id=*/0,
173  (output_num_rows_ == 0 ? 1 : output_num_rows_),
174  std::vector<std::vector<const int8_t*>>{col_buf_ptrs_},
175  std::vector<std::vector<uint64_t>>{{0}}, // frag offsets
177  nullptr,
178  executor_);
179  if (output_num_rows_ != 0) {
180  auto group_by_buffers_ptr = query_buffers->getGroupByBuffersPtr();
181  CHECK(group_by_buffers_ptr);
182  auto output_buffers_ptr = reinterpret_cast<int8_t*>(group_by_buffers_ptr[0]);
183  for (size_t i = 0; i < num_out_columns; i++) {
184  Column* col = reinterpret_cast<Column*>(output_column_ptrs[i]);
185  CHECK(col);
186  // set the members of output Column instances:
187  output_col_buf_ptrs[i] = reinterpret_cast<int64_t*>(output_buffers_ptr);
188  col->ptr = output_buffers_ptr;
189  col->size = output_num_rows_;
190 
191  auto ti = exe_unit_.target_exprs[i]->get_type_info();
192  if (ti.is_array()) {
193  FlatBufferManager m{output_buffers_ptr};
195  m, output_num_rows_, output_array_values_total_number_[i], ti);
196  output_buffers_ptr = align_to_int64(output_buffers_ptr + m.flatbufferSize());
197  } else {
198  const size_t col_width = ti.get_size();
199  output_buffers_ptr =
200  align_to_int64(output_buffers_ptr + col_width * output_num_rows_);
201  }
202  }
203  }
204  }
std::unique_ptr< QueryMemoryInitializer > query_buffers
#define CHECK_EQ(x, y)
Definition: Logger.h:301
std::vector< const int8_t * > & col_buf_ptrs_
const TableFunctionExecutionUnit & exe_unit_
DEVICE int64_t size() const
Definition: heavydbTypes.h:751
std::vector< int8_t * > output_column_ptrs
std::vector< int64_t * > output_col_buf_ptrs
#define CHECK_NE(x, y)
Definition: Logger.h:302
std::string toString(const ExecutorDeviceType &device_type)
void initializeVarlenArray(FlatBufferManager &m, int64_t items_count, int64_t max_nof_values, const SQLTypeInfo &ti)
Definition: sqltypes.h:1481
std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner_
std::vector< int64_t > output_array_values_total_number_
int64_t getVarlenArrayBufferSize(int64_t items_count, int64_t max_nof_values, const SQLTypeInfo &ti)
Definition: sqltypes.h:1461
#define CHECK(condition)
Definition: Logger.h:291
std::vector< Analyzer::Expr * > target_exprs
FORCE_INLINE HOST DEVICE T align_to_int64(T addr)

+ Here is the call graph for this function:

void TableFunctionManager::check_thread_id ( ) const
inline

Definition at line 91 of file TableFunctionManager.h.

References thread_id_.

Referenced by allocate_output_buffers(), get_error_message(), set_error_message(), and set_output_column().

91  {
92  if (std::this_thread::get_id() != thread_id_) {
93  throw std::runtime_error(
94  "TableFunctionManager instance accessed from an alien thread!");
95  }
96  }

+ Here is the caller graph for this function:

void TableFunctionManager::disable_output_allocations ( )
inline

Definition at line 1231 of file heavydbTypes.h.

Referenced by linear_reg_fit_predict__cpu_template().

1231 { output_allocations_disabled = true; }

+ Here is the caller graph for this function:

void TableFunctionManager::enable_output_allocations ( )
inline

Definition at line 1233 of file heavydbTypes.h.

Referenced by linear_reg_fit_predict__cpu_template().

1233 { output_allocations_disabled = false; }

+ Here is the caller graph for this function:

int32_t TableFunctionManager::error_message ( const char *  message)
inline

Definition at line 1235 of file heavydbTypes.h.

References TableFunctionManager_error_message().

1235  {
1236  return TableFunctionManager_error_message(reinterpret_cast<int8_t*>(this), message);
1237  }
EXTENSION_NOINLINE_HOST int32_t TableFunctionManager_error_message(int8_t *mgr_ptr, const char *message)

+ Here is the call graph for this function:

const char* TableFunctionManager::get_error_message ( ) const
inline

Definition at line 206 of file TableFunctionManager.h.

References check_thread_id(), and error_message_.

206  {
207  check_thread_id();
208  return error_message_.c_str();
209  }

+ Here is the call graph for this function:

void TableFunctionManager::get_metadata ( const char *  key,
const uint8_t *&  raw_bytes,
size_t &  num_bytes,
TableFunctionMetadataType value_type 
) const
inline

Definition at line 224 of file TableFunctionManager.h.

References CHECK, and row_set_mem_owner_.

227  {
229  row_set_mem_owner_->getTableFunctionMetadata(key, raw_bytes, num_bytes, value_type);
230  }
std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner_
#define CHECK(condition)
Definition: Logger.h:291
template<typename T >
void TableFunctionManager::get_metadata ( const std::string &  key,
T &  value 
)
inline

Definition at line 1249 of file heavydbTypes.h.

References heavydb.dtypes::T, and TableFunctionManager_get_metadata().

Referenced by tf_metadata_getter__cpu_template(), and tf_metadata_getter_bad__cpu_template().

1249  {
1250  const uint8_t* raw_data{};
1251  size_t num_bytes{};
1252  TableFunctionMetadataType value_type;
1254  reinterpret_cast<int8_t*>(this), key.c_str(), raw_data, num_bytes, value_type);
1255  if (sizeof(T) != num_bytes) {
1256  throw std::runtime_error("Size mismatch for Table Function Metadata '" + key + "'");
1257  }
1258  if (get_metadata_type<T>() != value_type) {
1259  throw std::runtime_error("Type mismatch for Table Function Metadata '" + key + "'");
1260  }
1261  std::memcpy(&value, raw_data, num_bytes);
1262  }
EXTENSION_NOINLINE_HOST void TableFunctionManager_get_metadata(int8_t *mgr_ptr, const char *key, const uint8_t *&raw_bytes, size_t &num_bytes, TableFunctionMetadataType &value_type)
TableFunctionMetadataType

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t TableFunctionManager::get_ncols ( ) const
inline

Definition at line 86 of file TableFunctionManager.h.

References exe_unit_, and TableFunctionExecutionUnit::target_exprs.

Referenced by allocate_output_buffers(), set_output_array_values_total_number(), set_output_column(), and TableFunctionManager().

86 { return exe_unit_.target_exprs.size(); }
const TableFunctionExecutionUnit & exe_unit_
std::vector< Analyzer::Expr * > target_exprs

+ Here is the caller graph for this function:

size_t TableFunctionManager::get_nrows ( ) const
inline

Definition at line 89 of file TableFunctionManager.h.

References output_num_rows_.

89 { return output_num_rows_; }
static TableFunctionManager*& TableFunctionManager::get_singleton ( )
inlinestatic

Definition at line 280 of file TableFunctionManager.h.

280  {
281  static TableFunctionManager* instance = nullptr;
282  return instance;
283  }
static TableFunctionManager* TableFunctionManager::get_singleton ( )
inlinestatic

Definition at line 1215 of file heavydbTypes.h.

References TableFunctionManager_get_singleton().

Referenced by ct_sleep1__cpu_(), ct_sleep2(), set_singleton(), and sum_along_row__cpu_template().

1215  {
1216  return reinterpret_cast<TableFunctionManager*>(TableFunctionManager_get_singleton());
1217  }
EXTENSION_NOINLINE_HOST int8_t * TableFunctionManager_get_singleton()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const char* TableFunctionManager::getCString ( int32_t  db_id,
int32_t  dict_id,
int32_t  string_id 
)
inline

Definition at line 255 of file TableFunctionManager.h.

References executor_, and row_set_mem_owner_.

255  {
256  const auto proxy =
257  executor_->getStringDictionaryProxy({db_id, dict_id}, row_set_mem_owner_, true);
258  auto [c_str, len] = proxy->getStringBytes(string_id);
259  return c_str;
260  }
std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner_
const char* TableFunctionManager::getCString ( int32_t  db_id,
int32_t  dict_id,
int32_t  string_id 
)
inline

Definition at line 1278 of file heavydbTypes.h.

References TableFunctionManager_getCString().

1278  {
1280  reinterpret_cast<int8_t*>(this), db_id, dict_id, string_id);
1281  }
EXTENSION_NOINLINE_HOST const char * TableFunctionManager_getCString(int8_t *mgr_ptr, int32_t db_id, int32_t dict_id, int32_t string_id)

+ Here is the call graph for this function:

int32_t TableFunctionManager::getNewDictDbId ( )
inline

Definition at line 232 of file TableFunctionManager.h.

References executor_, row_set_mem_owner_, and TRANSIENT_DICT_ID.

232  {
233  const auto proxy = executor_->getStringDictionaryProxy(
235  return proxy->getDictKey().db_id;
236  }
#define TRANSIENT_DICT_ID
Definition: DbObjectKeys.h:24
std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner_
int32_t TableFunctionManager::getNewDictDbId ( )
inline

Definition at line 1263 of file heavydbTypes.h.

References TableFunctionManager_getNewDictDbId().

Referenced by array_asarray__cpu_template().

1263  {
1264  return TableFunctionManager_getNewDictDbId(reinterpret_cast<int8_t*>(this));
1265  }
EXTENSION_NOINLINE_HOST int32_t TableFunctionManager_getNewDictDbId(int8_t *mgr_ptr)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32_t TableFunctionManager::getNewDictId ( )
inline

Definition at line 238 of file TableFunctionManager.h.

References executor_, row_set_mem_owner_, and TRANSIENT_DICT_ID.

238  {
239  const auto proxy = executor_->getStringDictionaryProxy(
241  return proxy->getDictKey().dict_id;
242  }
#define TRANSIENT_DICT_ID
Definition: DbObjectKeys.h:24
std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner_
int32_t TableFunctionManager::getNewDictId ( )
inline

Definition at line 1266 of file heavydbTypes.h.

References TableFunctionManager_getNewDictId().

Referenced by array_asarray__cpu_template().

1266  {
1267  return TableFunctionManager_getNewDictId(reinterpret_cast<int8_t*>(this));
1268  }
EXTENSION_NOINLINE_HOST int32_t TableFunctionManager_getNewDictId(int8_t *mgr_ptr)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const int32_t TableFunctionManager::getOrAddTransient ( int32_t  db_id,
int32_t  dict_id,
const std::string &  str 
)
inline

Definition at line 262 of file TableFunctionManager.h.

References executor_, and row_set_mem_owner_.

264  {
265  const auto proxy =
266  executor_->getStringDictionaryProxy({db_id, dict_id}, row_set_mem_owner_, true);
267  return proxy->getOrAddTransient(str);
268  }
std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner_
int32_t TableFunctionManager::getOrAddTransient ( int32_t  db_id,
int32_t  dict_id,
std::string  str 
)
inline

Definition at line 1282 of file heavydbTypes.h.

References TableFunctionManager_getOrAddTransient().

Referenced by array_asarray__cpu_template().

1282  {
1284  reinterpret_cast<int8_t*>(this), db_id, dict_id, str);
1285  }
EXTENSION_NOINLINE_HOST int32_t TableFunctionManager_getOrAddTransient(int8_t *mgr_ptr, int32_t db_id, int32_t dict_id, std::string str)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string TableFunctionManager::getString ( int32_t  db_id,
int32_t  dict_id,
int32_t  string_id 
)
inline

Definition at line 249 of file TableFunctionManager.h.

References executor_, and row_set_mem_owner_.

249  {
250  const auto proxy =
251  executor_->getStringDictionaryProxy({db_id, dict_id}, row_set_mem_owner_, true);
252  return proxy->getString(string_id);
253  }
std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner_
std::string TableFunctionManager::getString ( int32_t  db_id,
int32_t  dict_id,
int32_t  string_id 
)
inline

Definition at line 1274 of file heavydbTypes.h.

References TableFunctionManager_getString().

Referenced by array_asarray__cpu_template().

1274  {
1276  reinterpret_cast<int8_t*>(this), db_id, dict_id, string_id);
1277  }
std::string TableFunctionManager_getString(int8_t *mgr_ptr, int32_t db_id, int32_t dict_id, int32_t string_id)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int8_t* TableFunctionManager::getStringDictionaryProxy ( int32_t  db_id,
int32_t  dict_id 
)
inline

Definition at line 244 of file TableFunctionManager.h.

References executor_, and row_set_mem_owner_.

244  {
245  return reinterpret_cast<int8_t*>(
246  executor_->getStringDictionaryProxy({db_id, dict_id}, row_set_mem_owner_, true));
247  }
std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner_
StringDictionaryProxy* TableFunctionManager::getStringDictionaryProxy ( int32_t  db_id,
int32_t  dict_id 
)
inline

Definition at line 1269 of file heavydbTypes.h.

References TableFunctionManager_getStringDictionaryProxy().

1269  {
1270  return reinterpret_cast<StringDictionaryProxy*>(
1272  reinterpret_cast<int8_t*>(this), db_id, dict_id));
1273  }
EXTENSION_NOINLINE_HOST int8_t * TableFunctionManager_getStringDictionaryProxy(int8_t *mgr_ptr, int32_t db_id, int32_t dict_id)

+ Here is the call graph for this function:

bool TableFunctionManager::isSingleton ( ) const
inline

Definition at line 272 of file TableFunctionManager.h.

References is_singleton_.

Referenced by TableFunctionManager(), and ~TableFunctionManager().

272 { return is_singleton_; }

+ Here is the caller graph for this function:

void TableFunctionManager::lock ( )
inlineprivate

Definition at line 286 of file TableFunctionManager.h.

References TableFunctionManager_singleton_mutex.

Referenced by set_singleton().

std::mutex TableFunctionManager_singleton_mutex

+ Here is the caller graph for this function:

void TableFunctionManager::set_error_message ( const char *  msg)
inline

Definition at line 211 of file TableFunctionManager.h.

References check_thread_id(), and error_message_.

211  {
212  check_thread_id();
213  error_message_ = std::string(msg);
214  }

+ Here is the call graph for this function:

void TableFunctionManager::set_metadata ( const char *  key,
const uint8_t *  raw_bytes,
const size_t  num_bytes,
const TableFunctionMetadataType  value_type 
) const
inline

Definition at line 216 of file TableFunctionManager.h.

References CHECK, and row_set_mem_owner_.

219  {
221  row_set_mem_owner_->setTableFunctionMetadata(key, raw_bytes, num_bytes, value_type);
222  }
std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner_
#define CHECK(condition)
Definition: Logger.h:291
template<typename T >
void TableFunctionManager::set_metadata ( const std::string &  key,
const T &  value 
)
inline

Definition at line 1240 of file heavydbTypes.h.

References TableFunctionManager_set_metadata().

Referenced by GeoRaster< T, Z >::setMetadata(), tf_metadata_setter__cpu_template(), tf_metadata_setter_repeated__cpu_template(), and tf_metadata_setter_size_mismatch__cpu_template().

1240  {
1241  TableFunctionManager_set_metadata(reinterpret_cast<int8_t*>(this),
1242  key.c_str(),
1243  reinterpret_cast<const uint8_t*>(&value),
1244  sizeof(value),
1245  get_metadata_type<T>());
1246  }
EXTENSION_NOINLINE_HOST void TableFunctionManager_set_metadata(int8_t *mgr_ptr, const char *key, const uint8_t *raw_bytes, const size_t num_bytes, const TableFunctionMetadataType value_type)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void TableFunctionManager::set_output_array_values_total_number ( int32_t  index,
int64_t  output_array_values_total_number 
)
inline

Definition at line 107 of file TableFunctionManager.h.

References CHECK_EQ, CHECK_LE, CHECK_LT, get_ncols(), output_array_values_total_number_, and output_num_rows_.

108  {
110  size_t(-1)); // set_output_array_size must be called
111  // before set_output_row_size because
112  // set_output_row_size allocates the output
113  // buffers
114  int32_t num_out_columns = get_ncols();
115  CHECK_LE(0, index);
116  CHECK_LT(index, num_out_columns);
117  output_array_values_total_number_[index] = output_array_values_total_number;
118  }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
#define CHECK_LT(x, y)
Definition: Logger.h:303
#define CHECK_LE(x, y)
Definition: Logger.h:304
std::vector< int64_t > output_array_values_total_number_

+ Here is the call graph for this function:

void TableFunctionManager::set_output_array_values_total_number ( int32_t  index,
int64_t  output_array_values_total_number 
)
inline

Definition at line 1219 of file heavydbTypes.h.

References TableFunctionManager_set_output_array_values_total_number().

Referenced by array_asarray__cpu_template(), array_concat__cpu_template(), array_copier__cpu_template(), and array_split__cpu_template().

1220  {
1222  reinterpret_cast<int8_t*>(this), index, output_array_values_total_number);
1223  }
EXTENSION_NOINLINE_HOST void TableFunctionManager_set_output_array_values_total_number(int8_t *mgr_ptr, int32_t index, int64_t output_array_values_total_number)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void TableFunctionManager::set_output_column ( int32_t  index,
int8_t *  ptr 
)
inline

Definition at line 99 of file TableFunctionManager.h.

References CHECK, check_thread_id(), get_ncols(), and output_column_ptrs.

99  {
100  check_thread_id();
101  CHECK(index >= 0 && index < static_cast<int32_t>(get_ncols()));
102  CHECK(ptr);
103  output_column_ptrs[index] = ptr;
104  }
std::vector< int8_t * > output_column_ptrs
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

void TableFunctionManager::set_output_row_size ( int64_t  num_rows)
inline

Definition at line 1225 of file heavydbTypes.h.

References TableFunctionManager_set_output_row_size().

Referenced by array_asarray__cpu_template(), array_concat__cpu_template(), array_copier__cpu_template(), array_split__cpu_template(), ct_add_size_and_mul_alpha(), ct_copy_and_add_size(), ct_cursor_named_args__cpu_(), ct_pushdown_projection__cpu_template(), ct_pushdown_stats__cpu_template(), ct_scalar_named_args__cpu_(), ct_sleep2(), ct_sparse_add(), ct_string_concat__cpu_(), ct_substr__cpu_(), ct_synthesize_new_dict__cpu_(), ct_test_preflight_multicursor_qe227__cpu_(), ct_test_preflight_singlecursor_qe227__cpu_(), ct_throw_if_gt_100__cpu_template(), ct_timestamp_add_interval__template(), ct_timestamp_add_offset(), ct_timestamp_column_list_input(), ct_timestamp_extract(), ct_timestamp_truncate(), ct_union_pushdown_projection__cpu_template(), ct_union_pushdown_stats__cpu_template(), dbscan__cpu_template(), generate_random_strings__cpu_(), generate_series__cpu_template(), kmeans__cpu_template(), linear_reg_fit__cpu_template(), linear_reg_predict__cpu_template(), Mandelbrot::mandelbrot_cpu_template(), GeoRaster< T, Z >::outputDenseColumns(), supported_ml_frameworks__cpu_(), tf_metadata_getter__cpu_template(), tf_metadata_getter_bad__cpu_template(), tf_metadata_setter__cpu_template(), tf_metadata_setter_repeated__cpu_template(), and tf_metadata_setter_size_mismatch__cpu_template().

1225  {
1226  if (!output_allocations_disabled) {
1227  TableFunctionManager_set_output_row_size(reinterpret_cast<int8_t*>(this), num_rows);
1228  }
1229  }
EXTENSION_NOINLINE_HOST void TableFunctionManager_set_output_row_size(int8_t *mgr_ptr, int64_t num_rows)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void TableFunctionManager::set_singleton ( TableFunctionManager instance)
inlinestaticprivate

Definition at line 289 of file TableFunctionManager.h.

References CHECK, get_singleton(), and lock().

Referenced by TableFunctionManager(), and ~TableFunctionManager().

289  {
290  auto& instance_ = get_singleton();
291  // ensure being singleton and lock/unlock
292  if (instance) {
293  instance->lock();
294  CHECK(instance_ == nullptr);
295  } else {
296  CHECK(instance_ != nullptr);
297  instance_->unlock();
298  }
299  instance_ = instance;
300  }
#define CHECK(condition)
Definition: Logger.h:291
static TableFunctionManager * get_singleton()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void TableFunctionManager::unlock ( )
inlineprivate

Definition at line 287 of file TableFunctionManager.h.

References TableFunctionManager_singleton_mutex.

std::mutex TableFunctionManager_singleton_mutex

Member Data Documentation

std::vector<const int8_t*>& TableFunctionManager::col_buf_ptrs_
private

Definition at line 305 of file TableFunctionManager.h.

Referenced by allocate_output_buffers().

std::string TableFunctionManager::error_message_
private

Definition at line 321 of file TableFunctionManager.h.

Referenced by get_error_message(), and set_error_message().

const TableFunctionExecutionUnit& TableFunctionManager::exe_unit_
private

Definition at line 302 of file TableFunctionManager.h.

Referenced by allocate_output_buffers(), and get_ncols().

Executor* TableFunctionManager::executor_
private
bool output_allocations_disabled TableFunctionManager::false

Definition at line 1297 of file heavydbTypes.h.

bool TableFunctionManager::is_singleton_
private

Definition at line 317 of file TableFunctionManager.h.

Referenced by isSingleton().

std::vector<int64_t> TableFunctionManager::output_array_values_total_number_
private
std::vector<int64_t*> TableFunctionManager::output_col_buf_ptrs
private

Definition at line 309 of file TableFunctionManager.h.

Referenced by allocate_output_buffers(), and TableFunctionManager().

std::vector<int8_t*> TableFunctionManager::output_column_ptrs
private
size_t TableFunctionManager::output_num_rows_
private
std::unique_ptr<QueryMemoryInitializer> TableFunctionManager::query_buffers

Definition at line 57 of file TableFunctionManager.h.

Referenced by allocate_output_buffers().

std::shared_ptr<RowSetMemoryOwner> TableFunctionManager::row_set_mem_owner_
private
std::thread::id TableFunctionManager::thread_id_
private

Definition at line 319 of file TableFunctionManager.h.

Referenced by check_thread_id().


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