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

Enumerations

enum  {
  MANAGER, ERROR_BUFFER, COL_BUFFERS, COL_SIZES,
  INPUT_STR_DICT_PROXIES, OUTPUT_BUFFERS, OUTPUT_STR_DICT_PROXIES, OUTPUT_ROW_COUNT,
  KERNEL_PARAM_COUNT
}
 

Functions

void append_literal_buffer (const Datum &d, const SQLTypeInfo &ti, int8_t *literal_buffer, int64_t offset)
 
size_t get_output_row_count (const TableFunctionExecutionUnit &exe_unit, size_t input_element_count)
 

Enumeration Type Documentation

anonymous enum
Enumerator
MANAGER 
ERROR_BUFFER 
COL_BUFFERS 
COL_SIZES 
INPUT_STR_DICT_PROXIES 
OUTPUT_BUFFERS 
OUTPUT_STR_DICT_PROXIES 
OUTPUT_ROW_COUNT 
KERNEL_PARAM_COUNT 

Definition at line 649 of file TableFunctionExecutionContext.cpp.

Function Documentation

void anonymous_namespace{TableFunctionExecutionContext.cpp}::append_literal_buffer ( const Datum d,
const SQLTypeInfo ti,
int8_t *  literal_buffer,
int64_t  offset 
)

Definition at line 31 of file TableFunctionExecutionContext.cpp.

References Datum::bigintval, Datum::boolval, DatumToString(), Datum::doubleval, Datum::floatval, get_bit_width(), Datum::intval, SQLTypeInfo::is_boolean(), SQLTypeInfo::is_fp(), SQLTypeInfo::is_integer(), SQLTypeInfo::is_text_encoding_none(), SQLTypeInfo::is_timeinterval(), SQLTypeInfo::is_timestamp(), Datum::smallintval, Datum::stringval, Datum::tinyintval, and UNREACHABLE.

Referenced by TableFunctionExecutionContext::execute().

34  {
35  if (ti.is_fp()) {
36  switch (get_bit_width(ti)) {
37  case 32:
38  std::memcpy(literal_buffer + offset, &d.floatval, sizeof(float));
39  break;
40  case 64:
41  std::memcpy(literal_buffer + offset, &d.doubleval, sizeof(double));
42  break;
43  default:
44  UNREACHABLE();
45  }
46  } else if (ti.is_integer() || ti.is_timestamp() || ti.is_timeinterval()) {
47  switch (get_bit_width(ti)) {
48  case 8:
49  std::memcpy(literal_buffer + offset, &d.tinyintval, sizeof(int8_t));
50  break;
51  case 16:
52  std::memcpy(literal_buffer + offset, &d.smallintval, sizeof(int16_t));
53  break;
54  case 32:
55  std::memcpy(literal_buffer + offset, &d.intval, sizeof(int32_t));
56  break;
57  case 64:
58  std::memcpy(literal_buffer + offset, &d.bigintval, sizeof(int64_t));
59  break;
60  default:
61  UNREACHABLE();
62  }
63  } else if (ti.is_boolean()) {
64  std::memcpy(literal_buffer + offset, &d.boolval, sizeof(int8_t));
65  } else if (ti.is_text_encoding_none()) {
66  auto string_size = d.stringval->size();
67  std::memcpy(literal_buffer + offset, &string_size, sizeof(int64_t));
68  std::memcpy(
69  literal_buffer + offset + sizeof(int64_t), d.stringval->data(), string_size);
70  } else {
71  throw TableFunctionError("Literal value " + DatumToString(d, ti) +
72  " is not yet supported.");
73  }
74 }
int8_t tinyintval
Definition: Datum.h:73
std::string DatumToString(Datum d, const SQLTypeInfo &ti)
Definition: Datum.cpp:460
bool is_timestamp() const
Definition: sqltypes.h:1046
bool is_fp() const
Definition: sqltypes.h:573
int8_t boolval
Definition: Datum.h:72
#define UNREACHABLE()
Definition: Logger.h:338
int32_t intval
Definition: Datum.h:75
float floatval
Definition: Datum.h:77
size_t get_bit_width(const SQLTypeInfo &ti)
bool is_integer() const
Definition: sqltypes.h:567
int64_t bigintval
Definition: Datum.h:76
bool is_timeinterval() const
Definition: sqltypes.h:594
int16_t smallintval
Definition: Datum.h:74
bool is_boolean() const
Definition: sqltypes.h:582
std::string * stringval
Definition: Datum.h:81
bool is_text_encoding_none() const
Definition: sqltypes.h:614
double doubleval
Definition: Datum.h:78

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t anonymous_namespace{TableFunctionExecutionContext.cpp}::get_output_row_count ( const TableFunctionExecutionUnit exe_unit,
size_t  input_element_count 
)

Definition at line 76 of file TableFunctionExecutionContext.cpp.

References table_functions::TableFunction::getOutputRowSizeType(), table_functions::kConstant, table_functions::kPreFlightParameter, table_functions::kTableFunctionSpecifiedParameter, table_functions::kUserSpecifiedConstantParameter, table_functions::kUserSpecifiedRowMultiplier, TableFunctionExecutionUnit::output_buffer_size_param, TableFunctionExecutionUnit::table_func, and UNREACHABLE.

Referenced by TableFunctionExecutionContext::launchCpuCode(), and TableFunctionExecutionContext::launchGpuCode().

77  {
78  size_t allocated_output_row_count = 0;
79  switch (exe_unit.table_func.getOutputRowSizeType()) {
83  allocated_output_row_count = exe_unit.output_buffer_size_param;
84  break;
85  }
87  allocated_output_row_count =
88  exe_unit.output_buffer_size_param * input_element_count;
89  break;
90  }
92  allocated_output_row_count = input_element_count;
93  break;
94  }
95  default: {
96  UNREACHABLE();
97  }
98  }
99  return allocated_output_row_count;
100 }
const table_functions::TableFunction table_func
#define UNREACHABLE()
Definition: Logger.h:338
OutputBufferSizeType getOutputRowSizeType() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function: