OmniSciDB  dfae7c3b14
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)
 
TTypeInfo type_info_to_thrift (const SQLTypeInfo &ti)
 
bool takes_arg (const TargetInfo &target_info)
 
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)
 

Function Documentation

◆ agg_kind_from_thrift()

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

Definition at line 98 of file ThriftSerializers.h.

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

Referenced by target_info_from_thrift().

98  {
99  switch (agg) {
101  UNTHRIFT_AGGKIND_CASE(COUNT)
105  UNTHRIFT_AGGKIND_CASE(APPROX_COUNT_DISTINCT)
106  UNTHRIFT_AGGKIND_CASE(SAMPLE)
107  default:
108  CHECK(false);
109  }
110  abort();
111 }
#define UNTHRIFT_AGGKIND_CASE(kind)
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the caller graph for this function:

◆ agg_kind_to_thrift()

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

Definition at line 77 of file ThriftSerializers.h.

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

Referenced by target_info_to_thrift().

77  {
78  switch (agg) {
80  THRIFT_AGGKIND_CASE(COUNT)
84  THRIFT_AGGKIND_CASE(APPROX_COUNT_DISTINCT)
85  THRIFT_AGGKIND_CASE(SAMPLE)
86  default:
87  CHECK(false);
88  }
89  abort();
90 }
#define CHECK(condition)
Definition: Logger.h:197
#define THRIFT_AGGKIND_CASE(kind)
+ Here is the caller graph for this function:

◆ count_distinct_descriptor_from_thrift()

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

Definition at line 235 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.

236  {
237  CountDistinctDescriptor count_distinct_descriptor;
238  count_distinct_descriptor.impl_type_ =
239  count_distinct_impl_type_from_thrift(thrift_count_distinct_descriptor.impl_type);
240  count_distinct_descriptor.min_val = thrift_count_distinct_descriptor.min_val;
241  count_distinct_descriptor.bitmap_sz_bits =
242  thrift_count_distinct_descriptor.bitmap_sz_bits;
243  count_distinct_descriptor.approximate = thrift_count_distinct_descriptor.approximate;
244  count_distinct_descriptor.device_type =
245  thrift_count_distinct_descriptor.device_type == TDeviceType::GPU
248  count_distinct_descriptor.sub_bitmap_count =
249  thrift_count_distinct_descriptor.sub_bitmap_count;
250  return count_distinct_descriptor;
251 }
CountDistinctImplType impl_type_
CountDistinctImplType count_distinct_impl_type_from_thrift(const TCountDistinctImplType::type impl_type)
+ Here is the call graph for this function:

◆ count_distinct_descriptor_to_thrift()

TCountDistinctDescriptor ThriftSerializers::count_distinct_descriptor_to_thrift ( const CountDistinctDescriptor count_distinct_descriptor)
inline

Definition at line 200 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.

201  {
202  TCountDistinctDescriptor thrift_count_distinct_descriptor;
203  thrift_count_distinct_descriptor.impl_type =
204  count_distinct_impl_type_to_thrift(count_distinct_descriptor.impl_type_);
205  thrift_count_distinct_descriptor.min_val = count_distinct_descriptor.min_val;
206  thrift_count_distinct_descriptor.bitmap_sz_bits =
207  count_distinct_descriptor.bitmap_sz_bits;
208  thrift_count_distinct_descriptor.approximate = count_distinct_descriptor.approximate;
209  thrift_count_distinct_descriptor.device_type =
210  count_distinct_descriptor.device_type == ExecutorDeviceType::GPU ? TDeviceType::GPU
211  : TDeviceType::CPU;
212  thrift_count_distinct_descriptor.sub_bitmap_count =
213  count_distinct_descriptor.sub_bitmap_count;
214  return thrift_count_distinct_descriptor;
215 }
TCountDistinctImplType::type count_distinct_impl_type_to_thrift(const CountDistinctImplType impl_type)
CountDistinctImplType impl_type_
+ Here is the call graph for this function:

◆ count_distinct_impl_type_from_thrift()

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

Definition at line 221 of file ThriftSerializers.h.

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

Referenced by count_distinct_descriptor_from_thrift().

222  {
223  switch (impl_type) {
227  default:
228  CHECK(false);
229  }
230  abort();
231 }
#define UNTHRIFT_COUNTDESCRIPTORIMPL_CASE(kind)
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the caller graph for this function:

◆ count_distinct_impl_type_to_thrift()

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

Definition at line 186 of file ThriftSerializers.h.

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

Referenced by count_distinct_descriptor_to_thrift().

187  {
188  switch (impl_type) {
192  default:
193  CHECK(false);
194  }
195  abort();
196 }
#define THRIFT_COUNTDESCRIPTORIMPL_CASE(kind)
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the caller graph for this function:

◆ layout_from_thrift()

QueryDescriptionType ThriftSerializers::layout_from_thrift ( const TResultSetLayout::type  layout)
inline

Definition at line 59 of file ThriftSerializers.h.

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

59  {
60  switch (layout) {
61  UNTHRIFT_LAYOUT_CASE(GroupByPerfectHash)
62  UNTHRIFT_LAYOUT_CASE(GroupByBaselineHash)
63  UNTHRIFT_LAYOUT_CASE(Projection)
64  UNTHRIFT_LAYOUT_CASE(NonGroupedAggregate)
65  default:
66  CHECK(false);
67  }
68  abort();
69 }
#define CHECK(condition)
Definition: Logger.h:197
#define UNTHRIFT_LAYOUT_CASE(layout)

◆ layout_to_thrift()

TResultSetLayout::type ThriftSerializers::layout_to_thrift ( const QueryDescriptionType  layout)
inline

Definition at line 41 of file ThriftSerializers.h.

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

41  {
42  switch (layout) {
43  THRIFT_LAYOUT_CASE(GroupByPerfectHash)
44  THRIFT_LAYOUT_CASE(GroupByBaselineHash)
45  THRIFT_LAYOUT_CASE(Projection)
46  THRIFT_LAYOUT_CASE(NonGroupedAggregate)
47  default:
48  CHECK(false);
49  }
50  abort();
51 }
#define CHECK(condition)
Definition: Logger.h:197
#define THRIFT_LAYOUT_CASE(layout)

◆ takes_arg()

bool ThriftSerializers::takes_arg ( const TargetInfo target_info)
inline

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

133  {
134  return target_info.is_agg &&
135  (target_info.agg_kind != kCOUNT || is_distinct_target(target_info));
136 }
bool is_agg
Definition: TargetInfo.h:40
bool is_distinct_target(const TargetInfo &target_info)
Definition: TargetInfo.h:129
SQLAgg agg_kind
Definition: TargetInfo.h:41
Definition: sqldefs.h:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ target_info_from_thrift()

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

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

151  {
152  TargetInfo target_info;
153  target_info.is_agg = thrift_target_info.is_agg;
154  target_info.agg_kind = agg_kind_from_thrift(thrift_target_info.kind);
155  target_info.sql_type = type_info_from_thrift(thrift_target_info.type);
156  target_info.is_distinct = thrift_target_info.is_distinct;
157  target_info.agg_arg_type = takes_arg(target_info)
158  ? type_info_from_thrift(thrift_target_info.arg_type)
159  : SQLTypeInfo(kNULLT, false);
160  target_info.skip_null_val = thrift_target_info.skip_nulls;
161  return target_info;
162 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:42
bool skip_null_val
Definition: TargetInfo.h:44
SQLTypeInfo agg_arg_type
Definition: TargetInfo.h:43
bool is_agg
Definition: TargetInfo.h:40
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:41
bool takes_arg(const TargetInfo &target_info)
bool is_distinct
Definition: TargetInfo.h:45
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ target_info_to_thrift()

TTargetInfo ThriftSerializers::target_info_to_thrift ( const TargetInfo target_info)
inline

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

138  {
139  TTargetInfo thrift_target_info;
140  thrift_target_info.is_agg = target_info.is_agg;
141  thrift_target_info.kind = agg_kind_to_thrift(target_info.agg_kind);
142  thrift_target_info.type = type_info_to_thrift(target_info.sql_type);
143  thrift_target_info.arg_type = takes_arg(target_info)
144  ? type_info_to_thrift(target_info.agg_arg_type)
145  : thrift_target_info.type;
146  thrift_target_info.skip_nulls = target_info.skip_null_val;
147  thrift_target_info.is_distinct = target_info.is_distinct;
148  return thrift_target_info;
149 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:42
bool skip_null_val
Definition: TargetInfo.h:44
SQLTypeInfo agg_arg_type
Definition: TargetInfo.h:43
bool is_agg
Definition: TargetInfo.h:40
SQLAgg agg_kind
Definition: TargetInfo.h:41
bool takes_arg(const TargetInfo &target_info)
TAggKind::type agg_kind_to_thrift(const SQLAgg agg)
bool is_distinct
Definition: TargetInfo.h:45
TTypeInfo type_info_to_thrift(const SQLTypeInfo &ti)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ target_infos_from_thrift()

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

Definition at line 173 of file ThriftSerializers.h.

References target_info_from_thrift().

174  {
175  std::vector<TargetInfo> targets;
176  for (const auto& thrift_target_info : thrift_targets) {
177  targets.push_back(target_info_from_thrift(thrift_target_info));
178  }
179  return targets;
180 }
TargetInfo target_info_from_thrift(const TTargetInfo &thrift_target_info)
+ Here is the call graph for this function:

◆ target_infos_to_thrift()

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

Definition at line 164 of file ThriftSerializers.h.

References target_info_to_thrift().

165  {
166  std::vector<TTargetInfo> thrift_targets;
167  for (const auto& target_info : targets) {
168  thrift_targets.push_back(target_info_to_thrift(target_info));
169  }
170  return thrift_targets;
171 }
TTargetInfo target_info_to_thrift(const TargetInfo &target_info)
+ Here is the call graph for this function:

◆ type_info_to_thrift()

TTypeInfo ThriftSerializers::type_info_to_thrift ( const SQLTypeInfo ti)
inline

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

115  {
116  TTypeInfo thrift_ti;
117  thrift_ti.type =
119  thrift_ti.encoding = encoding_to_thrift(ti);
120  thrift_ti.nullable = !ti.get_notnull();
121  thrift_ti.is_array = ti.is_array();
122  // TODO: Properly serialize geospatial subtype. For now, the value in precision is the
123  // same as the value in scale; overload the precision field with the subtype of the
124  // geospatial type (currently kGEOMETRY or kGEOGRAPHY)
125  thrift_ti.precision =
126  IS_GEO(ti.get_type()) ? static_cast<int32_t>(ti.get_subtype()) : ti.get_precision();
127  thrift_ti.scale = ti.get_scale();
128  thrift_ti.comp_param = ti.get_comp_param();
129  thrift_ti.size = ti.get_size();
130  return thrift_ti;
131 }
bool is_array() const
Definition: sqltypes.h:425
int get_precision() const
Definition: sqltypes.h:262
TDatumType::type type_to_thrift(const SQLTypeInfo &type_info)
HOST DEVICE int get_comp_param() const
Definition: sqltypes.h:268
HOST DEVICE int get_size() const
Definition: sqltypes.h:269
HOST DEVICE int get_scale() const
Definition: sqltypes.h:264
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:266
HOST DEVICE SQLTypes get_subtype() const
Definition: sqltypes.h:260
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:624
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:259
#define IS_GEO(T)
Definition: sqltypes.h:174
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: