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

Functions

TResultSetLayout::type layout_to_thrift (const heavyai::QueryDescriptionType layout)
 
heavyai::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 108 of file ThriftSerializers.h.

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

Referenced by target_info_from_thrift().

108  {
109  switch (agg) {
111  UNTHRIFT_AGGKIND_CASE(COUNT)
115  UNTHRIFT_AGGKIND_CASE(APPROX_COUNT_DISTINCT)
116  UNTHRIFT_AGGKIND_CASE(SAMPLE)
117  UNTHRIFT_AGGKIND_CASE(SINGLE_VALUE)
118  UNTHRIFT_AGGKIND_CASE(COUNT_IF)
119  UNTHRIFT_AGGKIND_CASE(SUM_IF)
120  default:
121  CHECK(false) << static_cast<int>(agg);
122  }
123  abort();
124 }
#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 84 of file ThriftSerializers.h.

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

Referenced by target_info_to_thrift().

84  {
85  switch (agg) {
87  THRIFT_AGGKIND_CASE(COUNT)
91  THRIFT_AGGKIND_CASE(APPROX_COUNT_DISTINCT)
92  THRIFT_AGGKIND_CASE(SAMPLE)
93  THRIFT_AGGKIND_CASE(SINGLE_VALUE)
94  THRIFT_AGGKIND_CASE(COUNT_IF)
95  THRIFT_AGGKIND_CASE(SUM_IF)
96  default:
97  CHECK(false) << static_cast<int>(agg);
98  }
99  abort();
100 }
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 128 of file ThriftSerializers.h.

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

129  {
130  AggregatedColRange column_ranges;
131  for (const auto& thrift_column_range : thrift_column_ranges) {
132  PhysicalInput phys_input{thrift_column_range.col_id,
133  thrift_column_range.table_id,
134  thrift_column_range.db_id};
135  switch (thrift_column_range.type) {
136  case TExpressionRangeType::INTEGER:
137  column_ranges.setColRange(
138  phys_input,
139  ExpressionRange::makeIntRange(thrift_column_range.int_min,
140  thrift_column_range.int_max,
141  thrift_column_range.bucket,
142  thrift_column_range.has_nulls));
143  break;
144  case TExpressionRangeType::FLOAT:
145  column_ranges.setColRange(
146  phys_input,
147  ExpressionRange::makeFloatRange(thrift_column_range.fp_min,
148  thrift_column_range.fp_max,
149  thrift_column_range.has_nulls));
150  break;
151  case TExpressionRangeType::DOUBLE:
152  column_ranges.setColRange(
153  phys_input,
154  ExpressionRange::makeDoubleRange(thrift_column_range.fp_min,
155  thrift_column_range.fp_max,
156  thrift_column_range.has_nulls));
157  break;
159  column_ranges.setColRange(phys_input, ExpressionRange::makeInvalidRange());
160  break;
161  default:
162  CHECK(false);
163  }
164  }
165  return column_ranges;
166 }
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 373 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.

374  {
375  CountDistinctDescriptor count_distinct_descriptor;
376  count_distinct_descriptor.impl_type_ =
377  count_distinct_impl_type_from_thrift(thrift_count_distinct_descriptor.impl_type);
378  count_distinct_descriptor.min_val = thrift_count_distinct_descriptor.min_val;
379  count_distinct_descriptor.bitmap_sz_bits =
380  thrift_count_distinct_descriptor.bitmap_sz_bits;
381  count_distinct_descriptor.approximate = thrift_count_distinct_descriptor.approximate;
382  count_distinct_descriptor.device_type =
383  thrift_count_distinct_descriptor.device_type == TDeviceType::GPU
386  count_distinct_descriptor.sub_bitmap_count =
387  thrift_count_distinct_descriptor.sub_bitmap_count;
388  return count_distinct_descriptor;
389 }
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 338 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.

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

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

Referenced by count_distinct_descriptor_from_thrift().

360  {
361  switch (impl_type) {
365  default:
366  CHECK(false);
367  }
368  abort();
369 }
#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 324 of file ThriftSerializers.h.

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

Referenced by count_distinct_descriptor_to_thrift().

325  {
326  switch (impl_type) {
329  THRIFT_COUNTDESCRIPTORIMPL_CASE(UnorderedSet)
330  default:
331  CHECK(false);
332  }
333  abort();
334 }
#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 221 of file ThriftSerializers.h.

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

223  {
224  col_type.col_type.precision = static_cast<int>(subtype);
225  col_type.col_type.scale = output_srid;
226 }

+ Here is the caller graph for this function:

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

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

391  {
392  switch (t) {
393  case TExtArgumentType::Int8:
394  return ExtArgumentType::Int8;
395  case TExtArgumentType::Int16:
396  return ExtArgumentType::Int16;
397  case TExtArgumentType::Int32:
398  return ExtArgumentType::Int32;
399  case TExtArgumentType::Int64:
400  return ExtArgumentType::Int64;
401  case TExtArgumentType::Float:
402  return ExtArgumentType::Float;
405  case TExtArgumentType::Void:
406  return ExtArgumentType::Void;
407  case TExtArgumentType::PInt8:
408  return ExtArgumentType::PInt8;
409  case TExtArgumentType::PInt16:
411  case TExtArgumentType::PInt32:
413  case TExtArgumentType::PInt64:
415  case TExtArgumentType::PFloat:
417  case TExtArgumentType::PDouble:
419  case TExtArgumentType::PBool:
420  return ExtArgumentType::PBool;
421  case TExtArgumentType::Bool:
422  return ExtArgumentType::Bool;
423  case TExtArgumentType::ArrayInt8:
425  case TExtArgumentType::ArrayInt16:
427  case TExtArgumentType::ArrayInt32:
429  case TExtArgumentType::ArrayInt64:
431  case TExtArgumentType::ArrayFloat:
433  case TExtArgumentType::ArrayDouble:
435  case TExtArgumentType::ArrayBool:
437  case TExtArgumentType::ArrayTextEncodingNone:
439  case TExtArgumentType::ArrayTextEncodingDict:
449  case TExtArgumentType::Cursor:
455  case TExtArgumentType::ColumnInt8:
457  case TExtArgumentType::ColumnInt16:
459  case TExtArgumentType::ColumnInt32:
461  case TExtArgumentType::ColumnInt64:
463  case TExtArgumentType::ColumnFloat:
465  case TExtArgumentType::ColumnDouble:
467  case TExtArgumentType::ColumnBool:
469  case TExtArgumentType::ColumnTextEncodingNone:
471  case TExtArgumentType::ColumnTextEncodingDict:
473  case TExtArgumentType::ColumnTimestamp:
475  case TExtArgumentType::TextEncodingNone:
477  case TExtArgumentType::TextEncodingDict:
479  case TExtArgumentType::Timestamp:
481  case TExtArgumentType::ColumnListInt8:
483  case TExtArgumentType::ColumnListInt16:
485  case TExtArgumentType::ColumnListInt32:
487  case TExtArgumentType::ColumnListInt64:
489  case TExtArgumentType::ColumnListFloat:
491  case TExtArgumentType::ColumnListDouble:
493  case TExtArgumentType::ColumnListBool:
495  case TExtArgumentType::ColumnListTextEncodingNone:
497  case TExtArgumentType::ColumnListTextEncodingDict:
499  case TExtArgumentType::ColumnArrayInt8:
501  case TExtArgumentType::ColumnArrayInt16:
503  case TExtArgumentType::ColumnArrayInt32:
505  case TExtArgumentType::ColumnArrayInt64:
507  case TExtArgumentType::ColumnArrayFloat:
509  case TExtArgumentType::ColumnArrayDouble:
511  case TExtArgumentType::ColumnArrayBool:
513  case TExtArgumentType::ColumnArrayTextEncodingNone:
515  case TExtArgumentType::ColumnArrayTextEncodingDict:
517  case TExtArgumentType::ColumnListArrayInt8:
519  case TExtArgumentType::ColumnListArrayInt16:
521  case TExtArgumentType::ColumnListArrayInt32:
523  case TExtArgumentType::ColumnListArrayInt64:
525  case TExtArgumentType::ColumnListArrayFloat:
527  case TExtArgumentType::ColumnListArrayDouble:
529  case TExtArgumentType::ColumnListArrayBool:
531  case TExtArgumentType::ColumnListArrayTextEncodingNone:
533  case TExtArgumentType::ColumnListArrayTextEncodingDict:
535  case TExtArgumentType::DayTimeInterval:
537  case TExtArgumentType::YearMonthTimeInterval:
539  case TExtArgumentType::ColumnGeoPoint:
541  case TExtArgumentType::ColumnGeoLineString:
543  case TExtArgumentType::ColumnGeoPolygon:
545  case TExtArgumentType::ColumnGeoMultiPoint:
547  case TExtArgumentType::ColumnGeoMultiLineString:
549  case TExtArgumentType::ColumnGeoMultiPolygon:
551  case TExtArgumentType::ColumnListGeoPoint:
553  case TExtArgumentType::ColumnListGeoLineString:
555  case TExtArgumentType::ColumnListGeoPolygon:
557  case TExtArgumentType::ColumnListGeoMultiPoint:
559  case TExtArgumentType::ColumnListGeoMultiLineString:
561  case TExtArgumentType::ColumnListGeoMultiPolygon:
563  }
564  UNREACHABLE();
565  return ExtArgumentType{};
566 }
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 745 of file ThriftSerializers.h.

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

746  {
747  std::vector<ExtArgumentType> result;
749  v.begin(),
750  v.end(),
751  std::back_inserter(result),
752  [](TExtArgumentType::type c) -> ExtArgumentType { return from_thrift(c); });
753  return result;
754 }
ExtArgumentType from_thrift(const TExtArgumentType::type &t)
OUTPUT transform(INPUT const &input, FUNC const &func)
Definition: misc.h:329

+ Here is the call graph for this function:

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

Definition at line 767 of file ThriftSerializers.h.

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

768  {
769  switch (t) {
770  case TOutputBufferSizeType::kConstant:
772  case TOutputBufferSizeType::kUserSpecifiedConstantParameter:
774  case TOutputBufferSizeType::kUserSpecifiedRowMultiplier:
776  case TOutputBufferSizeType::kTableFunctionSpecifiedParameter:
778  case TOutputBufferSizeType::kPreFlightParameter:
780  }
781  UNREACHABLE();
783 }
#define UNREACHABLE()
Definition: Logger.h:338
heavyai::QueryDescriptionType ThriftSerializers::layout_from_thrift ( const TResultSetLayout::type  layout)
inline

Definition at line 65 of file ThriftSerializers.h.

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

66  {
67  switch (layout) {
72  default:
73  CHECK(false) << static_cast<int>(layout);
74  }
75  abort();
76 }
GroupByPerfectHash
Definition: enums.h:58
NonGroupedAggregate
Definition: enums.h:58
Projection
Definition: enums.h:58
GroupByBaselineHash
Definition: enums.h:58
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 heavyai::QueryDescriptionType  layout)
inline

Definition at line 46 of file ThriftSerializers.h.

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

47  {
48  switch (layout) {
53  default:
54  CHECK(false) << static_cast<int>(layout);
55  }
56  abort();
57 }
GroupByPerfectHash
Definition: enums.h:58
NonGroupedAggregate
Definition: enums.h:58
Projection
Definition: enums.h:58
GroupByBaselineHash
Definition: enums.h:58
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 168 of file ThriftSerializers.h.

References StringDictionaryGenerations::setGeneration().

169  {
170  StringDictionaryGenerations string_dictionary_generations;
171  for (const auto& thrift_string_dictionary_generation :
172  thrift_string_dictionary_generations) {
173  string_dictionary_generations.setGeneration(
174  {thrift_string_dictionary_generation.db_id,
175  thrift_string_dictionary_generation.dict_id},
176  thrift_string_dictionary_generation.entry_count);
177  }
178  return string_dictionary_generations;
179 }
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 207 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().

207  {
208  return target_info.is_agg &&
209  (target_info.agg_kind != kCOUNT || is_distinct_target(target_info));
210 }
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:81

+ 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 289 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().

289  {
290  TargetInfo target_info;
291  target_info.is_agg = thrift_target_info.is_agg;
292  target_info.agg_kind = agg_kind_from_thrift(thrift_target_info.kind);
293  target_info.sql_type = type_info_from_thrift(thrift_target_info.type);
294  target_info.is_distinct = thrift_target_info.is_distinct;
295  target_info.agg_arg_type = takes_arg(target_info)
296  ? type_info_from_thrift(thrift_target_info.arg_type)
298  target_info.skip_null_val = thrift_target_info.skip_nulls;
299  return target_info;
300 }
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 276 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().

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

References target_info_from_thrift().

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

References target_info_to_thrift().

303  {
304  std::vector<TTargetInfo> thrift_targets;
305  for (const auto& target_info : targets) {
306  thrift_targets.push_back(target_info_to_thrift(target_info));
307  }
308  return thrift_targets;
309 }
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 228 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().

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

References type_info_from_thrift().

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

References target_meta_info_to_thrift().

Referenced by DBHandler::convertRows().

266  {
267  TRowDescriptor row_desc;
268  size_t i = 0;
269  for (const auto& target : targets) {
270  row_desc.push_back(target_meta_info_to_thrift(target, i));
271  ++i;
272  }
273  return row_desc;
274 }
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 568 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().

568  {
569  switch (t) {
571  return TExtArgumentType::Int8;
573  return TExtArgumentType::Int16;
575  return TExtArgumentType::Int32;
577  return TExtArgumentType::Int64;
579  return TExtArgumentType::Float;
583  return TExtArgumentType::Void;
585  return TExtArgumentType::PInt8;
587  return TExtArgumentType::PInt16;
589  return TExtArgumentType::PInt32;
591  return TExtArgumentType::PInt64;
593  return TExtArgumentType::PFloat;
595  return TExtArgumentType::PDouble;
597  return TExtArgumentType::PBool;
599  return TExtArgumentType::Bool;
601  return TExtArgumentType::ArrayInt8;
603  return TExtArgumentType::ArrayInt16;
605  return TExtArgumentType::ArrayInt32;
607  return TExtArgumentType::ArrayInt64;
609  return TExtArgumentType::ArrayFloat;
611  return TExtArgumentType::ArrayDouble;
613  return TExtArgumentType::ArrayBool;
615  return TExtArgumentType::ArrayTextEncodingNone;
617  return TExtArgumentType::ArrayTextEncodingDict;
627  return TExtArgumentType::Cursor;
633  return TExtArgumentType::ColumnInt8;
635  return TExtArgumentType::ColumnInt16;
637  return TExtArgumentType::ColumnInt32;
639  return TExtArgumentType::ColumnInt64;
641  return TExtArgumentType::ColumnFloat;
643  return TExtArgumentType::ColumnDouble;
645  return TExtArgumentType::ColumnBool;
647  return TExtArgumentType::ColumnTextEncodingNone;
649  return TExtArgumentType::ColumnTextEncodingDict;
651  return TExtArgumentType::ColumnTimestamp;
653  return TExtArgumentType::TextEncodingNone;
655  return TExtArgumentType::TextEncodingDict;
657  return TExtArgumentType::Timestamp;
659  return TExtArgumentType::ColumnListInt8;
661  return TExtArgumentType::ColumnListInt16;
663  return TExtArgumentType::ColumnListInt32;
665  return TExtArgumentType::ColumnListInt64;
667  return TExtArgumentType::ColumnListFloat;
669  return TExtArgumentType::ColumnListDouble;
671  return TExtArgumentType::ColumnListBool;
673  return TExtArgumentType::ColumnListTextEncodingNone;
675  return TExtArgumentType::ColumnListTextEncodingDict;
677  return TExtArgumentType::ColumnArrayInt8;
679  return TExtArgumentType::ColumnArrayInt16;
681  return TExtArgumentType::ColumnArrayInt32;
683  return TExtArgumentType::ColumnArrayInt64;
685  return TExtArgumentType::ColumnArrayFloat;
687  return TExtArgumentType::ColumnArrayDouble;
689  return TExtArgumentType::ColumnArrayBool;
691  return TExtArgumentType::ColumnArrayTextEncodingNone;
693  return TExtArgumentType::ColumnArrayTextEncodingDict;
695  return TExtArgumentType::ColumnListArrayInt8;
697  return TExtArgumentType::ColumnListArrayInt16;
699  return TExtArgumentType::ColumnListArrayInt32;
701  return TExtArgumentType::ColumnListArrayInt64;
703  return TExtArgumentType::ColumnListArrayFloat;
705  return TExtArgumentType::ColumnListArrayDouble;
707  return TExtArgumentType::ColumnListArrayBool;
709  return TExtArgumentType::ColumnListArrayTextEncodingDict;
711  return TExtArgumentType::ColumnListArrayTextEncodingNone;
713  return TExtArgumentType::DayTimeInterval;
715  return TExtArgumentType::YearMonthTimeInterval;
717  return TExtArgumentType::ColumnGeoPoint;
719  return TExtArgumentType::ColumnGeoLineString;
721  return TExtArgumentType::ColumnGeoPolygon;
723  return TExtArgumentType::ColumnGeoMultiPoint;
725  return TExtArgumentType::ColumnGeoMultiLineString;
727  return TExtArgumentType::ColumnGeoMultiPolygon;
729  return TExtArgumentType::ColumnListGeoPoint;
731  return TExtArgumentType::ColumnListGeoLineString;
733  return TExtArgumentType::ColumnListGeoPolygon;
735  return TExtArgumentType::ColumnListGeoMultiPoint;
737  return TExtArgumentType::ColumnListGeoMultiLineString;
739  return TExtArgumentType::ColumnListGeoMultiPolygon;
740  }
741  UNREACHABLE();
742  return TExtArgumentType::type{};
743 }
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 756 of file ThriftSerializers.h.

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

757  {
758  std::vector<TExtArgumentType::type> result;
760  v.begin(),
761  v.end(),
762  std::back_inserter(result),
763  [](ExtArgumentType c) -> TExtArgumentType::type { return to_thrift(c); });
764  return result;
765 }
OUTPUT transform(INPUT const &input, FUNC const &func)
Definition: misc.h:329
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 785 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.

786  {
787  switch (t) {
789  return TOutputBufferSizeType::kConstant;
791  return TOutputBufferSizeType::kUserSpecifiedConstantParameter;
793  return TOutputBufferSizeType::kUserSpecifiedRowMultiplier;
795  return TOutputBufferSizeType::kTableFunctionSpecifiedParameter;
797  return TOutputBufferSizeType::kPreFlightParameter;
798  }
799  UNREACHABLE();
801 }
#define UNREACHABLE()
Definition: Logger.h:338
TUserDefinedFunction ThriftSerializers::to_thrift ( const ExtensionFunction udf)
inline

Definition at line 803 of file ThriftSerializers.h.

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

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

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

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

825  {
826  std::vector<TUserDefinedTableFunction> result;
827  std::transform(v.begin(),
828  v.end(),
829  std::back_inserter(result),
830  [](table_functions::TableFunction c) -> TUserDefinedTableFunction {
831  return to_thrift(c);
832  });
833  return result;
834 }
OUTPUT transform(INPUT const &input, FUNC const &func)
Definition: misc.h:329
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 181 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().

181  {
182  TTypeInfo thrift_ti;
183  thrift_ti.type =
185  thrift_ti.encoding = encoding_to_thrift(ti);
186  thrift_ti.nullable = !ti.get_notnull();
187  thrift_ti.is_array = ti.is_array();
188  // TODO: Properly serialize geospatial subtype. For now, the value in precision is the
189  // same as the value in scale; overload the precision field with the subtype of the
190  // geospatial type (currently kGEOMETRY or kGEOGRAPHY)
191  thrift_ti.precision =
192  IS_GEO(ti.get_type()) ? static_cast<int32_t>(ti.get_subtype()) : ti.get_precision();
193  thrift_ti.scale = ti.get_scale();
194  thrift_ti.comp_param = ti.get_comp_param();
195  thrift_ti.size = ti.get_size();
196 
197  if (ti.get_compression() == kENCODING_DICT) {
198  const auto& dict_key = ti.getStringDictKey();
199  TStringDictKey t_dict_key;
200  t_dict_key.db_id = dict_key.db_id;
201  t_dict_key.dict_id = dict_key.dict_id;
202  thrift_ti.__set_dict_key(t_dict_key);
203  }
204  return thrift_ti;
205 }
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:977
#define IS_GEO(T)
Definition: sqltypes.h:310
bool is_array() const
Definition: sqltypes.h:585
const shared::StringDictKey & getStringDictKey() const
Definition: sqltypes.h:1057
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: