OmniSciDB  6686921089
 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)
 
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 103 of file ThriftSerializers.h.

References AVG, CHECK, COUNT, MAX, MIN, SUM, and UNTHRIFT_AGGKIND_CASE.

Referenced by target_info_from_thrift().

103  {
104  switch (agg) {
106  UNTHRIFT_AGGKIND_CASE(COUNT)
110  UNTHRIFT_AGGKIND_CASE(APPROX_COUNT_DISTINCT)
111  UNTHRIFT_AGGKIND_CASE(SAMPLE)
112  UNTHRIFT_AGGKIND_CASE(SINGLE_VALUE)
113  default:
114  CHECK(false) << static_cast<int>(agg);
115  }
116  abort();
117 }
#define UNTHRIFT_AGGKIND_CASE(kind)
bool g_enable_watchdog false
Definition: Execute.cpp:76
#define CHECK(condition)
Definition: Logger.h:209

+ 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, MAX, MIN, SUM, 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  default:
92  CHECK(false) << static_cast<int>(agg);
93  }
94  abort();
95 }
bool g_enable_watchdog false
Definition: Execute.cpp:76
#define CHECK(condition)
Definition: Logger.h:209
#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 121 of file ThriftSerializers.h.

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

122  {
123  AggregatedColRange column_ranges;
124  for (const auto& thrift_column_range : thrift_column_ranges) {
125  PhysicalInput phys_input{thrift_column_range.col_id, thrift_column_range.table_id};
126  switch (thrift_column_range.type) {
128  column_ranges.setColRange(
129  phys_input,
130  ExpressionRange::makeIntRange(thrift_column_range.int_min,
131  thrift_column_range.int_max,
132  thrift_column_range.bucket,
133  thrift_column_range.has_nulls));
134  break;
136  column_ranges.setColRange(
137  phys_input,
138  ExpressionRange::makeFloatRange(thrift_column_range.fp_min,
139  thrift_column_range.fp_max,
140  thrift_column_range.has_nulls));
141  break;
143  column_ranges.setColRange(
144  phys_input,
145  ExpressionRange::makeDoubleRange(thrift_column_range.fp_min,
146  thrift_column_range.fp_max,
147  thrift_column_range.has_nulls));
148  break;
149  case TExpressionRangeType::INVALID:
150  column_ranges.setColRange(phys_input, ExpressionRange::makeInvalidRange());
151  break;
152  default:
153  CHECK(false);
154  }
155  }
156  return column_ranges;
157 }
#define DOUBLE
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:209
void setColRange(const PhysicalInput &, const ExpressionRange &)
static ExpressionRange makeInvalidRange()
#define FLOAT
#define INTEGER

+ 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 347 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.

348  {
349  CountDistinctDescriptor count_distinct_descriptor;
350  count_distinct_descriptor.impl_type_ =
351  count_distinct_impl_type_from_thrift(thrift_count_distinct_descriptor.impl_type);
352  count_distinct_descriptor.min_val = thrift_count_distinct_descriptor.min_val;
353  count_distinct_descriptor.bitmap_sz_bits =
354  thrift_count_distinct_descriptor.bitmap_sz_bits;
355  count_distinct_descriptor.approximate = thrift_count_distinct_descriptor.approximate;
356  count_distinct_descriptor.device_type =
357  thrift_count_distinct_descriptor.device_type == TDeviceType::GPU
360  count_distinct_descriptor.sub_bitmap_count =
361  thrift_count_distinct_descriptor.sub_bitmap_count;
362  return count_distinct_descriptor;
363 }
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 312 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.

313  {
314  TCountDistinctDescriptor thrift_count_distinct_descriptor;
315  thrift_count_distinct_descriptor.impl_type =
316  count_distinct_impl_type_to_thrift(count_distinct_descriptor.impl_type_);
317  thrift_count_distinct_descriptor.min_val = count_distinct_descriptor.min_val;
318  thrift_count_distinct_descriptor.bitmap_sz_bits =
319  count_distinct_descriptor.bitmap_sz_bits;
320  thrift_count_distinct_descriptor.approximate = count_distinct_descriptor.approximate;
321  thrift_count_distinct_descriptor.device_type =
322  count_distinct_descriptor.device_type == ExecutorDeviceType::GPU ? TDeviceType::GPU
323  : TDeviceType::CPU;
324  thrift_count_distinct_descriptor.sub_bitmap_count =
325  count_distinct_descriptor.sub_bitmap_count;
326  return thrift_count_distinct_descriptor;
327 }
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 333 of file ThriftSerializers.h.

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

Referenced by count_distinct_descriptor_from_thrift().

334  {
335  switch (impl_type) {
339  default:
340  CHECK(false);
341  }
342  abort();
343 }
#define UNTHRIFT_COUNTDESCRIPTORIMPL_CASE(kind)
bool g_enable_watchdog false
Definition: Execute.cpp:76
#define CHECK(condition)
Definition: Logger.h:209

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

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

Referenced by count_distinct_descriptor_to_thrift().

299  {
300  switch (impl_type) {
304  default:
305  CHECK(false);
306  }
307  abort();
308 }
#define THRIFT_COUNTDESCRIPTORIMPL_CASE(kind)
bool g_enable_watchdog false
Definition: Execute.cpp:76
#define CHECK(condition)
Definition: Logger.h:209

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

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

205  {
206  col_type.col_type.precision = static_cast<int>(subtype);
207  col_type.col_type.scale = output_srid;
208 }

+ Here is the caller graph for this function:

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

Definition at line 365 of file ThriftSerializers.h.

References ArrayBool, ArrayDouble, ArrayFloat, ArrayInt16, ArrayInt32, ArrayInt64, ArrayInt8, Bool, ColumnBool, ColumnDouble, ColumnFloat, ColumnInt16, ColumnInt32, ColumnInt64, ColumnInt8, ColumnListBool, ColumnListDouble, ColumnListFloat, ColumnListInt16, ColumnListInt32, ColumnListInt64, ColumnListInt8, ColumnListTextEncodingDict, ColumnTextEncodingDict, Cursor, Double, Float, GeoLineString, GeoMultiPolygon, GeoPoint, GeoPolygon, Int16, Int32, Int64, Int8, PBool, PDouble, PFloat, PInt16, PInt32, PInt64, PInt8, TextEncodingDict, TextEncodingNone, UNREACHABLE, and Void.

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

365  {
366  switch (t) {
367  case TExtArgumentType::Int8:
368  return ExtArgumentType::Int8;
369  case TExtArgumentType::Int16:
370  return ExtArgumentType::Int16;
371  case TExtArgumentType::Int32:
372  return ExtArgumentType::Int32;
373  case TExtArgumentType::Int64:
374  return ExtArgumentType::Int64;
375  case TExtArgumentType::Float:
376  return ExtArgumentType::Float;
379  case TExtArgumentType::Void:
380  return ExtArgumentType::Void;
381  case TExtArgumentType::PInt8:
382  return ExtArgumentType::PInt8;
383  case TExtArgumentType::PInt16:
385  case TExtArgumentType::PInt32:
387  case TExtArgumentType::PInt64:
389  case TExtArgumentType::PFloat:
391  case TExtArgumentType::PDouble:
393  case TExtArgumentType::PBool:
394  return ExtArgumentType::PBool;
395  case TExtArgumentType::Bool:
396  return ExtArgumentType::Bool;
397  case TExtArgumentType::ArrayInt8:
399  case TExtArgumentType::ArrayInt16:
401  case TExtArgumentType::ArrayInt32:
403  case TExtArgumentType::ArrayInt64:
405  case TExtArgumentType::ArrayFloat:
407  case TExtArgumentType::ArrayDouble:
409  case TExtArgumentType::ArrayBool:
411  case TExtArgumentType::GeoPoint:
413  case TExtArgumentType::GeoLineString:
415  case TExtArgumentType::Cursor:
417  case TExtArgumentType::GeoPolygon:
419  case TExtArgumentType::GeoMultiPolygon:
421  case TExtArgumentType::ColumnInt8:
423  case TExtArgumentType::ColumnInt16:
425  case TExtArgumentType::ColumnInt32:
427  case TExtArgumentType::ColumnInt64:
429  case TExtArgumentType::ColumnFloat:
431  case TExtArgumentType::ColumnDouble:
433  case TExtArgumentType::ColumnBool:
435  case TExtArgumentType::ColumnTextEncodingDict:
437  case TExtArgumentType::TextEncodingNone:
439  case TExtArgumentType::TextEncodingDict:
441  case TExtArgumentType::ColumnListInt8:
443  case TExtArgumentType::ColumnListInt16:
445  case TExtArgumentType::ColumnListInt32:
447  case TExtArgumentType::ColumnListInt64:
449  case TExtArgumentType::ColumnListFloat:
451  case TExtArgumentType::ColumnListDouble:
453  case TExtArgumentType::ColumnListBool:
455  case TExtArgumentType::ColumnListTextEncodingDict:
457  }
458  UNREACHABLE();
459  return ExtArgumentType{};
460 }
#define UNREACHABLE()
Definition: Logger.h:253
char * t

+ Here is the caller graph for this function:

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

Definition at line 559 of file ThriftSerializers.h.

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

560  {
561  std::vector<ExtArgumentType> result;
562  std::transform(
563  v.begin(),
564  v.end(),
565  std::back_inserter(result),
566  [](TExtArgumentType::type c) -> ExtArgumentType { return from_thrift(c); });
567  return result;
568 }
ExtArgumentType from_thrift(const TExtArgumentType::type &t)

+ Here is the call graph for this function:

table_functions::OutputBufferSizeType ThriftSerializers::from_thrift ( const TOutputBufferSizeType::type &  t)
inline
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:76
#define CHECK(condition)
Definition: Logger.h:209
#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:76
#define CHECK(condition)
Definition: Logger.h:209
#define THRIFT_LAYOUT_CASE(layout)
StringDictionaryGenerations ThriftSerializers::string_dictionary_generations_from_thrift ( const std::vector< TDictionaryGeneration > &  thrift_string_dictionary_generations)
inline

Definition at line 159 of file ThriftSerializers.h.

References StringDictionaryGenerations::setGeneration().

160  {
161  StringDictionaryGenerations string_dictionary_generations;
162  for (const auto& thrift_string_dictionary_generation :
163  thrift_string_dictionary_generations) {
164  string_dictionary_generations.setGeneration(
165  thrift_string_dictionary_generation.dict_id,
166  thrift_string_dictionary_generation.entry_count);
167  }
168  return string_dictionary_generations;
169 }
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 189 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().

189  {
190  return target_info.is_agg &&
191  (target_info.agg_kind != kCOUNT || is_distinct_target(target_info));
192 }
bool is_agg
Definition: TargetInfo.h:49
bool is_distinct_target(const TargetInfo &target_info)
Definition: TargetInfo.h:153
SQLAgg agg_kind
Definition: TargetInfo.h:50
Definition: sqldefs.h:76

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

263  {
264  TargetInfo target_info;
265  target_info.is_agg = thrift_target_info.is_agg;
266  target_info.agg_kind = agg_kind_from_thrift(thrift_target_info.kind);
267  target_info.sql_type = type_info_from_thrift(thrift_target_info.type);
268  target_info.is_distinct = thrift_target_info.is_distinct;
269  target_info.agg_arg_type = takes_arg(target_info)
270  ? type_info_from_thrift(thrift_target_info.arg_type)
272  target_info.skip_null_val = thrift_target_info.skip_nulls;
273  return target_info;
274 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:51
bool skip_null_val
Definition: TargetInfo.h:53
SQLTypeInfo agg_arg_type
Definition: TargetInfo.h:52
bool is_agg
Definition: TargetInfo.h:49
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:50
bool takes_arg(const TargetInfo &target_info)
bool g_enable_watchdog false
Definition: Execute.cpp:76
bool is_distinct
Definition: TargetInfo.h:54

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

250  {
251  TTargetInfo thrift_target_info;
252  thrift_target_info.is_agg = target_info.is_agg;
253  thrift_target_info.kind = agg_kind_to_thrift(target_info.agg_kind);
254  thrift_target_info.type = type_info_to_thrift(target_info.sql_type);
255  thrift_target_info.arg_type = takes_arg(target_info)
256  ? type_info_to_thrift(target_info.agg_arg_type)
257  : thrift_target_info.type;
258  thrift_target_info.skip_nulls = target_info.skip_null_val;
259  thrift_target_info.is_distinct = target_info.is_distinct;
260  return thrift_target_info;
261 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:51
bool skip_null_val
Definition: TargetInfo.h:53
SQLTypeInfo agg_arg_type
Definition: TargetInfo.h:52
bool is_agg
Definition: TargetInfo.h:49
SQLAgg agg_kind
Definition: TargetInfo.h:50
bool takes_arg(const TargetInfo &target_info)
TAggKind::type agg_kind_to_thrift(const SQLAgg agg)
bool is_distinct
Definition: TargetInfo.h:54
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 285 of file ThriftSerializers.h.

References target_info_from_thrift().

286  {
287  std::vector<TargetInfo> targets;
288  for (const auto& thrift_target_info : thrift_targets) {
289  targets.push_back(target_info_from_thrift(thrift_target_info));
290  }
291  return targets;
292 }
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 276 of file ThriftSerializers.h.

References target_info_to_thrift().

277  {
278  std::vector<TTargetInfo> thrift_targets;
279  for (const auto& target_info : targets) {
280  thrift_targets.push_back(target_info_to_thrift(target_info));
281  }
282  return thrift_targets;
283 }
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 210 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().

211  {
212  TColumnType proj_info;
213  proj_info.col_name = target.get_resname();
214  if (proj_info.col_name.empty()) {
215  proj_info.col_name = "result_" + std::to_string(idx + 1);
216  }
217  const auto& target_ti = target.get_type_info();
218  proj_info.col_type.type = type_to_thrift(target_ti);
219  proj_info.col_type.encoding = encoding_to_thrift(target_ti);
220  proj_info.col_type.nullable = !target_ti.get_notnull();
221  proj_info.col_type.is_array = target_ti.get_type() == kARRAY;
222  if (IS_GEO(target_ti.get_type())) {
224  proj_info, target_ti.get_subtype(), target_ti.get_output_srid());
225  } else {
226  proj_info.col_type.precision = target_ti.get_precision();
227  proj_info.col_type.scale = target_ti.get_scale();
228  }
229  if (target_ti.get_type() == kDATE) {
230  proj_info.col_type.size = target_ti.get_size();
231  }
232  proj_info.col_type.comp_param =
233  (target_ti.is_date_in_days() && target_ti.get_comp_param() == 0)
234  ? 32
235  : target_ti.get_comp_param();
236  return proj_info;
237 }
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:53
SQLTypes type
Definition: sqltypes.h:883
const std::string & get_resname() const
#define IS_GEO(T)
Definition: sqltypes.h:251
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 194 of file ThriftSerializers.h.

References type_info_from_thrift().

195  {
196  std::vector<TargetMetaInfo> target_meta_infos;
197  for (const auto& col : row_desc) {
198  target_meta_infos.emplace_back(col.col_name, type_info_from_thrift(col.col_type));
199  }
200  return target_meta_infos;
201 }
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 239 of file ThriftSerializers.h.

References i, and target_meta_info_to_thrift().

Referenced by DBHandler::convertRows().

240  {
241  TRowDescriptor row_desc;
242  size_t i = 0;
243  for (const auto& target : targets) {
244  row_desc.push_back(target_meta_info_to_thrift(target, i));
245  ++i;
246  }
247  return row_desc;
248 }
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 462 of file ThriftSerializers.h.

References ArrayBool, ArrayDouble, ArrayFloat, ArrayInt16, ArrayInt32, ArrayInt64, ArrayInt8, Bool, ColumnBool, ColumnDouble, ColumnFloat, ColumnInt16, ColumnInt32, ColumnInt64, ColumnInt8, ColumnListBool, ColumnListDouble, ColumnListFloat, ColumnListInt16, ColumnListInt32, ColumnListInt64, ColumnListInt8, ColumnListTextEncodingDict, ColumnTextEncodingDict, Cursor, Double, Float, GeoLineString, GeoMultiPolygon, GeoPoint, GeoPolygon, Int16, Int32, Int64, Int8, PBool, PDouble, PFloat, PInt16, PInt32, PInt64, PInt8, TextEncodingDict, TextEncodingNone, run_benchmark_import::type, UNREACHABLE, and Void.

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

462  {
463  switch (t) {
465  return TExtArgumentType::Int8;
467  return TExtArgumentType::Int16;
469  return TExtArgumentType::Int32;
471  return TExtArgumentType::Int64;
473  return TExtArgumentType::Float;
477  return TExtArgumentType::Void;
479  return TExtArgumentType::PInt8;
481  return TExtArgumentType::PInt16;
483  return TExtArgumentType::PInt32;
485  return TExtArgumentType::PInt64;
487  return TExtArgumentType::PFloat;
489  return TExtArgumentType::PDouble;
491  return TExtArgumentType::PBool;
493  return TExtArgumentType::Bool;
495  return TExtArgumentType::ArrayInt8;
497  return TExtArgumentType::ArrayInt16;
499  return TExtArgumentType::ArrayInt32;
501  return TExtArgumentType::ArrayInt64;
503  return TExtArgumentType::ArrayFloat;
505  return TExtArgumentType::ArrayDouble;
507  return TExtArgumentType::ArrayBool;
509  return TExtArgumentType::GeoPoint;
511  return TExtArgumentType::GeoLineString;
513  return TExtArgumentType::Cursor;
515  return TExtArgumentType::GeoPolygon;
517  return TExtArgumentType::GeoMultiPolygon;
519  return TExtArgumentType::ColumnInt8;
521  return TExtArgumentType::ColumnInt16;
523  return TExtArgumentType::ColumnInt32;
525  return TExtArgumentType::ColumnInt64;
527  return TExtArgumentType::ColumnFloat;
529  return TExtArgumentType::ColumnDouble;
531  return TExtArgumentType::ColumnBool;
533  return TExtArgumentType::ColumnTextEncodingDict;
535  return TExtArgumentType::TextEncodingNone;
537  return TExtArgumentType::TextEncodingDict;
539  return TExtArgumentType::ColumnListInt8;
541  return TExtArgumentType::ColumnListInt16;
543  return TExtArgumentType::ColumnListInt32;
545  return TExtArgumentType::ColumnListInt64;
547  return TExtArgumentType::ColumnListFloat;
549  return TExtArgumentType::ColumnListDouble;
551  return TExtArgumentType::ColumnListBool;
553  return TExtArgumentType::ColumnListTextEncodingDict;
554  }
555  UNREACHABLE();
556  return TExtArgumentType::type{};
557 }
#define UNREACHABLE()
Definition: Logger.h:253
char * t

+ Here is the caller graph for this function:

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

Definition at line 570 of file ThriftSerializers.h.

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

571  {
572  std::vector<TExtArgumentType::type> result;
573  std::transform(
574  v.begin(),
575  v.end(),
576  std::back_inserter(result),
577  [](ExtArgumentType c) -> TExtArgumentType::type { return to_thrift(c); });
578  return result;
579 }
TExtArgumentType::type to_thrift(const ExtArgumentType &t)

+ Here is the call graph for this function:

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

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

613  {
614  TUserDefinedTableFunction tfunc;
615  tfunc.name = func.getName();
616  tfunc.sizerType = to_thrift(func.getOutputRowSizeType());
617  tfunc.sizerArgPos = func.getOutputRowSizeParameter();
618  tfunc.inputArgTypes = to_thrift(func.getInputArgs());
619  tfunc.outputArgTypes = to_thrift(func.getOutputArgs());
620  tfunc.sqlArgTypes = to_thrift(func.getSqlArgs());
621  tfunc.annotations = func.getAnnotations();
622  return tfunc;
623 }
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 625 of file ThriftSerializers.h.

References run_benchmark_import::result, and to_thrift().

626  {
627  std::vector<TUserDefinedTableFunction> result;
628  std::transform(v.begin(),
629  v.end(),
630  std::back_inserter(result),
631  [](table_functions::TableFunction c) -> TUserDefinedTableFunction {
632  return to_thrift(c);
633  });
634  return result;
635 }
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 171 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().

171  {
172  TTypeInfo thrift_ti;
173  thrift_ti.type =
175  thrift_ti.encoding = encoding_to_thrift(ti);
176  thrift_ti.nullable = !ti.get_notnull();
177  thrift_ti.is_array = ti.is_array();
178  // TODO: Properly serialize geospatial subtype. For now, the value in precision is the
179  // same as the value in scale; overload the precision field with the subtype of the
180  // geospatial type (currently kGEOMETRY or kGEOGRAPHY)
181  thrift_ti.precision =
182  IS_GEO(ti.get_type()) ? static_cast<int32_t>(ti.get_subtype()) : ti.get_precision();
183  thrift_ti.scale = ti.get_scale();
184  thrift_ti.comp_param = ti.get_comp_param();
185  thrift_ti.size = ti.get_size();
186  return thrift_ti;
187 }
HOST DEVICE SQLTypes get_subtype() const
Definition: sqltypes.h:330
HOST DEVICE int get_size() const
Definition: sqltypes.h:339
TDatumType::type type_to_thrift(const SQLTypeInfo &type_info)
HOST DEVICE int get_scale() const
Definition: sqltypes.h:334
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:329
int get_precision() const
Definition: sqltypes.h:332
HOST DEVICE int get_comp_param() const
Definition: sqltypes.h:338
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:336
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:850
#define IS_GEO(T)
Definition: sqltypes.h:251
bool is_array() const
Definition: sqltypes.h:517
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: