OmniSciDB  72c90bc290
 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:80
#define CHECK(condition)
Definition: Logger.h:291

+ 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:80
#define CHECK(condition)
Definition: Logger.h:291
#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,
130  thrift_column_range.table_id,
131  thrift_column_range.db_id};
132  switch (thrift_column_range.type) {
133  case TExpressionRangeType::INTEGER:
134  column_ranges.setColRange(
135  phys_input,
136  ExpressionRange::makeIntRange(thrift_column_range.int_min,
137  thrift_column_range.int_max,
138  thrift_column_range.bucket,
139  thrift_column_range.has_nulls));
140  break;
141  case TExpressionRangeType::FLOAT:
142  column_ranges.setColRange(
143  phys_input,
144  ExpressionRange::makeFloatRange(thrift_column_range.fp_min,
145  thrift_column_range.fp_max,
146  thrift_column_range.has_nulls));
147  break;
148  case TExpressionRangeType::DOUBLE:
149  column_ranges.setColRange(
150  phys_input,
151  ExpressionRange::makeDoubleRange(thrift_column_range.fp_min,
152  thrift_column_range.fp_max,
153  thrift_column_range.has_nulls));
154  break;
156  column_ranges.setColRange(phys_input, ExpressionRange::makeInvalidRange());
157  break;
158  default:
159  CHECK(false);
160  }
161  }
162  return column_ranges;
163 }
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:291
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 370 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.

371  {
372  CountDistinctDescriptor count_distinct_descriptor;
373  count_distinct_descriptor.impl_type_ =
374  count_distinct_impl_type_from_thrift(thrift_count_distinct_descriptor.impl_type);
375  count_distinct_descriptor.min_val = thrift_count_distinct_descriptor.min_val;
376  count_distinct_descriptor.bitmap_sz_bits =
377  thrift_count_distinct_descriptor.bitmap_sz_bits;
378  count_distinct_descriptor.approximate = thrift_count_distinct_descriptor.approximate;
379  count_distinct_descriptor.device_type =
380  thrift_count_distinct_descriptor.device_type == TDeviceType::GPU
383  count_distinct_descriptor.sub_bitmap_count =
384  thrift_count_distinct_descriptor.sub_bitmap_count;
385  return count_distinct_descriptor;
386 }
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 335 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.

336  {
337  TCountDistinctDescriptor thrift_count_distinct_descriptor;
338  thrift_count_distinct_descriptor.impl_type =
339  count_distinct_impl_type_to_thrift(count_distinct_descriptor.impl_type_);
340  thrift_count_distinct_descriptor.min_val = count_distinct_descriptor.min_val;
341  thrift_count_distinct_descriptor.bitmap_sz_bits =
342  count_distinct_descriptor.bitmap_sz_bits;
343  thrift_count_distinct_descriptor.approximate = count_distinct_descriptor.approximate;
344  thrift_count_distinct_descriptor.device_type =
345  count_distinct_descriptor.device_type == ExecutorDeviceType::GPU ? TDeviceType::GPU
346  : TDeviceType::CPU;
347  thrift_count_distinct_descriptor.sub_bitmap_count =
348  count_distinct_descriptor.sub_bitmap_count;
349  return thrift_count_distinct_descriptor;
350 }
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 356 of file ThriftSerializers.h.

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

Referenced by count_distinct_descriptor_from_thrift().

357  {
358  switch (impl_type) {
362  default:
363  CHECK(false);
364  }
365  abort();
366 }
#define UNTHRIFT_COUNTDESCRIPTORIMPL_CASE(kind)
bool g_enable_watchdog false
Definition: Execute.cpp:80
#define CHECK(condition)
Definition: Logger.h:291

+ 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 321 of file ThriftSerializers.h.

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

Referenced by count_distinct_descriptor_to_thrift().

322  {
323  switch (impl_type) {
326  THRIFT_COUNTDESCRIPTORIMPL_CASE(UnorderedSet)
327  default:
328  CHECK(false);
329  }
330  abort();
331 }
#define THRIFT_COUNTDESCRIPTORIMPL_CASE(kind)
bool g_enable_watchdog false
Definition: Execute.cpp:80
#define CHECK(condition)
Definition: Logger.h:291

+ 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 218 of file ThriftSerializers.h.

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

220  {
221  col_type.col_type.precision = static_cast<int>(subtype);
222  col_type.col_type.scale = output_srid;
223 }

+ Here is the caller graph for this function:

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

Definition at line 388 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, ColumnGeoLineString, ColumnGeoMultiLineString, ColumnGeoMultiPoint, ColumnGeoMultiPolygon, ColumnGeoPoint, ColumnGeoPolygon, ColumnInt16, ColumnInt32, ColumnInt64, ColumnInt8, ColumnListArrayBool, ColumnListArrayDouble, ColumnListArrayFloat, ColumnListArrayInt16, ColumnListArrayInt32, ColumnListArrayInt64, ColumnListArrayInt8, ColumnListArrayTextEncodingDict, ColumnListArrayTextEncodingNone, ColumnListBool, ColumnListDouble, ColumnListFloat, ColumnListGeoLineString, ColumnListGeoMultiLineString, ColumnListGeoMultiPoint, ColumnListGeoMultiPolygon, ColumnListGeoPoint, ColumnListGeoPolygon, 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().

388  {
389  switch (t) {
390  case TExtArgumentType::Int8:
391  return ExtArgumentType::Int8;
392  case TExtArgumentType::Int16:
393  return ExtArgumentType::Int16;
394  case TExtArgumentType::Int32:
395  return ExtArgumentType::Int32;
396  case TExtArgumentType::Int64:
397  return ExtArgumentType::Int64;
398  case TExtArgumentType::Float:
399  return ExtArgumentType::Float;
402  case TExtArgumentType::Void:
403  return ExtArgumentType::Void;
404  case TExtArgumentType::PInt8:
405  return ExtArgumentType::PInt8;
406  case TExtArgumentType::PInt16:
408  case TExtArgumentType::PInt32:
410  case TExtArgumentType::PInt64:
412  case TExtArgumentType::PFloat:
414  case TExtArgumentType::PDouble:
416  case TExtArgumentType::PBool:
417  return ExtArgumentType::PBool;
418  case TExtArgumentType::Bool:
419  return ExtArgumentType::Bool;
420  case TExtArgumentType::ArrayInt8:
422  case TExtArgumentType::ArrayInt16:
424  case TExtArgumentType::ArrayInt32:
426  case TExtArgumentType::ArrayInt64:
428  case TExtArgumentType::ArrayFloat:
430  case TExtArgumentType::ArrayDouble:
432  case TExtArgumentType::ArrayBool:
434  case TExtArgumentType::ArrayTextEncodingNone:
436  case TExtArgumentType::ArrayTextEncodingDict:
446  case TExtArgumentType::Cursor:
452  case TExtArgumentType::ColumnInt8:
454  case TExtArgumentType::ColumnInt16:
456  case TExtArgumentType::ColumnInt32:
458  case TExtArgumentType::ColumnInt64:
460  case TExtArgumentType::ColumnFloat:
462  case TExtArgumentType::ColumnDouble:
464  case TExtArgumentType::ColumnBool:
466  case TExtArgumentType::ColumnTextEncodingNone:
468  case TExtArgumentType::ColumnTextEncodingDict:
470  case TExtArgumentType::ColumnTimestamp:
472  case TExtArgumentType::TextEncodingNone:
474  case TExtArgumentType::TextEncodingDict:
476  case TExtArgumentType::Timestamp:
478  case TExtArgumentType::ColumnListInt8:
480  case TExtArgumentType::ColumnListInt16:
482  case TExtArgumentType::ColumnListInt32:
484  case TExtArgumentType::ColumnListInt64:
486  case TExtArgumentType::ColumnListFloat:
488  case TExtArgumentType::ColumnListDouble:
490  case TExtArgumentType::ColumnListBool:
492  case TExtArgumentType::ColumnListTextEncodingNone:
494  case TExtArgumentType::ColumnListTextEncodingDict:
496  case TExtArgumentType::ColumnArrayInt8:
498  case TExtArgumentType::ColumnArrayInt16:
500  case TExtArgumentType::ColumnArrayInt32:
502  case TExtArgumentType::ColumnArrayInt64:
504  case TExtArgumentType::ColumnArrayFloat:
506  case TExtArgumentType::ColumnArrayDouble:
508  case TExtArgumentType::ColumnArrayBool:
510  case TExtArgumentType::ColumnArrayTextEncodingNone:
512  case TExtArgumentType::ColumnArrayTextEncodingDict:
514  case TExtArgumentType::ColumnListArrayInt8:
516  case TExtArgumentType::ColumnListArrayInt16:
518  case TExtArgumentType::ColumnListArrayInt32:
520  case TExtArgumentType::ColumnListArrayInt64:
522  case TExtArgumentType::ColumnListArrayFloat:
524  case TExtArgumentType::ColumnListArrayDouble:
526  case TExtArgumentType::ColumnListArrayBool:
528  case TExtArgumentType::ColumnListArrayTextEncodingNone:
530  case TExtArgumentType::ColumnListArrayTextEncodingDict:
532  case TExtArgumentType::DayTimeInterval:
534  case TExtArgumentType::YearMonthTimeInterval:
536  case TExtArgumentType::ColumnGeoPoint:
538  case TExtArgumentType::ColumnGeoLineString:
540  case TExtArgumentType::ColumnGeoPolygon:
542  case TExtArgumentType::ColumnGeoMultiPoint:
544  case TExtArgumentType::ColumnGeoMultiLineString:
546  case TExtArgumentType::ColumnGeoMultiPolygon:
548  case TExtArgumentType::ColumnListGeoPoint:
550  case TExtArgumentType::ColumnListGeoLineString:
552  case TExtArgumentType::ColumnListGeoPolygon:
554  case TExtArgumentType::ColumnListGeoMultiPoint:
556  case TExtArgumentType::ColumnListGeoMultiLineString:
558  case TExtArgumentType::ColumnListGeoMultiPolygon:
560  }
561  UNREACHABLE();
562  return ExtArgumentType{};
563 }
struct GeoLineStringStruct GeoLineString
Definition: heavydbTypes.h:999
struct GeoPointStruct GeoPoint
Definition: heavydbTypes.h:963
#define UNREACHABLE()
Definition: Logger.h:338
struct GeoMultiPointStruct GeoMultiPoint
Definition: heavydbTypes.h:981
struct GeoMultiLineStringStruct GeoMultiLineString
struct GeoMultiPolygonStruct GeoMultiPolygon
struct GeoPolygonStruct GeoPolygon

+ Here is the caller graph for this function:

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

Definition at line 742 of file ThriftSerializers.h.

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

743  {
744  std::vector<ExtArgumentType> result;
746  v.begin(),
747  v.end(),
748  std::back_inserter(result),
749  [](TExtArgumentType::type c) -> ExtArgumentType { return from_thrift(c); });
750  return result;
751 }
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 764 of file ThriftSerializers.h.

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

765  {
766  switch (t) {
767  case TOutputBufferSizeType::kConstant:
769  case TOutputBufferSizeType::kUserSpecifiedConstantParameter:
771  case TOutputBufferSizeType::kUserSpecifiedRowMultiplier:
773  case TOutputBufferSizeType::kTableFunctionSpecifiedParameter:
775  case TOutputBufferSizeType::kPreFlightParameter:
777  }
778  UNREACHABLE();
780 }
#define UNREACHABLE()
Definition: Logger.h:338
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:80
#define CHECK(condition)
Definition: Logger.h:291
#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:80
#define CHECK(condition)
Definition: Logger.h:291
#define THRIFT_LAYOUT_CASE(layout)
StringDictionaryGenerations ThriftSerializers::string_dictionary_generations_from_thrift ( const std::vector< TDictionaryGeneration > &  thrift_string_dictionary_generations)
inline

Definition at line 165 of file ThriftSerializers.h.

References StringDictionaryGenerations::setGeneration().

166  {
167  StringDictionaryGenerations string_dictionary_generations;
168  for (const auto& thrift_string_dictionary_generation :
169  thrift_string_dictionary_generations) {
170  string_dictionary_generations.setGeneration(
171  {thrift_string_dictionary_generation.db_id,
172  thrift_string_dictionary_generation.dict_id},
173  thrift_string_dictionary_generation.entry_count);
174  }
175  return string_dictionary_generations;
176 }
void setGeneration(const shared::StringDictKey &dict_key, const uint64_t generation)

+ Here is the call graph for this function:

bool ThriftSerializers::takes_arg ( const TargetInfo target_info)
inline

Definition at line 204 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().

204  {
205  return target_info.is_agg &&
206  (target_info.agg_kind != kCOUNT || is_distinct_target(target_info));
207 }
bool is_agg
Definition: TargetInfo.h:50
bool is_distinct_target(const TargetInfo &target_info)
Definition: TargetInfo.h:102
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 286 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().

286  {
287  TargetInfo target_info;
288  target_info.is_agg = thrift_target_info.is_agg;
289  target_info.agg_kind = agg_kind_from_thrift(thrift_target_info.kind);
290  target_info.sql_type = type_info_from_thrift(thrift_target_info.type);
291  target_info.is_distinct = thrift_target_info.is_distinct;
292  target_info.agg_arg_type = takes_arg(target_info)
293  ? type_info_from_thrift(thrift_target_info.arg_type)
295  target_info.skip_null_val = thrift_target_info.skip_nulls;
296  return target_info;
297 }
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:80
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 273 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().

273  {
274  TTargetInfo thrift_target_info;
275  thrift_target_info.is_agg = target_info.is_agg;
276  thrift_target_info.kind = agg_kind_to_thrift(target_info.agg_kind);
277  thrift_target_info.type = type_info_to_thrift(target_info.sql_type);
278  thrift_target_info.arg_type = takes_arg(target_info)
279  ? type_info_to_thrift(target_info.agg_arg_type)
280  : thrift_target_info.type;
281  thrift_target_info.skip_nulls = target_info.skip_null_val;
282  thrift_target_info.is_distinct = target_info.is_distinct;
283  return thrift_target_info;
284 }
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 308 of file ThriftSerializers.h.

References target_info_from_thrift().

309  {
310  std::vector<TargetInfo> targets;
311  for (const auto& thrift_target_info : thrift_targets) {
312  targets.push_back(target_info_from_thrift(thrift_target_info));
313  }
314  return targets;
315 }
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 299 of file ThriftSerializers.h.

References target_info_to_thrift().

300  {
301  std::vector<TTargetInfo> thrift_targets;
302  for (const auto& target_info : targets) {
303  thrift_targets.push_back(target_info_to_thrift(target_info));
304  }
305  return thrift_targets;
306 }
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 225 of file ThriftSerializers.h.

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

Referenced by target_meta_infos_to_thrift().

226  {
227  TColumnType proj_info;
228  proj_info.col_name = target.get_resname();
229  if (proj_info.col_name.empty()) {
230  proj_info.col_name = "result_" + std::to_string(idx + 1);
231  }
232  const auto& target_ti = target.get_type_info();
233  proj_info.col_type.type = type_to_thrift(target_ti);
234  proj_info.col_type.encoding = encoding_to_thrift(target_ti);
235  proj_info.col_type.nullable = !target_ti.get_notnull();
236  proj_info.col_type.is_array = target_ti.get_type() == kARRAY;
237  if (IS_GEO(target_ti.get_type())) {
239  proj_info, target_ti.get_subtype(), target_ti.get_output_srid());
240  } else {
241  proj_info.col_type.precision = target_ti.get_precision();
242  proj_info.col_type.scale = target_ti.get_scale();
243  }
244  if (target_ti.get_type() == kDATE) {
245  proj_info.col_type.size = target_ti.get_size();
246  }
247  proj_info.col_type.comp_param =
248  (target_ti.is_date_in_days() && target_ti.get_comp_param() == 0)
249  ? 32
250  : target_ti.get_comp_param();
251 
252  if (target_ti.get_compression() == kENCODING_DICT) {
253  const auto& dict_key = target_ti.getStringDictKey();
254  TStringDictKey t_dict_key;
255  t_dict_key.db_id = dict_key.db_id;
256  t_dict_key.dict_id = dict_key.dict_id;
257  proj_info.col_type.__set_dict_key(t_dict_key);
258  }
259  return proj_info;
260 }
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:80
SQLTypes type
Definition: sqltypes.h:1268
const std::string & get_resname() const
#define IS_GEO(T)
Definition: sqltypes.h:310
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 209 of file ThriftSerializers.h.

References type_info_from_thrift().

210  {
211  std::vector<TargetMetaInfo> target_meta_infos;
212  for (const auto& col : row_desc) {
213  target_meta_infos.emplace_back(col.col_name, type_info_from_thrift(col.col_type));
214  }
215  return target_meta_infos;
216 }
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 262 of file ThriftSerializers.h.

References target_meta_info_to_thrift().

Referenced by DBHandler::convertRows().

263  {
264  TRowDescriptor row_desc;
265  size_t i = 0;
266  for (const auto& target : targets) {
267  row_desc.push_back(target_meta_info_to_thrift(target, i));
268  ++i;
269  }
270  return row_desc;
271 }
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 565 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, ColumnGeoLineString, ColumnGeoMultiLineString, ColumnGeoMultiPoint, ColumnGeoMultiPolygon, ColumnGeoPoint, ColumnGeoPolygon, ColumnInt16, ColumnInt32, ColumnInt64, ColumnInt8, ColumnListArrayBool, ColumnListArrayDouble, ColumnListArrayFloat, ColumnListArrayInt16, ColumnListArrayInt32, ColumnListArrayInt64, ColumnListArrayInt8, ColumnListArrayTextEncodingDict, ColumnListArrayTextEncodingNone, ColumnListBool, ColumnListDouble, ColumnListFloat, ColumnListGeoLineString, ColumnListGeoMultiLineString, ColumnListGeoMultiPoint, ColumnListGeoMultiPolygon, ColumnListGeoPoint, ColumnListGeoPolygon, 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().

565  {
566  switch (t) {
568  return TExtArgumentType::Int8;
570  return TExtArgumentType::Int16;
572  return TExtArgumentType::Int32;
574  return TExtArgumentType::Int64;
576  return TExtArgumentType::Float;
580  return TExtArgumentType::Void;
582  return TExtArgumentType::PInt8;
584  return TExtArgumentType::PInt16;
586  return TExtArgumentType::PInt32;
588  return TExtArgumentType::PInt64;
590  return TExtArgumentType::PFloat;
592  return TExtArgumentType::PDouble;
594  return TExtArgumentType::PBool;
596  return TExtArgumentType::Bool;
598  return TExtArgumentType::ArrayInt8;
600  return TExtArgumentType::ArrayInt16;
602  return TExtArgumentType::ArrayInt32;
604  return TExtArgumentType::ArrayInt64;
606  return TExtArgumentType::ArrayFloat;
608  return TExtArgumentType::ArrayDouble;
610  return TExtArgumentType::ArrayBool;
612  return TExtArgumentType::ArrayTextEncodingNone;
614  return TExtArgumentType::ArrayTextEncodingDict;
624  return TExtArgumentType::Cursor;
630  return TExtArgumentType::ColumnInt8;
632  return TExtArgumentType::ColumnInt16;
634  return TExtArgumentType::ColumnInt32;
636  return TExtArgumentType::ColumnInt64;
638  return TExtArgumentType::ColumnFloat;
640  return TExtArgumentType::ColumnDouble;
642  return TExtArgumentType::ColumnBool;
644  return TExtArgumentType::ColumnTextEncodingNone;
646  return TExtArgumentType::ColumnTextEncodingDict;
648  return TExtArgumentType::ColumnTimestamp;
650  return TExtArgumentType::TextEncodingNone;
652  return TExtArgumentType::TextEncodingDict;
654  return TExtArgumentType::Timestamp;
656  return TExtArgumentType::ColumnListInt8;
658  return TExtArgumentType::ColumnListInt16;
660  return TExtArgumentType::ColumnListInt32;
662  return TExtArgumentType::ColumnListInt64;
664  return TExtArgumentType::ColumnListFloat;
666  return TExtArgumentType::ColumnListDouble;
668  return TExtArgumentType::ColumnListBool;
670  return TExtArgumentType::ColumnListTextEncodingNone;
672  return TExtArgumentType::ColumnListTextEncodingDict;
674  return TExtArgumentType::ColumnArrayInt8;
676  return TExtArgumentType::ColumnArrayInt16;
678  return TExtArgumentType::ColumnArrayInt32;
680  return TExtArgumentType::ColumnArrayInt64;
682  return TExtArgumentType::ColumnArrayFloat;
684  return TExtArgumentType::ColumnArrayDouble;
686  return TExtArgumentType::ColumnArrayBool;
688  return TExtArgumentType::ColumnArrayTextEncodingNone;
690  return TExtArgumentType::ColumnArrayTextEncodingDict;
692  return TExtArgumentType::ColumnListArrayInt8;
694  return TExtArgumentType::ColumnListArrayInt16;
696  return TExtArgumentType::ColumnListArrayInt32;
698  return TExtArgumentType::ColumnListArrayInt64;
700  return TExtArgumentType::ColumnListArrayFloat;
702  return TExtArgumentType::ColumnListArrayDouble;
704  return TExtArgumentType::ColumnListArrayBool;
706  return TExtArgumentType::ColumnListArrayTextEncodingDict;
708  return TExtArgumentType::ColumnListArrayTextEncodingNone;
710  return TExtArgumentType::DayTimeInterval;
712  return TExtArgumentType::YearMonthTimeInterval;
714  return TExtArgumentType::ColumnGeoPoint;
716  return TExtArgumentType::ColumnGeoLineString;
718  return TExtArgumentType::ColumnGeoPolygon;
720  return TExtArgumentType::ColumnGeoMultiPoint;
722  return TExtArgumentType::ColumnGeoMultiLineString;
724  return TExtArgumentType::ColumnGeoMultiPolygon;
726  return TExtArgumentType::ColumnListGeoPoint;
728  return TExtArgumentType::ColumnListGeoLineString;
730  return TExtArgumentType::ColumnListGeoPolygon;
732  return TExtArgumentType::ColumnListGeoMultiPoint;
734  return TExtArgumentType::ColumnListGeoMultiLineString;
736  return TExtArgumentType::ColumnListGeoMultiPolygon;
737  }
738  UNREACHABLE();
739  return TExtArgumentType::type{};
740 }
struct GeoLineStringStruct GeoLineString
Definition: heavydbTypes.h:999
struct GeoPointStruct GeoPoint
Definition: heavydbTypes.h:963
#define UNREACHABLE()
Definition: Logger.h:338
struct GeoMultiPointStruct GeoMultiPoint
Definition: heavydbTypes.h:981
struct GeoMultiLineStringStruct GeoMultiLineString
struct GeoMultiPolygonStruct GeoMultiPolygon
struct GeoPolygonStruct GeoPolygon

+ Here is the caller graph for this function:

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

Definition at line 753 of file ThriftSerializers.h.

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

754  {
755  std::vector<TExtArgumentType::type> result;
757  v.begin(),
758  v.end(),
759  std::back_inserter(result),
760  [](ExtArgumentType c) -> TExtArgumentType::type { return to_thrift(c); });
761  return result;
762 }
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 782 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.

783  {
784  switch (t) {
786  return TOutputBufferSizeType::kConstant;
788  return TOutputBufferSizeType::kUserSpecifiedConstantParameter;
790  return TOutputBufferSizeType::kUserSpecifiedRowMultiplier;
792  return TOutputBufferSizeType::kTableFunctionSpecifiedParameter;
794  return TOutputBufferSizeType::kPreFlightParameter;
795  }
796  UNREACHABLE();
798 }
#define UNREACHABLE()
Definition: Logger.h:338
TUserDefinedFunction ThriftSerializers::to_thrift ( const ExtensionFunction udf)
inline

Definition at line 800 of file ThriftSerializers.h.

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

800  {
801  TUserDefinedFunction tfunc;
802  tfunc.name = udf.getName(/* keep_suffix */ true);
803  tfunc.argTypes = to_thrift(udf.getInputArgs());
804  tfunc.retType = to_thrift(udf.getRet());
805  tfunc.annotations = udf.getAnnotations();
806  return tfunc;
807 }
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 809 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().

809  {
810  TUserDefinedTableFunction tfunc;
811  tfunc.name = func.getName();
812  tfunc.sizerType = to_thrift(func.getOutputRowSizeType());
813  tfunc.sizerArgPos = func.getOutputRowSizeParameter();
814  tfunc.inputArgTypes = to_thrift(func.getInputArgs());
815  tfunc.outputArgTypes = to_thrift(func.getOutputArgs());
816  tfunc.sqlArgTypes = to_thrift(func.getSqlArgs());
817  tfunc.annotations = func.getAnnotations();
818  return tfunc;
819 }
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 821 of file ThriftSerializers.h.

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

822  {
823  std::vector<TUserDefinedTableFunction> result;
824  std::transform(v.begin(),
825  v.end(),
826  std::back_inserter(result),
827  [](table_functions::TableFunction c) -> TUserDefinedTableFunction {
828  return to_thrift(c);
829  });
830  return result;
831 }
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 178 of file ThriftSerializers.h.

References shared::StringDictKey::db_id, encoding_to_thrift(), SQLTypeInfo::get_comp_param(), SQLTypeInfo::get_compression(), SQLTypeInfo::get_elem_type(), SQLTypeInfo::get_notnull(), SQLTypeInfo::get_precision(), SQLTypeInfo::get_scale(), SQLTypeInfo::get_size(), SQLTypeInfo::get_subtype(), SQLTypeInfo::get_type(), SQLTypeInfo::getStringDictKey(), SQLTypeInfo::is_array(), IS_GEO, kENCODING_DICT, and type_to_thrift().

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

178  {
179  TTypeInfo thrift_ti;
180  thrift_ti.type =
182  thrift_ti.encoding = encoding_to_thrift(ti);
183  thrift_ti.nullable = !ti.get_notnull();
184  thrift_ti.is_array = ti.is_array();
185  // TODO: Properly serialize geospatial subtype. For now, the value in precision is the
186  // same as the value in scale; overload the precision field with the subtype of the
187  // geospatial type (currently kGEOMETRY or kGEOGRAPHY)
188  thrift_ti.precision =
189  IS_GEO(ti.get_type()) ? static_cast<int32_t>(ti.get_subtype()) : ti.get_precision();
190  thrift_ti.scale = ti.get_scale();
191  thrift_ti.comp_param = ti.get_comp_param();
192  thrift_ti.size = ti.get_size();
193 
194  if (ti.get_compression() == kENCODING_DICT) {
195  const auto& dict_key = ti.getStringDictKey();
196  TStringDictKey t_dict_key;
197  t_dict_key.db_id = dict_key.db_id;
198  t_dict_key.dict_id = dict_key.dict_id;
199  thrift_ti.__set_dict_key(t_dict_key);
200  }
201  return thrift_ti;
202 }
HOST DEVICE SQLTypes get_subtype() const
Definition: sqltypes.h:392
HOST DEVICE int get_size() const
Definition: sqltypes.h:403
TDatumType::type type_to_thrift(const SQLTypeInfo &type_info)
HOST DEVICE int get_scale() const
Definition: sqltypes.h:396
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
int get_precision() const
Definition: sqltypes.h:394
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:399
HOST DEVICE int get_comp_param() const
Definition: sqltypes.h:402
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:398
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:975
#define IS_GEO(T)
Definition: sqltypes.h:310
bool is_array() const
Definition: sqltypes.h:583
const shared::StringDictKey & getStringDictKey() const
Definition: sqltypes.h:1055
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: