OmniSciDB  a987f07e93
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ThriftSerializers Namespace Reference

Functions

TResultSetLayout::type layout_to_thrift (const QueryDescriptionType layout)
 
QueryDescriptionType layout_from_thrift (const TResultSetLayout::type layout)
 
TAggKind::type agg_kind_to_thrift (const SQLAgg agg)
 
SQLAgg agg_kind_from_thrift (const TAggKind::type agg)
 
AggregatedColRange column_ranges_from_thrift (const std::vector< TColumnRange > &thrift_column_ranges)
 
StringDictionaryGenerations string_dictionary_generations_from_thrift (const std::vector< TDictionaryGeneration > &thrift_string_dictionary_generations)
 
TTypeInfo type_info_to_thrift (const SQLTypeInfo &ti)
 
bool takes_arg (const TargetInfo &target_info)
 
std::vector< TargetMetaInfotarget_meta_infos_from_thrift (const TRowDescriptor &row_desc)
 
void fixup_geo_column_descriptor (TColumnType &col_type, const SQLTypes subtype, const int output_srid)
 
TColumnType target_meta_info_to_thrift (const TargetMetaInfo &target, const size_t idx)
 
TRowDescriptor target_meta_infos_to_thrift (const std::vector< TargetMetaInfo > &targets)
 
TTargetInfo target_info_to_thrift (const TargetInfo &target_info)
 
TargetInfo target_info_from_thrift (const TTargetInfo &thrift_target_info)
 
std::vector< TTargetInfo > target_infos_to_thrift (const std::vector< TargetInfo > &targets)
 
std::vector< TargetInfotarget_infos_from_thrift (const std::vector< TTargetInfo > &thrift_targets)
 
TCountDistinctImplType::type count_distinct_impl_type_to_thrift (const CountDistinctImplType impl_type)
 
TCountDistinctDescriptor count_distinct_descriptor_to_thrift (const CountDistinctDescriptor &count_distinct_descriptor)
 
CountDistinctImplType count_distinct_impl_type_from_thrift (const TCountDistinctImplType::type impl_type)
 
CountDistinctDescriptor count_distinct_descriptor_from_thrift (const TCountDistinctDescriptor &thrift_count_distinct_descriptor)
 
ExtArgumentType from_thrift (const TExtArgumentType::type &t)
 
TExtArgumentType::type to_thrift (const ExtArgumentType &t)
 
std::vector< ExtArgumentTypefrom_thrift (const std::vector< TExtArgumentType::type > &v)
 
std::vector
< TExtArgumentType::type > 
to_thrift (const std::vector< ExtArgumentType > &v)
 
table_functions::OutputBufferSizeType from_thrift (const TOutputBufferSizeType::type &t)
 
TOutputBufferSizeType::type to_thrift (const table_functions::OutputBufferSizeType &t)
 
TUserDefinedFunction to_thrift (const ExtensionFunction &udf)
 
TUserDefinedTableFunction to_thrift (const table_functions::TableFunction &func)
 
std::vector
< TUserDefinedTableFunction > 
to_thrift (const std::vector< table_functions::TableFunction > &v)
 

Function Documentation

SQLAgg ThriftSerializers::agg_kind_from_thrift ( const TAggKind::type  agg)
inline

Definition at line 105 of file ThriftSerializers.h.

References AVG, CHECK, COUNT, COUNT_IF, MAX, MIN, SUM_IF, and UNTHRIFT_AGGKIND_CASE.

Referenced by target_info_from_thrift().

105  {
106  switch (agg) {
108  UNTHRIFT_AGGKIND_CASE(COUNT)
112  UNTHRIFT_AGGKIND_CASE(APPROX_COUNT_DISTINCT)
113  UNTHRIFT_AGGKIND_CASE(SAMPLE)
114  UNTHRIFT_AGGKIND_CASE(SINGLE_VALUE)
115  UNTHRIFT_AGGKIND_CASE(COUNT_IF)
116  UNTHRIFT_AGGKIND_CASE(SUM_IF)
117  default:
118  CHECK(false) << static_cast<int>(agg);
119  }
120  abort();
121 }
#define UNTHRIFT_AGGKIND_CASE(kind)
bool g_enable_watchdog false
Definition: Execute.cpp:79
#define CHECK(condition)
Definition: Logger.h:289

+ Here is the caller graph for this function:

TAggKind::type ThriftSerializers::agg_kind_to_thrift ( const SQLAgg  agg)
inline

Definition at line 81 of file ThriftSerializers.h.

References AVG, CHECK, COUNT, COUNT_IF, MAX, MIN, SUM_IF, and THRIFT_AGGKIND_CASE.

Referenced by target_info_to_thrift().

81  {
82  switch (agg) {
84  THRIFT_AGGKIND_CASE(COUNT)
88  THRIFT_AGGKIND_CASE(APPROX_COUNT_DISTINCT)
89  THRIFT_AGGKIND_CASE(SAMPLE)
90  THRIFT_AGGKIND_CASE(SINGLE_VALUE)
91  THRIFT_AGGKIND_CASE(COUNT_IF)
92  THRIFT_AGGKIND_CASE(SUM_IF)
93  default:
94  CHECK(false) << static_cast<int>(agg);
95  }
96  abort();
97 }
bool g_enable_watchdog false
Definition: Execute.cpp:79
#define CHECK(condition)
Definition: Logger.h:289
#define THRIFT_AGGKIND_CASE(kind)

+ Here is the caller graph for this function:

AggregatedColRange ThriftSerializers::column_ranges_from_thrift ( const std::vector< TColumnRange > &  thrift_column_ranges)
inline

Definition at line 125 of file ThriftSerializers.h.

References CHECK, PhysicalInput::col_id, INVALID, ExpressionRange::makeDoubleRange(), ExpressionRange::makeFloatRange(), ExpressionRange::makeIntRange(), ExpressionRange::makeInvalidRange(), and AggregatedColRange::setColRange().

126  {
127  AggregatedColRange column_ranges;
128  for (const auto& thrift_column_range : thrift_column_ranges) {
129  PhysicalInput phys_input{thrift_column_range.col_id, thrift_column_range.table_id};
130  switch (thrift_column_range.type) {
131  case TExpressionRangeType::INTEGER:
132  column_ranges.setColRange(
133  phys_input,
134  ExpressionRange::makeIntRange(thrift_column_range.int_min,
135  thrift_column_range.int_max,
136  thrift_column_range.bucket,
137  thrift_column_range.has_nulls));
138  break;
139  case TExpressionRangeType::FLOAT:
140  column_ranges.setColRange(
141  phys_input,
142  ExpressionRange::makeFloatRange(thrift_column_range.fp_min,
143  thrift_column_range.fp_max,
144  thrift_column_range.has_nulls));
145  break;
146  case TExpressionRangeType::DOUBLE:
147  column_ranges.setColRange(
148  phys_input,
149  ExpressionRange::makeDoubleRange(thrift_column_range.fp_min,
150  thrift_column_range.fp_max,
151  thrift_column_range.has_nulls));
152  break;
154  column_ranges.setColRange(phys_input, ExpressionRange::makeInvalidRange());
155  break;
156  default:
157  CHECK(false);
158  }
159  }
160  return column_ranges;
161 }
static ExpressionRange makeFloatRange(const float fp_min, const float fp_max, const bool has_nulls)
static ExpressionRange makeIntRange(const int64_t int_min, const int64_t int_max, const int64_t bucket, const bool has_nulls)
static ExpressionRange makeDoubleRange(const double fp_min, const double fp_max, const bool has_nulls)
#define CHECK(condition)
Definition: Logger.h:289
void setColRange(const PhysicalInput &, const ExpressionRange &)
static ExpressionRange makeInvalidRange()

+ Here is the call graph for this function:

CountDistinctDescriptor ThriftSerializers::count_distinct_descriptor_from_thrift ( const TCountDistinctDescriptor &  thrift_count_distinct_descriptor)
inline

Definition at line 351 of file ThriftSerializers.h.

References CountDistinctDescriptor::approximate, CountDistinctDescriptor::bitmap_sz_bits, count_distinct_impl_type_from_thrift(), CPU, CountDistinctDescriptor::device_type, GPU, CountDistinctDescriptor::impl_type_, CountDistinctDescriptor::min_val, and CountDistinctDescriptor::sub_bitmap_count.

352  {
353  CountDistinctDescriptor count_distinct_descriptor;
354  count_distinct_descriptor.impl_type_ =
355  count_distinct_impl_type_from_thrift(thrift_count_distinct_descriptor.impl_type);
356  count_distinct_descriptor.min_val = thrift_count_distinct_descriptor.min_val;
357  count_distinct_descriptor.bitmap_sz_bits =
358  thrift_count_distinct_descriptor.bitmap_sz_bits;
359  count_distinct_descriptor.approximate = thrift_count_distinct_descriptor.approximate;
360  count_distinct_descriptor.device_type =
361  thrift_count_distinct_descriptor.device_type == TDeviceType::GPU
364  count_distinct_descriptor.sub_bitmap_count =
365  thrift_count_distinct_descriptor.sub_bitmap_count;
366  return count_distinct_descriptor;
367 }
CountDistinctImplType impl_type_
CountDistinctImplType count_distinct_impl_type_from_thrift(const TCountDistinctImplType::type impl_type)

+ Here is the call graph for this function:

TCountDistinctDescriptor ThriftSerializers::count_distinct_descriptor_to_thrift ( const CountDistinctDescriptor count_distinct_descriptor)
inline

Definition at line 316 of file ThriftSerializers.h.

References CountDistinctDescriptor::approximate, CountDistinctDescriptor::bitmap_sz_bits, count_distinct_impl_type_to_thrift(), CountDistinctDescriptor::device_type, GPU, CountDistinctDescriptor::impl_type_, CountDistinctDescriptor::min_val, and CountDistinctDescriptor::sub_bitmap_count.

317  {
318  TCountDistinctDescriptor thrift_count_distinct_descriptor;
319  thrift_count_distinct_descriptor.impl_type =
320  count_distinct_impl_type_to_thrift(count_distinct_descriptor.impl_type_);
321  thrift_count_distinct_descriptor.min_val = count_distinct_descriptor.min_val;
322  thrift_count_distinct_descriptor.bitmap_sz_bits =
323  count_distinct_descriptor.bitmap_sz_bits;
324  thrift_count_distinct_descriptor.approximate = count_distinct_descriptor.approximate;
325  thrift_count_distinct_descriptor.device_type =
326  count_distinct_descriptor.device_type == ExecutorDeviceType::GPU ? TDeviceType::GPU
327  : TDeviceType::CPU;
328  thrift_count_distinct_descriptor.sub_bitmap_count =
329  count_distinct_descriptor.sub_bitmap_count;
330  return thrift_count_distinct_descriptor;
331 }
TCountDistinctImplType::type count_distinct_impl_type_to_thrift(const CountDistinctImplType impl_type)
CountDistinctImplType impl_type_

+ Here is the call graph for this function:

CountDistinctImplType ThriftSerializers::count_distinct_impl_type_from_thrift ( const TCountDistinctImplType::type  impl_type)
inline

Definition at line 337 of file ThriftSerializers.h.

References Bitmap, CHECK, Invalid, UnorderedSet, and UNTHRIFT_COUNTDESCRIPTORIMPL_CASE.

Referenced by count_distinct_descriptor_from_thrift().

338  {
339  switch (impl_type) {
343  default:
344  CHECK(false);
345  }
346  abort();
347 }
#define UNTHRIFT_COUNTDESCRIPTORIMPL_CASE(kind)
bool g_enable_watchdog false
Definition: Execute.cpp:79
#define CHECK(condition)
Definition: Logger.h:289

+ Here is the caller graph for this function:

TCountDistinctImplType::type ThriftSerializers::count_distinct_impl_type_to_thrift ( const CountDistinctImplType  impl_type)
inline

Definition at line 302 of file ThriftSerializers.h.

References Bitmap, CHECK, Invalid, THRIFT_COUNTDESCRIPTORIMPL_CASE, and UnorderedSet.

Referenced by count_distinct_descriptor_to_thrift().

303  {
304  switch (impl_type) {
307  THRIFT_COUNTDESCRIPTORIMPL_CASE(UnorderedSet)
308  default:
309  CHECK(false);
310  }
311  abort();
312 }
#define THRIFT_COUNTDESCRIPTORIMPL_CASE(kind)
bool g_enable_watchdog false
Definition: Execute.cpp:79
#define CHECK(condition)
Definition: Logger.h:289

+ Here is the caller graph for this function:

void ThriftSerializers::fixup_geo_column_descriptor ( TColumnType &  col_type,
const SQLTypes  subtype,
const int  output_srid 
)
inline

Definition at line 207 of file ThriftSerializers.h.

Referenced by DBHandler::populateThriftColumnType(), and target_meta_info_to_thrift().

209  {
210  col_type.col_type.precision = static_cast<int>(subtype);
211  col_type.col_type.scale = output_srid;
212 }

+ Here is the caller graph for this function:

ExtArgumentType ThriftSerializers::from_thrift ( const TExtArgumentType::type &  t)
inline

Definition at line 369 of file ThriftSerializers.h.

References ArrayBool, ArrayDouble, ArrayFloat, ArrayInt16, ArrayInt32, ArrayInt64, ArrayInt8, ArrayTextEncodingDict, ArrayTextEncodingNone, Bool, ColumnArrayBool, ColumnArrayDouble, ColumnArrayFloat, ColumnArrayInt16, ColumnArrayInt32, ColumnArrayInt64, ColumnArrayInt8, ColumnArrayTextEncodingDict, ColumnArrayTextEncodingNone, ColumnBool, ColumnDouble, ColumnFloat, ColumnInt16, ColumnInt32, ColumnInt64, ColumnInt8, ColumnListArrayBool, ColumnListArrayDouble, ColumnListArrayFloat, ColumnListArrayInt16, ColumnListArrayInt32, ColumnListArrayInt64, ColumnListArrayInt8, ColumnListArrayTextEncodingDict, ColumnListArrayTextEncodingNone, ColumnListBool, ColumnListDouble, ColumnListFloat, ColumnListInt16, ColumnListInt32, ColumnListInt64, ColumnListInt8, ColumnListTextEncodingDict, ColumnListTextEncodingNone, ColumnTextEncodingDict, ColumnTextEncodingNone, ColumnTimestamp, Cursor, DayTimeInterval, Double, Float, GeoLineString, GeoMultiLineString, GeoMultiPoint, GeoMultiPolygon, GeoPoint, GeoPolygon, Int16, Int32, Int64, Int8, PBool, PDouble, PFloat, PInt16, PInt32, PInt64, PInt8, TextEncodingDict, TextEncodingNone, Timestamp, UNREACHABLE, Void, and YearMonthTimeInterval.

Referenced by from_thrift(), and DBHandler::register_runtime_extension_functions().

369  {
370  switch (t) {
371  case TExtArgumentType::Int8:
372  return ExtArgumentType::Int8;
373  case TExtArgumentType::Int16:
374  return ExtArgumentType::Int16;
375  case TExtArgumentType::Int32:
376  return ExtArgumentType::Int32;
377  case TExtArgumentType::Int64:
378  return ExtArgumentType::Int64;
379  case TExtArgumentType::Float:
380  return ExtArgumentType::Float;
383  case TExtArgumentType::Void:
384  return ExtArgumentType::Void;
385  case TExtArgumentType::PInt8:
386  return ExtArgumentType::PInt8;
387  case TExtArgumentType::PInt16:
389  case TExtArgumentType::PInt32:
391  case TExtArgumentType::PInt64:
393  case TExtArgumentType::PFloat:
395  case TExtArgumentType::PDouble:
397  case TExtArgumentType::PBool:
398  return ExtArgumentType::PBool;
399  case TExtArgumentType::Bool:
400  return ExtArgumentType::Bool;
401  case TExtArgumentType::ArrayInt8:
403  case TExtArgumentType::ArrayInt16:
405  case TExtArgumentType::ArrayInt32:
407  case TExtArgumentType::ArrayInt64:
409  case TExtArgumentType::ArrayFloat:
411  case TExtArgumentType::ArrayDouble:
413  case TExtArgumentType::ArrayBool:
415  case TExtArgumentType::ArrayTextEncodingNone:
417  case TExtArgumentType::ArrayTextEncodingDict:
419  case TExtArgumentType::GeoPoint:
421  case TExtArgumentType::GeoMultiPoint:
423  case TExtArgumentType::GeoLineString:
425  case TExtArgumentType::GeoMultiLineString:
427  case TExtArgumentType::Cursor:
429  case TExtArgumentType::GeoPolygon:
431  case TExtArgumentType::GeoMultiPolygon:
433  case TExtArgumentType::ColumnInt8:
435  case TExtArgumentType::ColumnInt16:
437  case TExtArgumentType::ColumnInt32:
439  case TExtArgumentType::ColumnInt64:
441  case TExtArgumentType::ColumnFloat:
443  case TExtArgumentType::ColumnDouble:
445  case TExtArgumentType::ColumnBool:
447  case TExtArgumentType::ColumnTextEncodingNone:
449  case TExtArgumentType::ColumnTextEncodingDict:
451  case TExtArgumentType::ColumnTimestamp:
453  case TExtArgumentType::TextEncodingNone:
455  case TExtArgumentType::TextEncodingDict:
457  case TExtArgumentType::Timestamp:
459  case TExtArgumentType::ColumnListInt8:
461  case TExtArgumentType::ColumnListInt16:
463  case TExtArgumentType::ColumnListInt32:
465  case TExtArgumentType::ColumnListInt64:
467  case TExtArgumentType::ColumnListFloat:
469  case TExtArgumentType::ColumnListDouble:
471  case TExtArgumentType::ColumnListBool:
473  case TExtArgumentType::ColumnListTextEncodingNone:
475  case TExtArgumentType::ColumnListTextEncodingDict:
477  case TExtArgumentType::ColumnArrayInt8:
479  case TExtArgumentType::ColumnArrayInt16:
481  case TExtArgumentType::ColumnArrayInt32:
483  case TExtArgumentType::ColumnArrayInt64:
485  case TExtArgumentType::ColumnArrayFloat:
487  case TExtArgumentType::ColumnArrayDouble:
489  case TExtArgumentType::ColumnArrayBool:
491  case TExtArgumentType::ColumnArrayTextEncodingNone:
493  case TExtArgumentType::ColumnArrayTextEncodingDict:
495  case TExtArgumentType::ColumnListArrayInt8:
497  case TExtArgumentType::ColumnListArrayInt16:
499  case TExtArgumentType::ColumnListArrayInt32:
501  case TExtArgumentType::ColumnListArrayInt64:
503  case TExtArgumentType::ColumnListArrayFloat:
505  case TExtArgumentType::ColumnListArrayDouble:
507  case TExtArgumentType::ColumnListArrayBool:
509  case TExtArgumentType::ColumnListArrayTextEncodingNone:
511  case TExtArgumentType::ColumnListArrayTextEncodingDict:
513  case TExtArgumentType::DayTimeInterval:
515  case TExtArgumentType::YearMonthTimeInterval:
517  }
518  UNREACHABLE();
519  return ExtArgumentType{};
520 }
#define UNREACHABLE()
Definition: Logger.h:333

+ Here is the caller graph for this function:

std::vector<ExtArgumentType> ThriftSerializers::from_thrift ( const std::vector< TExtArgumentType::type > &  v)
inline

Definition at line 675 of file ThriftSerializers.h.

References from_thrift(), run_benchmark_import::result, shared::transform(), and run_benchmark_import::type.

676  {
677  std::vector<ExtArgumentType> result;
679  v.begin(),
680  v.end(),
681  std::back_inserter(result),
682  [](TExtArgumentType::type c) -> ExtArgumentType { return from_thrift(c); });
683  return result;
684 }
ExtArgumentType from_thrift(const TExtArgumentType::type &t)
OUTPUT transform(INPUT const &input, FUNC const &func)
Definition: misc.h:320

+ Here is the call graph for this function:

table_functions::OutputBufferSizeType ThriftSerializers::from_thrift ( const TOutputBufferSizeType::type &  t)
inline

Definition at line 697 of file ThriftSerializers.h.

References table_functions::kConstant, table_functions::kPreFlightParameter, table_functions::kTableFunctionSpecifiedParameter, table_functions::kUserSpecifiedConstantParameter, table_functions::kUserSpecifiedRowMultiplier, and UNREACHABLE.

698  {
699  switch (t) {
700  case TOutputBufferSizeType::kConstant:
702  case TOutputBufferSizeType::kUserSpecifiedConstantParameter:
704  case TOutputBufferSizeType::kUserSpecifiedRowMultiplier:
706  case TOutputBufferSizeType::kTableFunctionSpecifiedParameter:
708  case TOutputBufferSizeType::kPreFlightParameter:
710  }
711  UNREACHABLE();
713 }
#define UNREACHABLE()
Definition: Logger.h:333
QueryDescriptionType ThriftSerializers::layout_from_thrift ( const TResultSetLayout::type  layout)
inline

Definition at line 63 of file ThriftSerializers.h.

References CHECK, GroupByBaselineHash, GroupByPerfectHash, NonGroupedAggregate, Projection, and UNTHRIFT_LAYOUT_CASE.

63  {
64  switch (layout) {
65  UNTHRIFT_LAYOUT_CASE(GroupByPerfectHash)
66  UNTHRIFT_LAYOUT_CASE(GroupByBaselineHash)
67  UNTHRIFT_LAYOUT_CASE(Projection)
68  UNTHRIFT_LAYOUT_CASE(NonGroupedAggregate)
69  default:
70  CHECK(false) << static_cast<int>(layout);
71  }
72  abort();
73 }
bool g_enable_watchdog false
Definition: Execute.cpp:79
#define CHECK(condition)
Definition: Logger.h:289
#define UNTHRIFT_LAYOUT_CASE(layout)
TResultSetLayout::type ThriftSerializers::layout_to_thrift ( const QueryDescriptionType  layout)
inline

Definition at line 45 of file ThriftSerializers.h.

References CHECK, GroupByBaselineHash, GroupByPerfectHash, NonGroupedAggregate, Projection, and THRIFT_LAYOUT_CASE.

45  {
46  switch (layout) {
47  THRIFT_LAYOUT_CASE(GroupByPerfectHash)
48  THRIFT_LAYOUT_CASE(GroupByBaselineHash)
49  THRIFT_LAYOUT_CASE(Projection)
50  THRIFT_LAYOUT_CASE(NonGroupedAggregate)
51  default:
52  CHECK(false) << static_cast<int>(layout);
53  }
54  abort();
55 }
bool g_enable_watchdog false
Definition: Execute.cpp:79
#define CHECK(condition)
Definition: Logger.h:289
#define THRIFT_LAYOUT_CASE(layout)
StringDictionaryGenerations ThriftSerializers::string_dictionary_generations_from_thrift ( const std::vector< TDictionaryGeneration > &  thrift_string_dictionary_generations)
inline

Definition at line 163 of file ThriftSerializers.h.

References StringDictionaryGenerations::setGeneration().

164  {
165  StringDictionaryGenerations string_dictionary_generations;
166  for (const auto& thrift_string_dictionary_generation :
167  thrift_string_dictionary_generations) {
168  string_dictionary_generations.setGeneration(
169  thrift_string_dictionary_generation.dict_id,
170  thrift_string_dictionary_generation.entry_count);
171  }
172  return string_dictionary_generations;
173 }
void setGeneration(const uint32_t id, const uint64_t generation)

+ Here is the call graph for this function:

bool ThriftSerializers::takes_arg ( const TargetInfo target_info)
inline

Definition at line 193 of file ThriftSerializers.h.

References TargetInfo::agg_kind, TargetInfo::is_agg, is_distinct_target(), and kCOUNT.

Referenced by target_info_from_thrift(), target_info_to_thrift(), and RelAlgTranslator::translateAggregateRex().

193  {
194  return target_info.is_agg &&
195  (target_info.agg_kind != kCOUNT || is_distinct_target(target_info));
196 }
bool is_agg
Definition: TargetInfo.h:50
bool is_distinct_target(const TargetInfo &target_info)
Definition: TargetInfo.h:98
SQLAgg agg_kind
Definition: TargetInfo.h:51
Definition: sqldefs.h:78

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TargetInfo ThriftSerializers::target_info_from_thrift ( const TTargetInfo &  thrift_target_info)
inline

Definition at line 267 of file ThriftSerializers.h.

References TargetInfo::agg_arg_type, TargetInfo::agg_kind, agg_kind_from_thrift(), TargetInfo::is_agg, TargetInfo::is_distinct, kNULLT, TargetInfo::skip_null_val, TargetInfo::sql_type, takes_arg(), and type_info_from_thrift().

Referenced by target_infos_from_thrift().

267  {
268  TargetInfo target_info;
269  target_info.is_agg = thrift_target_info.is_agg;
270  target_info.agg_kind = agg_kind_from_thrift(thrift_target_info.kind);
271  target_info.sql_type = type_info_from_thrift(thrift_target_info.type);
272  target_info.is_distinct = thrift_target_info.is_distinct;
273  target_info.agg_arg_type = takes_arg(target_info)
274  ? type_info_from_thrift(thrift_target_info.arg_type)
276  target_info.skip_null_val = thrift_target_info.skip_nulls;
277  return target_info;
278 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:52
bool skip_null_val
Definition: TargetInfo.h:54
SQLTypeInfo agg_arg_type
Definition: TargetInfo.h:53
bool is_agg
Definition: TargetInfo.h:50
SQLTypeInfo type_info_from_thrift(const TTypeInfo &thrift_ti, const bool strip_geo_encoding=false)
SQLAgg agg_kind_from_thrift(const TAggKind::type agg)
SQLAgg agg_kind
Definition: TargetInfo.h:51
bool takes_arg(const TargetInfo &target_info)
bool g_enable_watchdog false
Definition: Execute.cpp:79
bool is_distinct
Definition: TargetInfo.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TTargetInfo ThriftSerializers::target_info_to_thrift ( const TargetInfo target_info)
inline

Definition at line 254 of file ThriftSerializers.h.

References TargetInfo::agg_arg_type, TargetInfo::agg_kind, agg_kind_to_thrift(), TargetInfo::is_agg, TargetInfo::is_distinct, TargetInfo::skip_null_val, TargetInfo::sql_type, takes_arg(), and type_info_to_thrift().

Referenced by target_infos_to_thrift().

254  {
255  TTargetInfo thrift_target_info;
256  thrift_target_info.is_agg = target_info.is_agg;
257  thrift_target_info.kind = agg_kind_to_thrift(target_info.agg_kind);
258  thrift_target_info.type = type_info_to_thrift(target_info.sql_type);
259  thrift_target_info.arg_type = takes_arg(target_info)
260  ? type_info_to_thrift(target_info.agg_arg_type)
261  : thrift_target_info.type;
262  thrift_target_info.skip_nulls = target_info.skip_null_val;
263  thrift_target_info.is_distinct = target_info.is_distinct;
264  return thrift_target_info;
265 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:52
bool skip_null_val
Definition: TargetInfo.h:54
SQLTypeInfo agg_arg_type
Definition: TargetInfo.h:53
bool is_agg
Definition: TargetInfo.h:50
SQLAgg agg_kind
Definition: TargetInfo.h:51
bool takes_arg(const TargetInfo &target_info)
TAggKind::type agg_kind_to_thrift(const SQLAgg agg)
bool is_distinct
Definition: TargetInfo.h:55
TTypeInfo type_info_to_thrift(const SQLTypeInfo &ti)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector<TargetInfo> ThriftSerializers::target_infos_from_thrift ( const std::vector< TTargetInfo > &  thrift_targets)
inline

Definition at line 289 of file ThriftSerializers.h.

References target_info_from_thrift().

290  {
291  std::vector<TargetInfo> targets;
292  for (const auto& thrift_target_info : thrift_targets) {
293  targets.push_back(target_info_from_thrift(thrift_target_info));
294  }
295  return targets;
296 }
TargetInfo target_info_from_thrift(const TTargetInfo &thrift_target_info)

+ Here is the call graph for this function:

std::vector<TTargetInfo> ThriftSerializers::target_infos_to_thrift ( const std::vector< TargetInfo > &  targets)
inline

Definition at line 280 of file ThriftSerializers.h.

References target_info_to_thrift().

281  {
282  std::vector<TTargetInfo> thrift_targets;
283  for (const auto& target_info : targets) {
284  thrift_targets.push_back(target_info_to_thrift(target_info));
285  }
286  return thrift_targets;
287 }
TTargetInfo target_info_to_thrift(const TargetInfo &target_info)

+ Here is the call graph for this function:

TColumnType ThriftSerializers::target_meta_info_to_thrift ( const TargetMetaInfo target,
const size_t  idx 
)
inline

Definition at line 214 of file ThriftSerializers.h.

References encoding_to_thrift(), fixup_geo_column_descriptor(), TargetMetaInfo::get_resname(), TargetMetaInfo::get_type_info(), IS_GEO, kARRAY, kDATE, to_string(), SQLTypeInfo::type, and type_to_thrift().

Referenced by target_meta_infos_to_thrift().

215  {
216  TColumnType proj_info;
217  proj_info.col_name = target.get_resname();
218  if (proj_info.col_name.empty()) {
219  proj_info.col_name = "result_" + std::to_string(idx + 1);
220  }
221  const auto& target_ti = target.get_type_info();
222  proj_info.col_type.type = type_to_thrift(target_ti);
223  proj_info.col_type.encoding = encoding_to_thrift(target_ti);
224  proj_info.col_type.nullable = !target_ti.get_notnull();
225  proj_info.col_type.is_array = target_ti.get_type() == kARRAY;
226  if (IS_GEO(target_ti.get_type())) {
228  proj_info, target_ti.get_subtype(), target_ti.get_output_srid());
229  } else {
230  proj_info.col_type.precision = target_ti.get_precision();
231  proj_info.col_type.scale = target_ti.get_scale();
232  }
233  if (target_ti.get_type() == kDATE) {
234  proj_info.col_type.size = target_ti.get_size();
235  }
236  proj_info.col_type.comp_param =
237  (target_ti.is_date_in_days() && target_ti.get_comp_param() == 0)
238  ? 32
239  : target_ti.get_comp_param();
240  return proj_info;
241 }
TDatumType::type type_to_thrift(const SQLTypeInfo &type_info)
const SQLTypeInfo & get_type_info() const
std::string to_string(char const *&&v)
void fixup_geo_column_descriptor(TColumnType &col_type, const SQLTypes subtype, const int output_srid)
Definition: sqltypes.h:68
SQLTypes type
Definition: sqltypes.h:1006
const std::string & get_resname() const
#define IS_GEO(T)
Definition: sqltypes.h:298
TEncodingType::type encoding_to_thrift(const SQLTypeInfo &type_info)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector<TargetMetaInfo> ThriftSerializers::target_meta_infos_from_thrift ( const TRowDescriptor &  row_desc)
inline

Definition at line 198 of file ThriftSerializers.h.

References type_info_from_thrift().

199  {
200  std::vector<TargetMetaInfo> target_meta_infos;
201  for (const auto& col : row_desc) {
202  target_meta_infos.emplace_back(col.col_name, type_info_from_thrift(col.col_type));
203  }
204  return target_meta_infos;
205 }
SQLTypeInfo type_info_from_thrift(const TTypeInfo &thrift_ti, const bool strip_geo_encoding=false)

+ Here is the call graph for this function:

TRowDescriptor ThriftSerializers::target_meta_infos_to_thrift ( const std::vector< TargetMetaInfo > &  targets)
inline

Definition at line 243 of file ThriftSerializers.h.

References target_meta_info_to_thrift().

Referenced by DBHandler::convertRows().

244  {
245  TRowDescriptor row_desc;
246  size_t i = 0;
247  for (const auto& target : targets) {
248  row_desc.push_back(target_meta_info_to_thrift(target, i));
249  ++i;
250  }
251  return row_desc;
252 }
TColumnType target_meta_info_to_thrift(const TargetMetaInfo &target, const size_t idx)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TExtArgumentType::type ThriftSerializers::to_thrift ( const ExtArgumentType t)
inline

Definition at line 522 of file ThriftSerializers.h.

References ArrayBool, ArrayDouble, ArrayFloat, ArrayInt16, ArrayInt32, ArrayInt64, ArrayInt8, ArrayTextEncodingDict, ArrayTextEncodingNone, Bool, ColumnArrayBool, ColumnArrayDouble, ColumnArrayFloat, ColumnArrayInt16, ColumnArrayInt32, ColumnArrayInt64, ColumnArrayInt8, ColumnArrayTextEncodingDict, ColumnArrayTextEncodingNone, ColumnBool, ColumnDouble, ColumnFloat, ColumnInt16, ColumnInt32, ColumnInt64, ColumnInt8, ColumnListArrayBool, ColumnListArrayDouble, ColumnListArrayFloat, ColumnListArrayInt16, ColumnListArrayInt32, ColumnListArrayInt64, ColumnListArrayInt8, ColumnListArrayTextEncodingDict, ColumnListArrayTextEncodingNone, ColumnListBool, ColumnListDouble, ColumnListFloat, ColumnListInt16, ColumnListInt32, ColumnListInt64, ColumnListInt8, ColumnListTextEncodingDict, ColumnListTextEncodingNone, ColumnTextEncodingDict, ColumnTextEncodingNone, ColumnTimestamp, Cursor, DayTimeInterval, Double, Float, GeoLineString, GeoMultiLineString, GeoMultiPoint, GeoMultiPolygon, GeoPoint, GeoPolygon, Int16, Int32, Int64, Int8, PBool, PDouble, PFloat, PInt16, PInt32, PInt64, PInt8, TextEncodingDict, TextEncodingNone, Timestamp, run_benchmark_import::type, UNREACHABLE, Void, and YearMonthTimeInterval.

Referenced by DBHandler::get_function_details(), DBHandler::get_table_function_details(), DBHandler::initialize(), QueryRunner::QueryRunner::QueryRunner(), DBHandler::register_runtime_extension_functions(), and to_thrift().

522  {
523  switch (t) {
525  return TExtArgumentType::Int8;
527  return TExtArgumentType::Int16;
529  return TExtArgumentType::Int32;
531  return TExtArgumentType::Int64;
533  return TExtArgumentType::Float;
537  return TExtArgumentType::Void;
539  return TExtArgumentType::PInt8;
541  return TExtArgumentType::PInt16;
543  return TExtArgumentType::PInt32;
545  return TExtArgumentType::PInt64;
547  return TExtArgumentType::PFloat;
549  return TExtArgumentType::PDouble;
551  return TExtArgumentType::PBool;
553  return TExtArgumentType::Bool;
555  return TExtArgumentType::ArrayInt8;
557  return TExtArgumentType::ArrayInt16;
559  return TExtArgumentType::ArrayInt32;
561  return TExtArgumentType::ArrayInt64;
563  return TExtArgumentType::ArrayFloat;
565  return TExtArgumentType::ArrayDouble;
567  return TExtArgumentType::ArrayBool;
569  return TExtArgumentType::ArrayTextEncodingNone;
571  return TExtArgumentType::ArrayTextEncodingDict;
573  return TExtArgumentType::GeoPoint;
575  return TExtArgumentType::GeoMultiPoint;
577  return TExtArgumentType::GeoLineString;
579  return TExtArgumentType::GeoMultiLineString;
581  return TExtArgumentType::Cursor;
583  return TExtArgumentType::GeoPolygon;
585  return TExtArgumentType::GeoMultiPolygon;
587  return TExtArgumentType::ColumnInt8;
589  return TExtArgumentType::ColumnInt16;
591  return TExtArgumentType::ColumnInt32;
593  return TExtArgumentType::ColumnInt64;
595  return TExtArgumentType::ColumnFloat;
597  return TExtArgumentType::ColumnDouble;
599  return TExtArgumentType::ColumnBool;
601  return TExtArgumentType::ColumnTextEncodingNone;
603  return TExtArgumentType::ColumnTextEncodingDict;
605  return TExtArgumentType::ColumnTimestamp;
607  return TExtArgumentType::TextEncodingNone;
609  return TExtArgumentType::TextEncodingDict;
611  return TExtArgumentType::Timestamp;
613  return TExtArgumentType::ColumnListInt8;
615  return TExtArgumentType::ColumnListInt16;
617  return TExtArgumentType::ColumnListInt32;
619  return TExtArgumentType::ColumnListInt64;
621  return TExtArgumentType::ColumnListFloat;
623  return TExtArgumentType::ColumnListDouble;
625  return TExtArgumentType::ColumnListBool;
627  return TExtArgumentType::ColumnListTextEncodingNone;
629  return TExtArgumentType::ColumnListTextEncodingDict;
631  return TExtArgumentType::ColumnArrayInt8;
633  return TExtArgumentType::ColumnArrayInt16;
635  return TExtArgumentType::ColumnArrayInt32;
637  return TExtArgumentType::ColumnArrayInt64;
639  return TExtArgumentType::ColumnArrayFloat;
641  return TExtArgumentType::ColumnArrayDouble;
643  return TExtArgumentType::ColumnArrayBool;
645  return TExtArgumentType::ColumnArrayTextEncodingNone;
647  return TExtArgumentType::ColumnArrayTextEncodingDict;
649  return TExtArgumentType::ColumnListArrayInt8;
651  return TExtArgumentType::ColumnListArrayInt16;
653  return TExtArgumentType::ColumnListArrayInt32;
655  return TExtArgumentType::ColumnListArrayInt64;
657  return TExtArgumentType::ColumnListArrayFloat;
659  return TExtArgumentType::ColumnListArrayDouble;
661  return TExtArgumentType::ColumnListArrayBool;
663  return TExtArgumentType::ColumnListArrayTextEncodingDict;
665  return TExtArgumentType::ColumnListArrayTextEncodingNone;
667  return TExtArgumentType::DayTimeInterval;
669  return TExtArgumentType::YearMonthTimeInterval;
670  }
671  UNREACHABLE();
672  return TExtArgumentType::type{};
673 }
#define UNREACHABLE()
Definition: Logger.h:333

+ Here is the caller graph for this function:

std::vector<TExtArgumentType::type> ThriftSerializers::to_thrift ( const std::vector< ExtArgumentType > &  v)
inline

Definition at line 686 of file ThriftSerializers.h.

References run_benchmark_import::result, to_thrift(), shared::transform(), and run_benchmark_import::type.

687  {
688  std::vector<TExtArgumentType::type> result;
690  v.begin(),
691  v.end(),
692  std::back_inserter(result),
693  [](ExtArgumentType c) -> TExtArgumentType::type { return to_thrift(c); });
694  return result;
695 }
OUTPUT transform(INPUT const &input, FUNC const &func)
Definition: misc.h:320
TExtArgumentType::type to_thrift(const ExtArgumentType &t)

+ Here is the call graph for this function:

TOutputBufferSizeType::type ThriftSerializers::to_thrift ( const table_functions::OutputBufferSizeType t)
inline

Definition at line 715 of file ThriftSerializers.h.

References table_functions::kConstant, table_functions::kPreFlightParameter, table_functions::kTableFunctionSpecifiedParameter, table_functions::kUserSpecifiedConstantParameter, table_functions::kUserSpecifiedRowMultiplier, run_benchmark_import::type, and UNREACHABLE.

716  {
717  switch (t) {
719  return TOutputBufferSizeType::kConstant;
721  return TOutputBufferSizeType::kUserSpecifiedConstantParameter;
723  return TOutputBufferSizeType::kUserSpecifiedRowMultiplier;
725  return TOutputBufferSizeType::kTableFunctionSpecifiedParameter;
727  return TOutputBufferSizeType::kPreFlightParameter;
728  }
729  UNREACHABLE();
731 }
#define UNREACHABLE()
Definition: Logger.h:333
TUserDefinedFunction ThriftSerializers::to_thrift ( const ExtensionFunction udf)
inline

Definition at line 733 of file ThriftSerializers.h.

References ExtensionFunction::getAnnotations(), ExtensionFunction::getInputArgs(), ExtensionFunction::getName(), ExtensionFunction::getRet(), and to_thrift().

733  {
734  TUserDefinedFunction tfunc;
735  tfunc.name = udf.getName(/* keep_suffix */ true);
736  tfunc.argTypes = to_thrift(udf.getInputArgs());
737  tfunc.retType = to_thrift(udf.getRet());
738  tfunc.annotations = udf.getAnnotations();
739  return tfunc;
740 }
const ExtArgumentType getRet() const
const std::string getName(bool keep_suffix=true) const
TExtArgumentType::type to_thrift(const ExtArgumentType &t)
const std::vector< ExtArgumentType > & getInputArgs() const
const std::vector< std::map< std::string, std::string > > & getAnnotations() const

+ Here is the call graph for this function:

TUserDefinedTableFunction ThriftSerializers::to_thrift ( const table_functions::TableFunction func)
inline

Definition at line 742 of file ThriftSerializers.h.

References table_functions::TableFunction::getAnnotations(), table_functions::TableFunction::getInputArgs(), table_functions::TableFunction::getName(), table_functions::TableFunction::getOutputArgs(), table_functions::TableFunction::getOutputRowSizeParameter(), table_functions::TableFunction::getOutputRowSizeType(), table_functions::TableFunction::getSqlArgs(), and to_thrift().

742  {
743  TUserDefinedTableFunction tfunc;
744  tfunc.name = func.getName();
745  tfunc.sizerType = to_thrift(func.getOutputRowSizeType());
746  tfunc.sizerArgPos = func.getOutputRowSizeParameter();
747  tfunc.inputArgTypes = to_thrift(func.getInputArgs());
748  tfunc.outputArgTypes = to_thrift(func.getOutputArgs());
749  tfunc.sqlArgTypes = to_thrift(func.getSqlArgs());
750  tfunc.annotations = func.getAnnotations();
751  return tfunc;
752 }
const std::vector< ExtArgumentType > & getOutputArgs() const
std::string getName(const bool drop_suffix=false, const bool lower=false) const
TExtArgumentType::type to_thrift(const ExtArgumentType &t)
const std::vector< ExtArgumentType > & getInputArgs() const
const std::vector< ExtArgumentType > & getSqlArgs() const
OutputBufferSizeType getOutputRowSizeType() const
const std::vector< std::map< std::string, std::string > > & getAnnotations() const

+ Here is the call graph for this function:

std::vector<TUserDefinedTableFunction> ThriftSerializers::to_thrift ( const std::vector< table_functions::TableFunction > &  v)
inline

Definition at line 754 of file ThriftSerializers.h.

References run_benchmark_import::result, to_thrift(), and shared::transform().

755  {
756  std::vector<TUserDefinedTableFunction> result;
757  std::transform(v.begin(),
758  v.end(),
759  std::back_inserter(result),
760  [](table_functions::TableFunction c) -> TUserDefinedTableFunction {
761  return to_thrift(c);
762  });
763  return result;
764 }
OUTPUT transform(INPUT const &input, FUNC const &func)
Definition: misc.h:320
TExtArgumentType::type to_thrift(const ExtArgumentType &t)

+ Here is the call graph for this function:

TTypeInfo ThriftSerializers::type_info_to_thrift ( const SQLTypeInfo ti)
inline

Definition at line 175 of file ThriftSerializers.h.

References encoding_to_thrift(), SQLTypeInfo::get_comp_param(), SQLTypeInfo::get_elem_type(), SQLTypeInfo::get_notnull(), SQLTypeInfo::get_precision(), SQLTypeInfo::get_scale(), SQLTypeInfo::get_size(), SQLTypeInfo::get_subtype(), SQLTypeInfo::get_type(), SQLTypeInfo::is_array(), IS_GEO, and type_to_thrift().

Referenced by DBHandler::get_tables_meta_impl(), and target_info_to_thrift().

175  {
176  TTypeInfo thrift_ti;
177  thrift_ti.type =
179  thrift_ti.encoding = encoding_to_thrift(ti);
180  thrift_ti.nullable = !ti.get_notnull();
181  thrift_ti.is_array = ti.is_array();
182  // TODO: Properly serialize geospatial subtype. For now, the value in precision is the
183  // same as the value in scale; overload the precision field with the subtype of the
184  // geospatial type (currently kGEOMETRY or kGEOGRAPHY)
185  thrift_ti.precision =
186  IS_GEO(ti.get_type()) ? static_cast<int32_t>(ti.get_subtype()) : ti.get_precision();
187  thrift_ti.scale = ti.get_scale();
188  thrift_ti.comp_param = ti.get_comp_param();
189  thrift_ti.size = ti.get_size();
190  return thrift_ti;
191 }
HOST DEVICE SQLTypes get_subtype() const
Definition: sqltypes.h:381
HOST DEVICE int get_size() const
Definition: sqltypes.h:390
TDatumType::type type_to_thrift(const SQLTypeInfo &type_info)
HOST DEVICE int get_scale() const
Definition: sqltypes.h:385
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:380
int get_precision() const
Definition: sqltypes.h:383
HOST DEVICE int get_comp_param() const
Definition: sqltypes.h:389
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:387
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:957
#define IS_GEO(T)
Definition: sqltypes.h:298
bool is_array() const
Definition: sqltypes.h:584
TEncodingType::type encoding_to_thrift(const SQLTypeInfo &type_info)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: