OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TableFunctionsTesting.hpp File Reference
#include "../../QueryEngine/OmniSciTypes.h"
#include <algorithm>
#include <iostream>
#include <string>
+ Include dependency graph for TableFunctionsTesting.hpp:

Go to the source code of this file.

Classes

struct  SortAsc< T >
 
struct  SortDesc< T >
 

Macros

#define CPU_DEVICE_CODE   0x637075;
 
#define GPU_DEVICE_CODE   0x677075;
 

Functions

EXTENSION_NOINLINE int32_t ct_device_selection_udtf_any (const Column< int32_t > &input, Column< int64_t > &out)
 
EXTENSION_NOINLINE int32_t ct_device_selection_udtf_cpu__cpu_ (const Column< int32_t > &input, Column< int64_t > &out)
 
EXTENSION_NOINLINE int32_t ct_device_selection_udtf_gpu__gpu_ (const Column< int32_t > &input, Column< int64_t > &out)
 
EXTENSION_NOINLINE int32_t ct_device_selection_udtf_both__cpu_ (const Column< int32_t > &input, Column< int64_t > &out)
 
EXTENSION_NOINLINE int32_t ct_device_selection_udtf_both__gpu_ (const Column< int32_t > &input, Column< int64_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_1 (const Column< int32_t > &input1, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_2 (const Column< int32_t > &input1, const Column< int32_t > &input2, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_3 (const Column< int32_t > &input1, const Column< int32_t > &input2, const Column< int32_t > &input3, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_4 (const Column< int64_t > &input1, const Column< int32_t > &input2, const Column< int32_t > &input3, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_5 (const Column< int64_t > &input1, const Column< int64_t > &input2, const Column< int32_t > &input3, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_6 (const Column< int64_t > &input1, const Column< int32_t > &input2, const Column< int64_t > &input3, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_7 (const Column< int32_t > &input1, const ColumnList< int32_t > &input2, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_8 (const ColumnList< int32_t > &input1, const Column< int64_t > &input2, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_9 (const ColumnList< int32_t > &input1, const ColumnList< int64_t > &input2, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_10 (const Column< int64_t > &input1, const ColumnList< int64_t > &input2, const Column< int64_t > &input3, Column< int64_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_11 (const Column< int32_t > &input1, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_12 (const Column< int32_t > &input1, const Column< int32_t > &input2, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_13 (const Column< int32_t > &input1, const Column< int32_t > &input2, const Column< int32_t > &input3, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_14 (const Column< int64_t > &input1, const Column< int32_t > &input2, const Column< int32_t > &input3, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_15 (const Column< int64_t > &input1, const Column< int64_t > &input2, const Column< int32_t > &input3, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_16 (const Column< int64_t > &input1, const Column< int32_t > &input2, const Column< int64_t > &input3, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_17 (const Column< int32_t > &input1, const ColumnList< int32_t > &input2, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_18 (const ColumnList< int32_t > &input1, const Column< int64_t > &input2, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_19 (const ColumnList< int32_t > &input1, const ColumnList< int64_t > &input2, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_20 (const Column< int64_t > &input1, const ColumnList< int64_t > &input2, const Column< int64_t > &input3, const int32_t multiplier, Column< int64_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf2__cpu_21 (const int32_t multiplier, const Column< int32_t > &input1, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf6__cpu_22 (const Column< int32_t > &input1, const int32_t multiplier, const int32_t input2, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf4__cpu_23 (const ColumnList< int32_t > &input1, const int32_t multiplier, const int32_t input2, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf5__cpu_24 (const ColumnList< int32_t > &input1, const int32_t input2, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_udtf3__cpu_25 (const Column< int32_t > &input1, const int32_t input2, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer1a__cpu_1 (const Column< int32_t > &input1, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer1b__cpu_2 (const Column< int32_t > &input1, const Column< int32_t > &input2, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer1c__cpu_3 (const Column< int32_t > &input1, const Column< int32_t > &input2, const Column< int32_t > &input3, const int32_t multiplier, const Column< int32_t > &input4, const int32_t x, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer1d__cpu_4 (const int32_t multiplier, const int32_t x, const Column< int32_t > &input1, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer2a__cpu_1 (const Column< int32_t > &input1, const int32_t x, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer2b__cpu_2 (const Column< int32_t > &input1, const int32_t multiplier, const Column< int32_t > &input2, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer2c__cpu_3 (const int32_t x, const int32_t multiplier, const Column< int32_t > &input1, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer3a__cpu_1 (const Column< int32_t > &input1, const int32_t multiplier, const int32_t x, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer3b__cpu_2 (const Column< int32_t > &input1, const int32_t x, const Column< int32_t > &input2, const int32_t multiplier, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer4a__cpu_1 (const Column< int32_t > &input1, const int32_t multiplier, const Column< int32_t > &input2, const int32_t x, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer4b__cpu_2 (const int32_t multiplier, const Column< int32_t > &input, const int32_t x, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_dict_encoded1__cpu_1 (const Column< TextEncodingDict > &input, const int32_t multiplier, Column< TextEncodingDict > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_dict_encoded2__cpu_1 (const Column< TextEncodingDict > &input1, const Column< TextEncodingDict > &input2, Column< TextEncodingDict > &out1, Column< TextEncodingDict > &out2)
 
EXTENSION_NOINLINE int32_t ct_binding_dict_encoded3__cpu_1 (const Column< TextEncodingDict > &input1, const Column< TextEncodingDict > &input2, Column< TextEncodingDict > &out1, Column< TextEncodingDict > &out2)
 
EXTENSION_NOINLINE int32_t ct_binding_dict_encoded4__cpu_1 (const ColumnList< TextEncodingDict > &input, Column< TextEncodingDict > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_dict_encoded5__cpu_1 (const ColumnList< TextEncodingDict > &input, Column< TextEncodingDict > &out)
 
EXTENSION_NOINLINE int32_t ct_binding_dict_encoded6__cpu_1 (const ColumnList< TextEncodingDict > &input, Column< TextEncodingDict > &out0, Column< TextEncodingDict > &out1)
 
template<typename T >
TEMPLATE_NOINLINE int32_t ct_binding_template__cpu_template (const Column< T > &input, Column< T > &out)
 
template<typename T >
TEMPLATE_NOINLINE int32_t ct_binding_columnlist__cpu_template (const Column< T > &input1, const ColumnList< T > &input2, Column< int32_t > &out)
 
template<typename T >
TEMPLATE_NOINLINE int32_t ct_binding_column__cpu_template (const Column< T > &input, Column< int32_t > &out)
 
template<typename T >
TEMPLATE_NOINLINE int32_t ct_binding_scalar_multiply__cpu_template (const Column< T > &input, const T multiplier, Column< T > &out)
 
template<typename T >
TEMPLATE_NOINLINE int32_t sort_column_limit__cpu_template (const Column< T > &input, const int32_t limit, const bool sort_ascending, const bool nulls_last, Column< T > &output)
 
template<typename T , typename U , typename K >
TEMPLATE_NOINLINE int32_t ct_binding_column2__cpu_template (const Column< T > &input1, const Column< U > &input2, Column< K > &out)
 
template<typename T >
TEMPLATE_NOINLINE int32_t ct_named_output__cpu_template (const Column< T > &input, Column< T > &out)
 
template<typename T >
TEMPLATE_NOINLINE int32_t ct_named_const_output__template (const Column< T > &input, Column< T > &out)
 
template<typename T >
TEMPLATE_NOINLINE int32_t ct_named_user_const_output__template (const Column< T > &input, int32_t c, Column< T > &out)
 
template<typename T >
TEMPLATE_NOINLINE int32_t ct_named_rowmul_output__template (const Column< T > &input, int32_t m, Column< T > &out)
 
template<typename T >
TEMPLATE_NOINLINE int32_t ct_no_arg_runtime_sizing__cpu_template (Column< T > &answer)
 
EXTENSION_NOINLINE int32_t ct_no_arg_constant_sizing__cpu_ (Column< int32_t > &answer)
 
template<typename T >
TEMPLATE_NOINLINE int32_t ct_scalar_1_arg_runtime_sizing__cpu_template (const T num, Column< T > &answer)
 
EXTENSION_NOINLINE int32_t ct_scalar_2_args_constant_sizing (const int64_t num1, const int64_t num2, Column< int64_t > &answer1, Column< int64_t > &answer2)
 
EXTENSION_NOINLINE int32_t ct_no_cursor_user_constant_sizer__cpu_ (const int32_t input_num, int32_t c, Column< int32_t > &output)
 
template<typename T >
TEMPLATE_NOINLINE int32_t ct_templated_no_cursor_user_constant_sizer__cpu_template (const T input_num, int32_t c, Column< T > &output)
 
template<typename T >
safe_addition (T x, T y)
 
template<typename T >
int32_t column_list_safe_row_sum__cpu_template (const ColumnList< T > &input, Column< T > &out)
 
EXTENSION_NOINLINE int32_t ct_hamming_distance (const TextEncodingNone &str1, const TextEncodingNone &str2, Column< int32_t > &hamming_distance)
 
template<typename T >
TEMPLATE_NOINLINE int32_t ct_get_string_chars__template (const Column< T > &indices, const TextEncodingNone &str, const int32_t multiplier, Column< int32_t > &idx, Column< int8_t > &char_bytes)
 
EXTENSION_NOINLINE int32_t ct_string_to_chars__cpu_ (const TextEncodingNone &input, Column< int32_t > &char_idx, Column< int8_t > &char_bytes)
 
EXTENSION_NOINLINE int32_t ct_sleep_worker (int32_t seconds, Column< int32_t > &output)
 
EXTENSION_NOINLINE int32_t ct_sleep1 (int32_t seconds, int32_t mode, Column< int32_t > &output)
 
EXTENSION_NOINLINE int32_t ct_sleep2 (TableFunctionManager &mgr, int32_t seconds, int32_t mode, Column< int32_t > &output)
 
template<typename T >
TEMPLATE_NOINLINE int32_t ct_throw_if_gt_100__cpu_template (TableFunctionManager &mgr, const Column< T > &input, Column< T > &output)
 
EXTENSION_NOINLINE int32_t ct_copy_and_add_size (TableFunctionManager &mgr, const Column< int32_t > &input, Column< int32_t > &output)
 
EXTENSION_NOINLINE int32_t ct_add_size_and_mul_alpha (TableFunctionManager &mgr, const Column< int32_t > &input1, const Column< int32_t > &input2, int32_t alpha, Column< int32_t > &output1, Column< int32_t > &output2)
 
EXTENSION_NOINLINE int32_t ct_require (const Column< int32_t > &input1, const int32_t i, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_require_str (const Column< int32_t > &input1, const TextEncodingNone &s, Column< int32_t > &out)
 
EXTENSION_NOINLINE int32_t ct_require_mgr (TableFunctionManager &mgr, const Column< int32_t > &input1, const int32_t i, Column< int32_t > &out)
 

Macro Definition Documentation

#define CPU_DEVICE_CODE   0x637075;
#define GPU_DEVICE_CODE   0x677075;

Function Documentation

template<typename T >
int32_t column_list_safe_row_sum__cpu_template ( const ColumnList< T > &  input,
Column< T > &  out 
)

Definition at line 906 of file TableFunctionsTesting.hpp.

References i, ColumnList< T >::numCols(), safe_addition(), set_output_row_size(), omnisci.dtypes::T, and TABLE_FUNCTION_ERROR.

907  {
908  int32_t output_num_rows = input.numCols();
909  set_output_row_size(output_num_rows);
910  for (int i = 0; i < output_num_rows; i++) {
911  auto col = input[i];
912  T s = 0;
913  for (int j = 0; j < col.size(); j++) {
914  try {
915  s = safe_addition(s, col[j]);
916  } catch (const std::exception& e) {
917  return TABLE_FUNCTION_ERROR(e.what());
918  } catch (...) {
919  return TABLE_FUNCTION_ERROR("Unknown error");
920  }
921  }
922  out[i] = s;
923  }
924  return output_num_rows;
925 }
DEVICE int64_t numCols() const
Definition: OmniSciTypes.h:269
T safe_addition(T x, T y)
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)
#define TABLE_FUNCTION_ERROR(MSG)
Definition: OmniSciTypes.h:44

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_add_size_and_mul_alpha ( TableFunctionManager mgr,
const Column< int32_t > &  input1,
const Column< int32_t > &  input2,
int32_t  alpha,
Column< int32_t > &  output1,
Column< int32_t > &  output2 
)

Definition at line 1179 of file TableFunctionsTesting.hpp.

References i, TableFunctionManager::set_output_row_size(), and Column< T >::size().

1184  {
1185  auto size = input1.size();
1186  mgr.set_output_row_size(size);
1187  for (int32_t i = 0; i < size; i++) {
1188  output1[i] = input1[i] + size;
1189  output2[i] = input2[i] * alpha;
1190  }
1191  return size;
1192 }
void set_output_row_size(int64_t num_rows)
Definition: OmniSciTypes.h:304
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218

+ Here is the call graph for this function:

template<typename T , typename U , typename K >
TEMPLATE_NOINLINE int32_t ct_binding_column2__cpu_template ( const Column< T > &  input1,
const Column< U > &  input2,
Column< K > &  out 
)

Definition at line 640 of file TableFunctionsTesting.hpp.

References i, set_output_row_size(), and Column< T >::size().

642  {
643  if constexpr (std::is_same<T, TextEncodingDict>::value &&
644  std::is_same<U, TextEncodingDict>::value) {
645  set_output_row_size(input1.size());
646  for (int64_t i = 0; i < input1.size(); i++) {
647  out[i] = input1[i];
648  }
649  return input1.size();
650  }
651 
653  if constexpr (std::is_same<T, int32_t>::value && std::is_same<U, double>::value) {
654  out[0] = 10;
655  } else if constexpr (std::is_same<T, double>::value && std::is_same<U, double>::value) {
656  out[0] = 20;
657  } else if constexpr (std::is_same<T, int32_t>::value &&
658  std::is_same<U, int32_t>::value) {
659  out[0] = 30;
660  } else if constexpr (std::is_same<T, double>::value &&
661  std::is_same<U, int32_t>::value) {
662  out[0] = 40;
663  }
664  return 1;
665 }
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)

+ Here is the call graph for this function:

template<typename T >
TEMPLATE_NOINLINE int32_t ct_binding_column__cpu_template ( const Column< T > &  input,
Column< int32_t > &  out 
)

Definition at line 527 of file TableFunctionsTesting.hpp.

References set_output_row_size().

528  {
530  if constexpr (std::is_same<T, int32_t>::value) {
531  out[0] = 10;
532  } else {
533  out[0] = 20;
534  }
535  return 1;
536 }
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)

+ Here is the call graph for this function:

template<typename T >
TEMPLATE_NOINLINE int32_t ct_binding_columnlist__cpu_template ( const Column< T > &  input1,
const ColumnList< T > &  input2,
Column< int32_t > &  out 
)

Definition at line 504 of file TableFunctionsTesting.hpp.

References set_output_row_size().

506  {
508  if constexpr (std::is_same<T, int32_t>::value) {
509  out[0] = 1;
510  } else if constexpr (std::is_same<T, float>::value) {
511  out[0] = 2;
512  } else if constexpr (std::is_same<T, TextEncodingDict>::value) {
513  out[0] = 3;
514  } else {
515  out[0] = 4;
516  }
517  return 1;
518 }
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_binding_dict_encoded1__cpu_1 ( const Column< TextEncodingDict > &  input,
const int32_t  multiplier,
Column< TextEncodingDict > &  out 
)

Definition at line 408 of file TableFunctionsTesting.hpp.

References i, and Column< T >::size().

410  {
411  for (int64_t i = 0; i < input.size(); i++) {
412  out[i] = input[i]; // assign string id
413  }
414  return multiplier * input.size();
415 }
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_binding_dict_encoded2__cpu_1 ( const Column< TextEncodingDict > &  input1,
const Column< TextEncodingDict > &  input2,
Column< TextEncodingDict > &  out1,
Column< TextEncodingDict > &  out2 
)

Definition at line 418 of file TableFunctionsTesting.hpp.

References i, set_output_row_size(), and Column< T >::size().

421  {
422  set_output_row_size(input1.size());
423  for (int64_t i = 0; i < input1.size(); i++) {
424  out1[i] = input1[i];
425  out2[i] = input2[i];
426  }
427  return input1.size();
428 }
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_binding_dict_encoded3__cpu_1 ( const Column< TextEncodingDict > &  input1,
const Column< TextEncodingDict > &  input2,
Column< TextEncodingDict > &  out1,
Column< TextEncodingDict > &  out2 
)

Definition at line 431 of file TableFunctionsTesting.hpp.

References i, set_output_row_size(), and Column< T >::size().

434  {
435  set_output_row_size(input1.size());
436  for (int64_t i = 0; i < input1.size(); i++) {
437  out1[i] = input2[i];
438  out2[i] = input1[i];
439  }
440  return input1.size();
441 }
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_binding_dict_encoded4__cpu_1 ( const ColumnList< TextEncodingDict > &  input,
Column< TextEncodingDict > &  out 
)

Definition at line 444 of file TableFunctionsTesting.hpp.

References i, set_output_row_size(), and ColumnList< T >::size().

445  {
446  int64_t sz = input[0].size();
448  for (int64_t i = 0; i < sz; i++) {
449  out[i] = input[0][i];
450  }
451  return sz;
452 }
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)
DEVICE int64_t size() const
Definition: OmniSciTypes.h:268

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_binding_dict_encoded5__cpu_1 ( const ColumnList< TextEncodingDict > &  input,
Column< TextEncodingDict > &  out 
)

Definition at line 455 of file TableFunctionsTesting.hpp.

References i, set_output_row_size(), and ColumnList< T >::size().

456  {
457  int64_t sz = input[1].size();
459  for (int64_t i = 0; i < sz; i++) {
460  out[i] = input[1][i];
461  }
462  return sz;
463 }
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)
DEVICE int64_t size() const
Definition: OmniSciTypes.h:268

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_binding_dict_encoded6__cpu_1 ( const ColumnList< TextEncodingDict > &  input,
Column< TextEncodingDict > &  out0,
Column< TextEncodingDict > &  out1 
)

Definition at line 466 of file TableFunctionsTesting.hpp.

References i, set_output_row_size(), and ColumnList< T >::size().

468  {
469  int64_t sz = input[0].size();
471  for (int64_t i = 0; i < sz; i++) {
472  out0[i] = input[0][i];
473  out1[i] = input[1][i];
474  }
475  return sz;
476 }
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)
DEVICE int64_t size() const
Definition: OmniSciTypes.h:268

+ Here is the call graph for this function:

template<typename T >
TEMPLATE_NOINLINE int32_t ct_binding_scalar_multiply__cpu_template ( const Column< T > &  input,
const multiplier,
Column< T > &  out 
)

Definition at line 547 of file TableFunctionsTesting.hpp.

References Column< T >::isNull(), set_output_row_size(), Column< T >::setNull(), and Column< T >::size().

549  {
550  const int64_t num_rows = input.size();
551  set_output_row_size(num_rows);
552  for (int64_t r = 0; r < num_rows; ++r) {
553  if (!input.isNull(r)) {
554  out[r] = input[r] * multiplier;
555  } else {
556  out.setNull(r);
557  }
558  }
559  return num_rows;
560 }
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)
DEVICE bool isNull(int64_t index) const
Definition: OmniSciTypes.h:220
DEVICE void setNull(int64_t index)
Definition: OmniSciTypes.h:221

+ Here is the call graph for this function:

template<typename T >
TEMPLATE_NOINLINE int32_t ct_binding_template__cpu_template ( const Column< T > &  input,
Column< T > &  out 
)

Definition at line 486 of file TableFunctionsTesting.hpp.

References i, set_output_row_size(), and Column< T >::size().

487  {
488  set_output_row_size(input.size());
489  for (int64_t i = 0; i < input.size(); i++) {
490  out[i] = input[i];
491  }
492  return input.size();
493 }
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_binding_udtf2__cpu_21 ( const int32_t  multiplier,
const Column< int32_t > &  input1,
Column< int32_t > &  out 
)

Definition at line 261 of file TableFunctionsTesting.hpp.

263  {
264  out[0] = 1000 + 91 + multiplier;
265  return 1;
266 }
EXTENSION_NOINLINE int32_t ct_binding_udtf3__cpu_25 ( const Column< int32_t > &  input1,
const int32_t  input2,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 288 of file TableFunctionsTesting.hpp.

291  {
292  out[0] = 1000 + 169 + multiplier + 10 * input2;
293  return 1;
294 }
EXTENSION_NOINLINE int32_t ct_binding_udtf4__cpu_23 ( const ColumnList< int32_t > &  input1,
const int32_t  multiplier,
const int32_t  input2,
Column< int32_t > &  out 
)

Definition at line 274 of file TableFunctionsTesting.hpp.

277  {
278  out[0] = 1000 + 396 + multiplier + 10 * input2;
279  return 1;
280 }
EXTENSION_NOINLINE int32_t ct_binding_udtf5__cpu_24 ( const ColumnList< int32_t > &  input1,
const int32_t  input2,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 281 of file TableFunctionsTesting.hpp.

284  {
285  out[0] = 1000 + 369 + multiplier + 10 * input2;
286  return 1;
287 }
EXTENSION_NOINLINE int32_t ct_binding_udtf6__cpu_22 ( const Column< int32_t > &  input1,
const int32_t  multiplier,
const int32_t  input2,
Column< int32_t > &  out 
)

Definition at line 267 of file TableFunctionsTesting.hpp.

270  {
271  out[0] = 1000 + 196 + multiplier + 10 * input2;
272  return 1;
273 }
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_11 ( const Column< int32_t > &  input1,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 186 of file TableFunctionsTesting.hpp.

188  {
189  out[0] = 1000 + 19 + multiplier;
190  return 1;
191 }
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_12 ( const Column< int32_t > &  input1,
const Column< int32_t > &  input2,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 192 of file TableFunctionsTesting.hpp.

195  {
196  out[0] = 1000 + 119 + multiplier;
197  return 1;
198 }
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_13 ( const Column< int32_t > &  input1,
const Column< int32_t > &  input2,
const Column< int32_t > &  input3,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 199 of file TableFunctionsTesting.hpp.

203  {
204  out[0] = 1000 + 1119 + multiplier;
205  return 1;
206 }
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_14 ( const Column< int64_t > &  input1,
const Column< int32_t > &  input2,
const Column< int32_t > &  input3,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 207 of file TableFunctionsTesting.hpp.

211  {
212  out[0] = 1000 + 2119 + multiplier;
213  return 1;
214 }
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_15 ( const Column< int64_t > &  input1,
const Column< int64_t > &  input2,
const Column< int32_t > &  input3,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 215 of file TableFunctionsTesting.hpp.

219  {
220  out[0] = 1000 + 2219 + multiplier;
221  return 1;
222 }
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_16 ( const Column< int64_t > &  input1,
const Column< int32_t > &  input2,
const Column< int64_t > &  input3,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 223 of file TableFunctionsTesting.hpp.

227  {
228  out[0] = 1000 + 2129 + multiplier;
229  return 1;
230 }
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_17 ( const Column< int32_t > &  input1,
const ColumnList< int32_t > &  input2,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 231 of file TableFunctionsTesting.hpp.

234  {
235  out[0] = 1000 + 139 + multiplier;
236  return 1;
237 }
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_18 ( const ColumnList< int32_t > &  input1,
const Column< int64_t > &  input2,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 238 of file TableFunctionsTesting.hpp.

241  {
242  out[0] = 1000 + 329 + multiplier;
243  return 1;
244 }
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_19 ( const ColumnList< int32_t > &  input1,
const ColumnList< int64_t > &  input2,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 245 of file TableFunctionsTesting.hpp.

248  {
249  out[0] = 1000 + 349 + multiplier;
250  return 1;
251 }
EXTENSION_NOINLINE int32_t ct_binding_udtf__cpu_20 ( const Column< int64_t > &  input1,
const ColumnList< int64_t > &  input2,
const Column< int64_t > &  input3,
const int32_t  multiplier,
Column< int64_t > &  out 
)

Definition at line 252 of file TableFunctionsTesting.hpp.

256  {
257  out[0] = 1000 + 2429 + multiplier;
258  return 1;
259 }
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_1 ( const Column< int32_t > &  input1,
Column< int32_t > &  out 
)

Definition at line 117 of file TableFunctionsTesting.hpp.

118  {
119  out[0] = 1;
120  return 1;
121 }
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_10 ( const Column< int64_t > &  input1,
const ColumnList< int64_t > &  input2,
const Column< int64_t > &  input3,
Column< int64_t > &  out 
)

Definition at line 178 of file TableFunctionsTesting.hpp.

181  {
182  out[0] = 242;
183  return 1;
184 }
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_2 ( const Column< int32_t > &  input1,
const Column< int32_t > &  input2,
Column< int32_t > &  out 
)

Definition at line 122 of file TableFunctionsTesting.hpp.

124  {
125  out[0] = 11;
126  return 1;
127 }
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_3 ( const Column< int32_t > &  input1,
const Column< int32_t > &  input2,
const Column< int32_t > &  input3,
Column< int32_t > &  out 
)

Definition at line 128 of file TableFunctionsTesting.hpp.

131  {
132  out[0] = 111;
133  return 1;
134 }
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_4 ( const Column< int64_t > &  input1,
const Column< int32_t > &  input2,
const Column< int32_t > &  input3,
Column< int32_t > &  out 
)

Definition at line 135 of file TableFunctionsTesting.hpp.

138  {
139  out[0] = 211;
140  return 1;
141 }
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_5 ( const Column< int64_t > &  input1,
const Column< int64_t > &  input2,
const Column< int32_t > &  input3,
Column< int32_t > &  out 
)

Definition at line 142 of file TableFunctionsTesting.hpp.

145  {
146  out[0] = 221;
147  return 1;
148 }
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_6 ( const Column< int64_t > &  input1,
const Column< int32_t > &  input2,
const Column< int64_t > &  input3,
Column< int32_t > &  out 
)

Definition at line 149 of file TableFunctionsTesting.hpp.

152  {
153  out[0] = 212;
154  return 1;
155 }
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_7 ( const Column< int32_t > &  input1,
const ColumnList< int32_t > &  input2,
Column< int32_t > &  out 
)

Definition at line 157 of file TableFunctionsTesting.hpp.

159  {
160  out[0] = 13;
161  return 1;
162 }
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_8 ( const ColumnList< int32_t > &  input1,
const Column< int64_t > &  input2,
Column< int32_t > &  out 
)

Definition at line 164 of file TableFunctionsTesting.hpp.

166  {
167  out[0] = 32;
168  return 1;
169 }
EXTENSION_NOINLINE int32_t ct_binding_udtf_constant__cpu_9 ( const ColumnList< int32_t > &  input1,
const ColumnList< int64_t > &  input2,
Column< int32_t > &  out 
)

Definition at line 171 of file TableFunctionsTesting.hpp.

173  {
174  out[0] = 34;
175  return 1;
176 }
EXTENSION_NOINLINE int32_t ct_copy_and_add_size ( TableFunctionManager mgr,
const Column< int32_t > &  input,
Column< int32_t > &  output 
)

Definition at line 1169 of file TableFunctionsTesting.hpp.

References i, TableFunctionManager::set_output_row_size(), and Column< T >::size().

1171  {
1172  mgr.set_output_row_size(input.size());
1173  for (int32_t i = 0; i < input.size(); i++) {
1174  output[i] = input[i] + input.size();
1175  }
1176  return output.size();
1177 }
void set_output_row_size(int64_t num_rows)
Definition: OmniSciTypes.h:304
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_device_selection_udtf_any ( const Column< int32_t > &  input,
Column< int64_t > &  out 
)

Definition at line 40 of file TableFunctionsTesting.hpp.

References CPU_DEVICE_CODE, and GPU_DEVICE_CODE.

40  {
41 #ifdef __CUDACC__
42  out[0] = GPU_DEVICE_CODE;
43 #else
44  out[0] = CPU_DEVICE_CODE;
45 #endif
46  return 1;
47 }
#define CPU_DEVICE_CODE
#define GPU_DEVICE_CODE
EXTENSION_NOINLINE int32_t ct_device_selection_udtf_both__cpu_ ( const Column< int32_t > &  input,
Column< int64_t > &  out 
)

Definition at line 64 of file TableFunctionsTesting.hpp.

References CPU_DEVICE_CODE.

65  {
66  out[0] = CPU_DEVICE_CODE;
67  return 1;
68 }
#define CPU_DEVICE_CODE
EXTENSION_NOINLINE int32_t ct_device_selection_udtf_both__gpu_ ( const Column< int32_t > &  input,
Column< int64_t > &  out 
)

Definition at line 71 of file TableFunctionsTesting.hpp.

References GPU_DEVICE_CODE.

72  {
73  out[0] = GPU_DEVICE_CODE;
74  return 1;
75 }
#define GPU_DEVICE_CODE
EXTENSION_NOINLINE int32_t ct_device_selection_udtf_cpu__cpu_ ( const Column< int32_t > &  input,
Column< int64_t > &  out 
)

Definition at line 50 of file TableFunctionsTesting.hpp.

References CPU_DEVICE_CODE.

51  {
52  out[0] = CPU_DEVICE_CODE;
53  return 1;
54 }
#define CPU_DEVICE_CODE
EXTENSION_NOINLINE int32_t ct_device_selection_udtf_gpu__gpu_ ( const Column< int32_t > &  input,
Column< int64_t > &  out 
)

Definition at line 57 of file TableFunctionsTesting.hpp.

References GPU_DEVICE_CODE.

58  {
59  out[0] = GPU_DEVICE_CODE;
60  return 1;
61 }
#define GPU_DEVICE_CODE
template<typename T >
TEMPLATE_NOINLINE int32_t ct_get_string_chars__template ( const Column< T > &  indices,
const TextEncodingNone str,
const int32_t  multiplier,
Column< int32_t > &  idx,
Column< int8_t > &  char_bytes 
)

Definition at line 969 of file TableFunctionsTesting.hpp.

References i, TextEncodingNone::size(), and Column< T >::size().

973  {
974  const int32_t str_len = str.size();
975  // Note: we assume RowMultiplier is 1 for this test, was to make running on GPU easy
976  // Todo: Provide Constant RowMultiplier interface
977  if (multiplier != 1) {
978  return 0;
979  }
980  const int32_t num_input_rows = indices.size();
981  const int32_t num_output_rows = num_input_rows * multiplier;
982 
983 #ifdef __CUDACC__
984  const int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
985  const int32_t step = blockDim.x * gridDim.x;
986 #else
987  const int32_t start = 0;
988  const int32_t step = 1;
989 #endif
990 
991  for (int32_t i = start; i < num_output_rows; i += step) {
992  idx[i] = indices[i % num_output_rows];
993  char_bytes[i] = str[i % str_len]; // index < str_len ? str[i] : 0;
994  }
995  return num_output_rows;
996 }
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218
DEVICE ALWAYS_INLINE int64_t size() const
Definition: OmniSciTypes.h:113

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_hamming_distance ( const TextEncodingNone str1,
const TextEncodingNone str2,
Column< int32_t > &  hamming_distance 
)

Definition at line 933 of file TableFunctionsTesting.hpp.

References i, Column< T >::ptr_, and TextEncodingNone::size().

935  {
936  const int32_t str_len = str1.size() <= str2.size() ? str1.size() : str2.size();
937 
938 #ifdef __CUDACC__
939  const int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
940  const int32_t step = blockDim.x * gridDim.x;
941  if (start == 0) {
942  hamming_distance[0] = 0;
943  }
944  int32_t* output_ptr = hamming_distance.ptr_;
945  __syncthreads();
946 #else
947  const int32_t start = 0;
948  const int32_t step = 1;
949 #endif
950 
951  int32_t num_chars_unequal = 0;
952  for (int32_t i = start; i < str_len; i += step) {
953  num_chars_unequal += (str1[i] != str2[i]) ? 1 : 0;
954  }
955 #ifdef __CUDACC__
956  atomicAdd(output_ptr, num_chars_unequal);
957 #else
958  hamming_distance[0] = num_chars_unequal;
959 #endif
960  return 1;
961 }
T * ptr_
Definition: OmniSciTypes.h:199
DEVICE ALWAYS_INLINE int64_t size() const
Definition: OmniSciTypes.h:113

+ Here is the call graph for this function:

template<typename T >
TEMPLATE_NOINLINE int32_t ct_named_const_output__template ( const Column< T > &  input,
Column< T > &  out 
)

Definition at line 689 of file TableFunctionsTesting.hpp.

References i, Column< T >::size(), and omnisci.dtypes::T.

690  {
691  T acc1 = 0, acc2 = 0;
692  for (int64_t i = 0; i < input.size(); i++) {
693  if (i % 2 == 0) {
694  acc1 += input[i];
695  } else {
696  acc2 += input[i];
697  }
698  }
699  out[0] = acc1;
700  out[1] = acc2;
701  return 2;
702 }
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218

+ Here is the call graph for this function:

template<typename T >
TEMPLATE_NOINLINE int32_t ct_named_output__cpu_template ( const Column< T > &  input,
Column< T > &  out 
)

Definition at line 677 of file TableFunctionsTesting.hpp.

References i, set_output_row_size(), Column< T >::size(), and omnisci.dtypes::T.

678  {
680  T acc = 0;
681  for (int64_t i = 0; i < input.size(); i++) {
682  acc += input[i];
683  }
684  out[0] = acc;
685  return 1;
686 }
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)

+ Here is the call graph for this function:

template<typename T >
TEMPLATE_NOINLINE int32_t ct_named_rowmul_output__template ( const Column< T > &  input,
int32_t  m,
Column< T > &  out 
)

Definition at line 718 of file TableFunctionsTesting.hpp.

References i, and Column< T >::size().

720  {
721  for (int64_t j = 0; j < m; j++) {
722  for (int64_t i = 0; i < input.size(); i++) {
723  out[j * input.size() + i] += input[i];
724  }
725  }
726  return m * input.size();
727 }
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218

+ Here is the call graph for this function:

template<typename T >
TEMPLATE_NOINLINE int32_t ct_named_user_const_output__template ( const Column< T > &  input,
int32_t  c,
Column< T > &  out 
)

Definition at line 705 of file TableFunctionsTesting.hpp.

References i, and Column< T >::size().

707  {
708  for (int64_t i = 0; i < c; i++) {
709  out[i] = 0;
710  }
711  for (int64_t i = 0; i < input.size(); i++) {
712  out[i % c] += input[i];
713  }
714  return c;
715 }
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_no_arg_constant_sizing__cpu_ ( Column< int32_t > &  answer)

Definition at line 748 of file TableFunctionsTesting.hpp.

References i.

748  {
749 #ifdef __CUDACC__
750  int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
751  int32_t stop = static_cast<int32_t>(42);
752  int32_t step = blockDim.x * gridDim.x;
753 #else
754  auto start = 0;
755  auto stop = 42;
756  auto step = 1;
757 #endif
758  for (auto i = start; i < stop; i += step) {
759  answer[i] = 42 * i;
760  }
761  return 42;
762 }
template<typename T >
TEMPLATE_NOINLINE int32_t ct_no_arg_runtime_sizing__cpu_template ( Column< T > &  answer)

Definition at line 736 of file TableFunctionsTesting.hpp.

References set_output_row_size().

736  {
738  answer[0] = 42;
739  return 1;
740 }
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_no_cursor_user_constant_sizer__cpu_ ( const int32_t  input_num,
int32_t  c,
Column< int32_t > &  output 
)

Definition at line 816 of file TableFunctionsTesting.hpp.

References i.

818  {
819  for (int32_t i = 0; i < c; i++) {
820  output[i] = input_num;
821  }
822  return c;
823 }
EXTENSION_NOINLINE int32_t ct_require ( const Column< int32_t > &  input1,
const int32_t  i,
Column< int32_t > &  out 
)

Definition at line 1202 of file TableFunctionsTesting.hpp.

References set_output_row_size().

1204  {
1206  out[0] = 3;
1207  return 1;
1208 }
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_require_mgr ( TableFunctionManager mgr,
const Column< int32_t > &  input1,
const int32_t  i,
Column< int32_t > &  out 
)

Definition at line 1218 of file TableFunctionsTesting.hpp.

References set_output_row_size().

1221  {
1223  out[0] = 4;
1224  return 1;
1225 }
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_require_str ( const Column< int32_t > &  input1,
const TextEncodingNone s,
Column< int32_t > &  out 
)

Definition at line 1210 of file TableFunctionsTesting.hpp.

References set_output_row_size().

1212  {
1214  out[0] = 3;
1215  return 1;
1216 }
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)

+ Here is the call graph for this function:

template<typename T >
TEMPLATE_NOINLINE int32_t ct_scalar_1_arg_runtime_sizing__cpu_template ( const num,
Column< T > &  answer 
)

Definition at line 772 of file TableFunctionsTesting.hpp.

References set_output_row_size(), and omnisci.dtypes::T.

772  {
773  T quotient = num;
775  int32_t counter{0};
776  while (quotient >= 1) {
777  answer[counter++] = quotient;
778  quotient /= 10;
779  }
780  return counter;
781 }
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_scalar_2_args_constant_sizing ( const int64_t  num1,
const int64_t  num2,
Column< int64_t > &  answer1,
Column< int64_t > &  answer2 
)

Definition at line 789 of file TableFunctionsTesting.hpp.

References i.

792  {
793 #ifdef __CUDACC__
794  int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
795  int32_t stop = static_cast<int32_t>(5);
796  int32_t step = blockDim.x * gridDim.x;
797 #else
798  auto start = 0;
799  auto stop = 5;
800  auto step = 1;
801 #endif
802  for (auto i = start; i < stop; i += step) {
803  answer1[i] = num1 + i * num2;
804  answer2[i] = num1 - i * num2;
805  }
806  return 5;
807 }
EXTENSION_NOINLINE int32_t ct_sleep1 ( int32_t  seconds,
int32_t  mode,
Column< int32_t > &  output 
)

Definition at line 1072 of file TableFunctionsTesting.hpp.

References ct_sleep_worker(), TableFunctionManager::get_singleton(), set_output_row_size(), Column< T >::size(), and TABLE_FUNCTION_ERROR.

1074  {
1075  switch (mode) {
1076  case 0: {
1077  set_output_row_size(3); // uses global singleton of TableFunctionManager
1078  break;
1079  }
1080  case 1: {
1082  mgr->set_output_row_size(3);
1083  break;
1084  }
1085  case 2:
1086  case 3: {
1087  break;
1088  }
1089  default:
1090  return TABLE_FUNCTION_ERROR("unexpected mode");
1091  }
1092  if (output.size() == 0) {
1093  return TABLE_FUNCTION_ERROR("unspecified output columns row size");
1094  }
1095  return ct_sleep_worker(seconds, output);
1096 }
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)
EXTENSION_NOINLINE int32_t ct_sleep_worker(int32_t seconds, Column< int32_t > &output)
static TableFunctionManager * get_singleton()
Definition: OmniSciTypes.h:300
#define TABLE_FUNCTION_ERROR(MSG)
Definition: OmniSciTypes.h:44

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_sleep2 ( TableFunctionManager mgr,
int32_t  seconds,
int32_t  mode,
Column< int32_t > &  output 
)

Definition at line 1098 of file TableFunctionsTesting.hpp.

References ct_sleep_worker(), TableFunctionManager::get_singleton(), TableFunctionManager::set_output_row_size(), and Column< T >::size().

1101  {
1102  switch (mode) {
1103  case 0:
1104  case 1: {
1105  mgr.set_output_row_size(3); // uses thread-safe TableFunctionManager instance
1106  break;
1107  }
1108  case 2: {
1109  break;
1110  }
1111  case 3: {
1112  try {
1113  auto* mgr0 = TableFunctionManager::get_singleton(); // it may throw "singleton is
1114  // not initialized"
1115  mgr0->set_output_row_size(3);
1116  } catch (std::exception& e) {
1117  return mgr.ERROR_MESSAGE(e.what());
1118  }
1119  break;
1120  }
1121  default:
1122  return mgr.ERROR_MESSAGE("unexpected mode");
1123  }
1124  if (output.size() == 0) {
1125  return mgr.ERROR_MESSAGE("unspecified output columns row size");
1126  }
1127  return ct_sleep_worker(seconds, output);
1128 }
void set_output_row_size(int64_t num_rows)
Definition: OmniSciTypes.h:304
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218
EXTENSION_NOINLINE int32_t ct_sleep_worker(int32_t seconds, Column< int32_t > &output)
static TableFunctionManager * get_singleton()
Definition: OmniSciTypes.h:300

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_sleep_worker ( int32_t  seconds,
Column< int32_t > &  output 
)

Definition at line 1054 of file TableFunctionsTesting.hpp.

References count.

Referenced by ct_sleep1(), and ct_sleep2().

1054  {
1055  // save entering time
1056  output[0] = std::chrono::duration_cast<std::chrono::milliseconds>(
1057  std::chrono::system_clock::now().time_since_epoch())
1058  .count() &
1059  0xffffff;
1060  // store thread id info
1061  output[2] = std::hash<std::thread::id>()(std::this_thread::get_id()) & 0xffff;
1062  // do "computations" for given seconds
1063  std::this_thread::sleep_for(std::chrono::seconds(seconds));
1064  // save leaving time
1065  output[1] = std::chrono::duration_cast<std::chrono::milliseconds>(
1066  std::chrono::system_clock::now().time_since_epoch())
1067  .count() &
1068  0xffffff;
1069  return 3;
1070 }
int count

+ Here is the caller graph for this function:

EXTENSION_NOINLINE int32_t ct_string_to_chars__cpu_ ( const TextEncodingNone input,
Column< int32_t > &  char_idx,
Column< int8_t > &  char_bytes 
)

Definition at line 1009 of file TableFunctionsTesting.hpp.

References TextEncodingNone::getString(), i, and set_output_row_size().

1011  {
1012  const std::string str{input.getString()};
1013  const int64_t str_size(str.size());
1014  set_output_row_size(str_size);
1015  for (int32_t i = 0; i < str_size; ++i) {
1016  char_idx[i] = i;
1017  char_bytes[i] = str[i];
1018  }
1019  return str_size;
1020 }
std::string getString() const
Definition: OmniSciTypes.h:106
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)

+ Here is the call graph for this function:

template<typename T >
TEMPLATE_NOINLINE int32_t ct_templated_no_cursor_user_constant_sizer__cpu_template ( const input_num,
int32_t  c,
Column< T > &  output 
)

Definition at line 833 of file TableFunctionsTesting.hpp.

References i.

835  {
836  for (int32_t i = 0; i < c; i++) {
837  output[i] = input_num;
838  }
839  return c;
840 }
template<typename T >
TEMPLATE_NOINLINE int32_t ct_throw_if_gt_100__cpu_template ( TableFunctionManager mgr,
const Column< T > &  input,
Column< T > &  output 
)

Definition at line 1137 of file TableFunctionsTesting.hpp.

References TableFunctionManager::set_output_row_size(), and Column< T >::size().

1139  {
1140  int64_t num_rows = input.size();
1141  mgr.set_output_row_size(num_rows);
1142  for (int64_t r = 0; r < num_rows; ++r) {
1143  if (input[r] > 100) {
1144  return mgr.ERROR_MESSAGE("Values greater than 100 not allowed");
1145  }
1146  output[r] = input[r];
1147  }
1148  return num_rows;
1149 }
void set_output_row_size(int64_t num_rows)
Definition: OmniSciTypes.h:304
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t ct_udtf_default_sizer1a__cpu_1 ( const Column< int32_t > &  input1,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 315 of file TableFunctionsTesting.hpp.

317  {
318  out[0] = 1000 + 1 + 10 * multiplier;
319  return 1;
320 }
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer1b__cpu_2 ( const Column< int32_t > &  input1,
const Column< int32_t > &  input2,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 321 of file TableFunctionsTesting.hpp.

324  {
325  out[0] = 1000 + 2 + 11 * multiplier;
326  return 1;
327 }
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer1c__cpu_3 ( const Column< int32_t > &  input1,
const Column< int32_t > &  input2,
const Column< int32_t > &  input3,
const int32_t  multiplier,
const Column< int32_t > &  input4,
const int32_t  x,
Column< int32_t > &  out 
)

Definition at line 328 of file TableFunctionsTesting.hpp.

334  {
335  out[0] = 1000 + 101 + 10 * multiplier + x;
336  return 1;
337 }
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer1d__cpu_4 ( const int32_t  multiplier,
const int32_t  x,
const Column< int32_t > &  input1,
Column< int32_t > &  out 
)

Definition at line 338 of file TableFunctionsTesting.hpp.

341  {
342  out[0] = 1000 + 99 + 10 * multiplier + x;
343  return 1;
344 }
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer2a__cpu_1 ( const Column< int32_t > &  input1,
const int32_t  x,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 345 of file TableFunctionsTesting.hpp.

348  {
349  out[0] = 1000 + 98 + multiplier + 10 * x;
350  return 1;
351 }
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer2b__cpu_2 ( const Column< int32_t > &  input1,
const int32_t  multiplier,
const Column< int32_t > &  input2,
Column< int32_t > &  out 
)

Definition at line 352 of file TableFunctionsTesting.hpp.

355  {
356  out[0] = 1000 + 2 + multiplier;
357  return 1;
358 }
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer2c__cpu_3 ( const int32_t  x,
const int32_t  multiplier,
const Column< int32_t > &  input1,
Column< int32_t > &  out 
)

Definition at line 359 of file TableFunctionsTesting.hpp.

362  {
363  out[0] = 1000 + 99 + multiplier + 11 * x;
364  return 1;
365 }
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer3a__cpu_1 ( const Column< int32_t > &  input1,
const int32_t  multiplier,
const int32_t  x,
Column< int32_t > &  out 
)

Definition at line 366 of file TableFunctionsTesting.hpp.

369  {
370  out[0] = 1000 + 98 + 100 * multiplier + x;
371  return 1;
372 }
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer3b__cpu_2 ( const Column< int32_t > &  input1,
const int32_t  x,
const Column< int32_t > &  input2,
const int32_t  multiplier,
Column< int32_t > &  out 
)

Definition at line 373 of file TableFunctionsTesting.hpp.

377  {
378  out[0] = 1000 + 99 + 100 * multiplier + x;
379  return 1;
380 }
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer4a__cpu_1 ( const Column< int32_t > &  input1,
const int32_t  multiplier,
const Column< int32_t > &  input2,
const int32_t  x,
Column< int32_t > &  out 
)

Definition at line 381 of file TableFunctionsTesting.hpp.

385  {
386  out[0] = 1000 + 99 + 10 * multiplier + x;
387  return 1;
388 }
EXTENSION_NOINLINE int32_t ct_udtf_default_sizer4b__cpu_2 ( const int32_t  multiplier,
const Column< int32_t > &  input,
const int32_t  x,
Column< int32_t > &  out 
)

Definition at line 389 of file TableFunctionsTesting.hpp.

392  {
393  out[0] = 1000 + 99 + 9 * multiplier + x;
394  return 1;
395 }
template<typename T >
T safe_addition ( x,
y 
)

Definition at line 886 of file TableFunctionsTesting.hpp.

Referenced by column_list_safe_row_sum__cpu_template().

886  {
887  if (x >= 0) {
888  if (y > (std::numeric_limits<T>::max() - x)) {
889  throw std::overflow_error("Addition overflow detected");
890  }
891  } else {
892  if (y < (std::numeric_limits<T>::min() - x)) {
893  throw std::underflow_error("Addition underflow detected");
894  }
895  }
896  return x + y;
897 }

+ Here is the caller graph for this function:

template<typename T >
TEMPLATE_NOINLINE int32_t sort_column_limit__cpu_template ( const Column< T > &  input,
const int32_t  limit,
const bool  sort_ascending,
const bool  nulls_last,
Column< T > &  output 
)

Definition at line 612 of file TableFunctionsTesting.hpp.

References Column< T >::ptr_, set_output_row_size(), Column< T >::size(), and gpu_enabled::sort().

616  {
617  const int64_t num_rows = input.size();
618  set_output_row_size(num_rows);
619  output = input;
620  if (sort_ascending) {
621  std::sort(output.ptr_, output.ptr_ + num_rows, SortAsc<T>(nulls_last));
622  } else {
623  std::sort(output.ptr_, output.ptr_ + num_rows, SortDesc<T>(nulls_last));
624  }
625  if (limit < 0 || limit > num_rows) {
626  return num_rows;
627  }
628  return limit;
629 }
DEVICE int64_t size() const
Definition: OmniSciTypes.h:218
DEVICE void sort(ARGS &&...args)
Definition: gpu_enabled.h:105
T * ptr_
Definition: OmniSciTypes.h:199
EXTENSION_NOINLINE void set_output_row_size(int64_t num_rows)

+ Here is the call graph for this function: