OmniSciDB  b28c0d5765
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ThriftSerializers.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
23 #ifndef QUERYENGINE_THRIFTSERIALIZERS_H
24 #define QUERYENGINE_THRIFTSERIALIZERS_H
25 
26 #include "gen-cpp/serialized_result_set_types.h"
27 
28 #include "Logger/Logger.h"
38 
39 namespace ThriftSerializers {
40 
41 #define THRIFT_LAYOUT_CASE(layout) \
42  case QueryDescriptionType::layout: \
43  return TResultSetLayout::layout;
44 
46  switch (layout) {
51  default:
52  CHECK(false) << static_cast<int>(layout);
53  }
54  abort();
55 }
56 
57 #undef THRIFT_LAYOUT_CASE
58 
59 #define UNTHRIFT_LAYOUT_CASE(layout) \
60  case TResultSetLayout::layout: \
61  return QueryDescriptionType::layout;
62 
64  switch (layout) {
69  default:
70  CHECK(false) << static_cast<int>(layout);
71  }
72  abort();
73 }
74 
75 #undef UNTHRIFT_LAYOUT_CASE
76 
77 #define THRIFT_AGGKIND_CASE(kind) \
78  case k##kind: \
79  return TAggKind::kind;
80 
82  switch (agg) {
88  THRIFT_AGGKIND_CASE(APPROX_COUNT_DISTINCT)
89  THRIFT_AGGKIND_CASE(SAMPLE)
90  THRIFT_AGGKIND_CASE(SINGLE_VALUE)
92  default:
93  CHECK(false) << static_cast<int>(agg);
94  }
95  abort();
96 }
97 
98 #undef THRIFT_AGGKIND_CASE
99 
100 #define UNTHRIFT_AGGKIND_CASE(kind) \
101  case TAggKind::kind: \
102  return k##kind;
103 
105  switch (agg) {
111  UNTHRIFT_AGGKIND_CASE(APPROX_COUNT_DISTINCT)
112  UNTHRIFT_AGGKIND_CASE(SAMPLE)
113  UNTHRIFT_AGGKIND_CASE(SINGLE_VALUE)
115  default:
116  CHECK(false) << static_cast<int>(agg);
117  }
118  abort();
119 }
120 
121 #undef UNTHRIFT_AGGKIND_CASE
122 
124  const std::vector<TColumnRange>& thrift_column_ranges) {
125  AggregatedColRange column_ranges;
126  for (const auto& thrift_column_range : thrift_column_ranges) {
127  PhysicalInput phys_input{thrift_column_range.col_id, thrift_column_range.table_id};
128  switch (thrift_column_range.type) {
129  case TExpressionRangeType::INTEGER:
130  column_ranges.setColRange(
131  phys_input,
132  ExpressionRange::makeIntRange(thrift_column_range.int_min,
133  thrift_column_range.int_max,
134  thrift_column_range.bucket,
135  thrift_column_range.has_nulls));
136  break;
137  case TExpressionRangeType::FLOAT:
138  column_ranges.setColRange(
139  phys_input,
140  ExpressionRange::makeFloatRange(thrift_column_range.fp_min,
141  thrift_column_range.fp_max,
142  thrift_column_range.has_nulls));
143  break;
144  case TExpressionRangeType::DOUBLE:
145  column_ranges.setColRange(
146  phys_input,
147  ExpressionRange::makeDoubleRange(thrift_column_range.fp_min,
148  thrift_column_range.fp_max,
149  thrift_column_range.has_nulls));
150  break;
152  column_ranges.setColRange(phys_input, ExpressionRange::makeInvalidRange());
153  break;
154  default:
155  CHECK(false);
156  }
157  }
158  return column_ranges;
159 }
160 
162  const std::vector<TDictionaryGeneration>& thrift_string_dictionary_generations) {
163  StringDictionaryGenerations string_dictionary_generations;
164  for (const auto& thrift_string_dictionary_generation :
165  thrift_string_dictionary_generations) {
166  string_dictionary_generations.setGeneration(
167  thrift_string_dictionary_generation.dict_id,
168  thrift_string_dictionary_generation.entry_count);
169  }
170  return string_dictionary_generations;
171 }
172 
173 inline TTypeInfo type_info_to_thrift(const SQLTypeInfo& ti) {
174  TTypeInfo thrift_ti;
175  thrift_ti.type =
177  thrift_ti.encoding = encoding_to_thrift(ti);
178  thrift_ti.nullable = !ti.get_notnull();
179  thrift_ti.is_array = ti.is_array();
180  // TODO: Properly serialize geospatial subtype. For now, the value in precision is the
181  // same as the value in scale; overload the precision field with the subtype of the
182  // geospatial type (currently kGEOMETRY or kGEOGRAPHY)
183  thrift_ti.precision =
184  IS_GEO(ti.get_type()) ? static_cast<int32_t>(ti.get_subtype()) : ti.get_precision();
185  thrift_ti.scale = ti.get_scale();
186  thrift_ti.comp_param = ti.get_comp_param();
187  thrift_ti.size = ti.get_size();
188  return thrift_ti;
189 }
190 
191 inline bool takes_arg(const TargetInfo& target_info) {
192  return target_info.is_agg &&
193  (target_info.agg_kind != kCOUNT || is_distinct_target(target_info));
194 }
195 
196 inline std::vector<TargetMetaInfo> target_meta_infos_from_thrift(
197  const TRowDescriptor& row_desc) {
198  std::vector<TargetMetaInfo> target_meta_infos;
199  for (const auto& col : row_desc) {
200  target_meta_infos.emplace_back(col.col_name, type_info_from_thrift(col.col_type));
201  }
202  return target_meta_infos;
203 }
204 
205 inline void fixup_geo_column_descriptor(TColumnType& col_type,
206  const SQLTypes subtype,
207  const int output_srid) {
208  col_type.col_type.precision = static_cast<int>(subtype);
209  col_type.col_type.scale = output_srid;
210 }
211 
212 inline TColumnType target_meta_info_to_thrift(const TargetMetaInfo& target,
213  const size_t idx) {
214  TColumnType proj_info;
215  proj_info.col_name = target.get_resname();
216  if (proj_info.col_name.empty()) {
217  proj_info.col_name = "result_" + std::to_string(idx + 1);
218  }
219  const auto& target_ti = target.get_type_info();
220  proj_info.col_type.type = type_to_thrift(target_ti);
221  proj_info.col_type.encoding = encoding_to_thrift(target_ti);
222  proj_info.col_type.nullable = !target_ti.get_notnull();
223  proj_info.col_type.is_array = target_ti.get_type() == kARRAY;
224  if (IS_GEO(target_ti.get_type())) {
226  proj_info, target_ti.get_subtype(), target_ti.get_output_srid());
227  } else {
228  proj_info.col_type.precision = target_ti.get_precision();
229  proj_info.col_type.scale = target_ti.get_scale();
230  }
231  if (target_ti.get_type() == kDATE) {
232  proj_info.col_type.size = target_ti.get_size();
233  }
234  proj_info.col_type.comp_param =
235  (target_ti.is_date_in_days() && target_ti.get_comp_param() == 0)
236  ? 32
237  : target_ti.get_comp_param();
238  return proj_info;
239 }
240 
241 inline TRowDescriptor target_meta_infos_to_thrift(
242  const std::vector<TargetMetaInfo>& targets) {
243  TRowDescriptor row_desc;
244  size_t i = 0;
245  for (const auto& target : targets) {
246  row_desc.push_back(target_meta_info_to_thrift(target, i));
247  ++i;
248  }
249  return row_desc;
250 }
251 
252 inline TTargetInfo target_info_to_thrift(const TargetInfo& target_info) {
253  TTargetInfo thrift_target_info;
254  thrift_target_info.is_agg = target_info.is_agg;
255  thrift_target_info.kind = agg_kind_to_thrift(target_info.agg_kind);
256  thrift_target_info.type = type_info_to_thrift(target_info.sql_type);
257  thrift_target_info.arg_type = takes_arg(target_info)
258  ? type_info_to_thrift(target_info.agg_arg_type)
259  : thrift_target_info.type;
260  thrift_target_info.skip_nulls = target_info.skip_null_val;
261  thrift_target_info.is_distinct = target_info.is_distinct;
262  return thrift_target_info;
263 }
264 
265 inline TargetInfo target_info_from_thrift(const TTargetInfo& thrift_target_info) {
266  TargetInfo target_info;
267  target_info.is_agg = thrift_target_info.is_agg;
268  target_info.agg_kind = agg_kind_from_thrift(thrift_target_info.kind);
269  target_info.sql_type = type_info_from_thrift(thrift_target_info.type);
270  target_info.is_distinct = thrift_target_info.is_distinct;
271  target_info.agg_arg_type = takes_arg(target_info)
272  ? type_info_from_thrift(thrift_target_info.arg_type)
273  : SQLTypeInfo(kNULLT, false);
274  target_info.skip_null_val = thrift_target_info.skip_nulls;
275  return target_info;
276 }
277 
278 inline std::vector<TTargetInfo> target_infos_to_thrift(
279  const std::vector<TargetInfo>& targets) {
280  std::vector<TTargetInfo> thrift_targets;
281  for (const auto& target_info : targets) {
282  thrift_targets.push_back(target_info_to_thrift(target_info));
283  }
284  return thrift_targets;
285 }
286 
287 inline std::vector<TargetInfo> target_infos_from_thrift(
288  const std::vector<TTargetInfo>& thrift_targets) {
289  std::vector<TargetInfo> targets;
290  for (const auto& thrift_target_info : thrift_targets) {
291  targets.push_back(target_info_from_thrift(thrift_target_info));
292  }
293  return targets;
294 }
295 
296 #define THRIFT_COUNTDESCRIPTORIMPL_CASE(kind) \
297  case CountDistinctImplType::kind: \
298  return TCountDistinctImplType::kind;
299 
301  const CountDistinctImplType impl_type) {
302  switch (impl_type) {
306  default:
307  CHECK(false);
308  }
309  abort();
310 }
311 
312 #undef THRIFT_COUNTDESCRIPTORIMPL_CASE
313 
314 inline TCountDistinctDescriptor count_distinct_descriptor_to_thrift(
315  const CountDistinctDescriptor& count_distinct_descriptor) {
316  TCountDistinctDescriptor thrift_count_distinct_descriptor;
317  thrift_count_distinct_descriptor.impl_type =
318  count_distinct_impl_type_to_thrift(count_distinct_descriptor.impl_type_);
319  thrift_count_distinct_descriptor.min_val = count_distinct_descriptor.min_val;
320  thrift_count_distinct_descriptor.bitmap_sz_bits =
321  count_distinct_descriptor.bitmap_sz_bits;
322  thrift_count_distinct_descriptor.approximate = count_distinct_descriptor.approximate;
323  thrift_count_distinct_descriptor.device_type =
324  count_distinct_descriptor.device_type == ExecutorDeviceType::GPU ? TDeviceType::GPU
325  : TDeviceType::CPU;
326  thrift_count_distinct_descriptor.sub_bitmap_count =
327  count_distinct_descriptor.sub_bitmap_count;
328  return thrift_count_distinct_descriptor;
329 }
330 
331 #define UNTHRIFT_COUNTDESCRIPTORIMPL_CASE(kind) \
332  case TCountDistinctImplType::kind: \
333  return CountDistinctImplType::kind;
334 
336  const TCountDistinctImplType::type impl_type) {
337  switch (impl_type) {
341  default:
342  CHECK(false);
343  }
344  abort();
345 }
346 
347 #undef UNTHRIFT_COUNTDESCRIPTORIMPL_CASE
348 
350  const TCountDistinctDescriptor& thrift_count_distinct_descriptor) {
351  CountDistinctDescriptor count_distinct_descriptor;
352  count_distinct_descriptor.impl_type_ =
353  count_distinct_impl_type_from_thrift(thrift_count_distinct_descriptor.impl_type);
354  count_distinct_descriptor.min_val = thrift_count_distinct_descriptor.min_val;
355  count_distinct_descriptor.bitmap_sz_bits =
356  thrift_count_distinct_descriptor.bitmap_sz_bits;
357  count_distinct_descriptor.approximate = thrift_count_distinct_descriptor.approximate;
358  count_distinct_descriptor.device_type =
359  thrift_count_distinct_descriptor.device_type == TDeviceType::GPU
362  count_distinct_descriptor.sub_bitmap_count =
363  thrift_count_distinct_descriptor.sub_bitmap_count;
364  return count_distinct_descriptor;
365 }
366 
368  switch (t) {
369  case TExtArgumentType::Int8:
370  return ExtArgumentType::Int8;
371  case TExtArgumentType::Int16:
372  return ExtArgumentType::Int16;
373  case TExtArgumentType::Int32:
374  return ExtArgumentType::Int32;
375  case TExtArgumentType::Int64:
376  return ExtArgumentType::Int64;
377  case TExtArgumentType::Float:
378  return ExtArgumentType::Float;
381  case TExtArgumentType::Void:
382  return ExtArgumentType::Void;
383  case TExtArgumentType::PInt8:
384  return ExtArgumentType::PInt8;
385  case TExtArgumentType::PInt16:
387  case TExtArgumentType::PInt32:
389  case TExtArgumentType::PInt64:
391  case TExtArgumentType::PFloat:
393  case TExtArgumentType::PDouble:
395  case TExtArgumentType::PBool:
396  return ExtArgumentType::PBool;
397  case TExtArgumentType::Bool:
398  return ExtArgumentType::Bool;
399  case TExtArgumentType::ArrayInt8:
401  case TExtArgumentType::ArrayInt16:
403  case TExtArgumentType::ArrayInt32:
405  case TExtArgumentType::ArrayInt64:
407  case TExtArgumentType::ArrayFloat:
409  case TExtArgumentType::ArrayDouble:
411  case TExtArgumentType::ArrayBool:
413  case TExtArgumentType::ArrayTextEncodingNone:
415  case TExtArgumentType::ArrayTextEncodingDict:
417  case TExtArgumentType::GeoPoint:
419  case TExtArgumentType::GeoMultiPoint:
421  case TExtArgumentType::GeoLineString:
423  case TExtArgumentType::GeoMultiLineString:
425  case TExtArgumentType::Cursor:
427  case TExtArgumentType::GeoPolygon:
429  case TExtArgumentType::GeoMultiPolygon:
431  case TExtArgumentType::ColumnInt8:
433  case TExtArgumentType::ColumnInt16:
435  case TExtArgumentType::ColumnInt32:
437  case TExtArgumentType::ColumnInt64:
439  case TExtArgumentType::ColumnFloat:
441  case TExtArgumentType::ColumnDouble:
443  case TExtArgumentType::ColumnBool:
445  case TExtArgumentType::ColumnTextEncodingNone:
447  case TExtArgumentType::ColumnTextEncodingDict:
449  case TExtArgumentType::ColumnTimestamp:
451  case TExtArgumentType::TextEncodingNone:
453  case TExtArgumentType::TextEncodingDict:
455  case TExtArgumentType::Timestamp:
457  case TExtArgumentType::ColumnListInt8:
459  case TExtArgumentType::ColumnListInt16:
461  case TExtArgumentType::ColumnListInt32:
463  case TExtArgumentType::ColumnListInt64:
465  case TExtArgumentType::ColumnListFloat:
467  case TExtArgumentType::ColumnListDouble:
469  case TExtArgumentType::ColumnListBool:
471  case TExtArgumentType::ColumnListTextEncodingNone:
473  case TExtArgumentType::ColumnListTextEncodingDict:
475  case TExtArgumentType::ColumnArrayInt8:
477  case TExtArgumentType::ColumnArrayInt16:
479  case TExtArgumentType::ColumnArrayInt32:
481  case TExtArgumentType::ColumnArrayInt64:
483  case TExtArgumentType::ColumnArrayFloat:
485  case TExtArgumentType::ColumnArrayDouble:
487  case TExtArgumentType::ColumnArrayBool:
489  case TExtArgumentType::ColumnArrayTextEncodingNone:
491  case TExtArgumentType::ColumnArrayTextEncodingDict:
493  case TExtArgumentType::ColumnListArrayInt8:
495  case TExtArgumentType::ColumnListArrayInt16:
497  case TExtArgumentType::ColumnListArrayInt32:
499  case TExtArgumentType::ColumnListArrayInt64:
501  case TExtArgumentType::ColumnListArrayFloat:
503  case TExtArgumentType::ColumnListArrayDouble:
505  case TExtArgumentType::ColumnListArrayBool:
507  case TExtArgumentType::ColumnListArrayTextEncodingNone:
509  case TExtArgumentType::ColumnListArrayTextEncodingDict:
511  case TExtArgumentType::DayTimeInterval:
513  case TExtArgumentType::YearMonthTimeInterval:
515  }
516  UNREACHABLE();
517  return ExtArgumentType{};
518 }
519 
521  switch (t) {
523  return TExtArgumentType::Int8;
525  return TExtArgumentType::Int16;
527  return TExtArgumentType::Int32;
529  return TExtArgumentType::Int64;
531  return TExtArgumentType::Float;
535  return TExtArgumentType::Void;
537  return TExtArgumentType::PInt8;
539  return TExtArgumentType::PInt16;
541  return TExtArgumentType::PInt32;
543  return TExtArgumentType::PInt64;
545  return TExtArgumentType::PFloat;
547  return TExtArgumentType::PDouble;
549  return TExtArgumentType::PBool;
551  return TExtArgumentType::Bool;
553  return TExtArgumentType::ArrayInt8;
555  return TExtArgumentType::ArrayInt16;
557  return TExtArgumentType::ArrayInt32;
559  return TExtArgumentType::ArrayInt64;
561  return TExtArgumentType::ArrayFloat;
563  return TExtArgumentType::ArrayDouble;
565  return TExtArgumentType::ArrayBool;
567  return TExtArgumentType::ArrayTextEncodingNone;
569  return TExtArgumentType::ArrayTextEncodingDict;
571  return TExtArgumentType::GeoPoint;
573  return TExtArgumentType::GeoMultiPoint;
575  return TExtArgumentType::GeoLineString;
577  return TExtArgumentType::GeoMultiLineString;
579  return TExtArgumentType::Cursor;
581  return TExtArgumentType::GeoPolygon;
583  return TExtArgumentType::GeoMultiPolygon;
585  return TExtArgumentType::ColumnInt8;
587  return TExtArgumentType::ColumnInt16;
589  return TExtArgumentType::ColumnInt32;
591  return TExtArgumentType::ColumnInt64;
593  return TExtArgumentType::ColumnFloat;
595  return TExtArgumentType::ColumnDouble;
597  return TExtArgumentType::ColumnBool;
599  return TExtArgumentType::ColumnTextEncodingNone;
601  return TExtArgumentType::ColumnTextEncodingDict;
603  return TExtArgumentType::ColumnTimestamp;
605  return TExtArgumentType::TextEncodingNone;
607  return TExtArgumentType::TextEncodingDict;
609  return TExtArgumentType::Timestamp;
611  return TExtArgumentType::ColumnListInt8;
613  return TExtArgumentType::ColumnListInt16;
615  return TExtArgumentType::ColumnListInt32;
617  return TExtArgumentType::ColumnListInt64;
619  return TExtArgumentType::ColumnListFloat;
621  return TExtArgumentType::ColumnListDouble;
623  return TExtArgumentType::ColumnListBool;
625  return TExtArgumentType::ColumnListTextEncodingNone;
627  return TExtArgumentType::ColumnListTextEncodingDict;
629  return TExtArgumentType::ColumnArrayInt8;
631  return TExtArgumentType::ColumnArrayInt16;
633  return TExtArgumentType::ColumnArrayInt32;
635  return TExtArgumentType::ColumnArrayInt64;
637  return TExtArgumentType::ColumnArrayFloat;
639  return TExtArgumentType::ColumnArrayDouble;
641  return TExtArgumentType::ColumnArrayBool;
643  return TExtArgumentType::ColumnArrayTextEncodingNone;
645  return TExtArgumentType::ColumnArrayTextEncodingDict;
647  return TExtArgumentType::ColumnListArrayInt8;
649  return TExtArgumentType::ColumnListArrayInt16;
651  return TExtArgumentType::ColumnListArrayInt32;
653  return TExtArgumentType::ColumnListArrayInt64;
655  return TExtArgumentType::ColumnListArrayFloat;
657  return TExtArgumentType::ColumnListArrayDouble;
659  return TExtArgumentType::ColumnListArrayBool;
661  return TExtArgumentType::ColumnListArrayTextEncodingDict;
663  return TExtArgumentType::ColumnListArrayTextEncodingNone;
665  return TExtArgumentType::DayTimeInterval;
667  return TExtArgumentType::YearMonthTimeInterval;
668  }
669  UNREACHABLE();
670  return TExtArgumentType::type{};
671 }
672 
673 inline std::vector<ExtArgumentType> from_thrift(
674  const std::vector<TExtArgumentType::type>& v) {
675  std::vector<ExtArgumentType> result;
677  v.begin(),
678  v.end(),
679  std::back_inserter(result),
680  [](TExtArgumentType::type c) -> ExtArgumentType { return from_thrift(c); });
681  return result;
682 }
683 
684 inline std::vector<TExtArgumentType::type> to_thrift(
685  const std::vector<ExtArgumentType>& v) {
686  std::vector<TExtArgumentType::type> result;
688  v.begin(),
689  v.end(),
690  std::back_inserter(result),
691  [](ExtArgumentType c) -> TExtArgumentType::type { return to_thrift(c); });
692  return result;
693 }
694 
696  const TOutputBufferSizeType::type& t) {
697  switch (t) {
698  case TOutputBufferSizeType::kConstant:
700  case TOutputBufferSizeType::kUserSpecifiedConstantParameter:
702  case TOutputBufferSizeType::kUserSpecifiedRowMultiplier:
704  case TOutputBufferSizeType::kTableFunctionSpecifiedParameter:
706  case TOutputBufferSizeType::kPreFlightParameter:
708  }
709  UNREACHABLE();
711 }
712 
715  switch (t) {
717  return TOutputBufferSizeType::kConstant;
719  return TOutputBufferSizeType::kUserSpecifiedConstantParameter;
721  return TOutputBufferSizeType::kUserSpecifiedRowMultiplier;
723  return TOutputBufferSizeType::kTableFunctionSpecifiedParameter;
725  return TOutputBufferSizeType::kPreFlightParameter;
726  }
727  UNREACHABLE();
729 }
730 
731 inline TUserDefinedFunction to_thrift(const ExtensionFunction& udf) {
732  TUserDefinedFunction tfunc;
733  tfunc.name = udf.getName(/* keep_suffix */ true);
734  tfunc.argTypes = to_thrift(udf.getInputArgs());
735  tfunc.retType = to_thrift(udf.getRet());
736  tfunc.usesManager = udf.usesManager();
737  return tfunc;
738 }
739 
740 inline TUserDefinedTableFunction to_thrift(const table_functions::TableFunction& func) {
741  TUserDefinedTableFunction tfunc;
742  tfunc.name = func.getName();
743  tfunc.sizerType = to_thrift(func.getOutputRowSizeType());
744  tfunc.sizerArgPos = func.getOutputRowSizeParameter();
745  tfunc.inputArgTypes = to_thrift(func.getInputArgs());
746  tfunc.outputArgTypes = to_thrift(func.getOutputArgs());
747  tfunc.sqlArgTypes = to_thrift(func.getSqlArgs());
748  tfunc.annotations = func.getAnnotations();
749  return tfunc;
750 }
751 
752 inline std::vector<TUserDefinedTableFunction> to_thrift(
753  const std::vector<table_functions::TableFunction>& v) {
754  std::vector<TUserDefinedTableFunction> result;
755  std::transform(v.begin(),
756  v.end(),
757  std::back_inserter(result),
758  [](table_functions::TableFunction c) -> TUserDefinedTableFunction {
759  return to_thrift(c);
760  });
761  return result;
762 }
763 
764 } // namespace ThriftSerializers
765 
766 #endif // QUERYENGINE_THRIFTSERIALIZERS_H
TCountDistinctImplType::type count_distinct_impl_type_to_thrift(const CountDistinctImplType impl_type)
AggregatedColRange column_ranges_from_thrift(const std::vector< TColumnRange > &thrift_column_ranges)
std::vector< TTargetInfo > target_infos_to_thrift(const std::vector< TargetInfo > &targets)
HOST DEVICE SQLTypes get_subtype() const
Definition: sqltypes.h:381
SQLAgg
Definition: sqldefs.h:73
StringDictionaryGenerations string_dictionary_generations_from_thrift(const std::vector< TDictionaryGeneration > &thrift_string_dictionary_generations)
HOST DEVICE int get_size() const
Definition: sqltypes.h:390
Descriptor for the storage layout use for (approximate) count distinct operations.
TDatumType::type type_to_thrift(const SQLTypeInfo &type_info)
SQLTypes
Definition: sqltypes.h:53
#define UNTHRIFT_AGGKIND_CASE(kind)
TCountDistinctDescriptor count_distinct_descriptor_to_thrift(const CountDistinctDescriptor &count_distinct_descriptor)
TRowDescriptor target_meta_infos_to_thrift(const std::vector< TargetMetaInfo > &targets)
QueryDescriptionType layout_from_thrift(const TResultSetLayout::type layout)
const ExtArgumentType getRet() const
TargetInfo target_info_from_thrift(const TTargetInfo &thrift_target_info)
SQLTypeInfo sql_type
Definition: TargetInfo.h:52
HOST DEVICE int get_scale() const
Definition: sqltypes.h:385
Cache for physical column ranges. Set by the aggregator on the leaves.
CountDistinctDescriptor count_distinct_descriptor_from_thrift(const TCountDistinctDescriptor &thrift_count_distinct_descriptor)
#define UNREACHABLE()
Definition: Logger.h:266
ExtArgumentType from_thrift(const TExtArgumentType::type &t)
const std::string getName(bool keep_suffix=true) const
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:380
bool skip_null_val
Definition: TargetInfo.h:54
CountDistinctImplType impl_type_
const SQLTypeInfo & get_type_info() const
static ExpressionRange makeFloatRange(const float fp_min, const float fp_max, const bool has_nulls)
std::string to_string(char const *&&v)
SQLTypeInfo agg_arg_type
Definition: TargetInfo.h:53
std::vector< TargetInfo > target_infos_from_thrift(const std::vector< TTargetInfo > &thrift_targets)
Supported runtime functions management and retrieval.
bool is_agg
Definition: TargetInfo.h:50
void setGeneration(const uint32_t id, const uint64_t generation)
bool is_distinct_target(const TargetInfo &target_info)
Definition: TargetInfo.h:98
const std::vector< ExtArgumentType > & getOutputArgs() const
OUTPUT transform(INPUT const &input, FUNC const &func)
Definition: misc.h:320
SQLTypeInfo type_info_from_thrift(const TTypeInfo &thrift_ti, const bool strip_geo_encoding=false)
SQLAgg agg_kind_from_thrift(const TAggKind::type agg)
std::string getName(const bool drop_suffix=false, const bool lower=false) const
SQLAgg agg_kind
Definition: TargetInfo.h:51
int get_precision() const
Definition: sqltypes.h:383
static ExpressionRange makeIntRange(const int64_t int_min, const int64_t int_max, const int64_t bucket, const bool has_nulls)
void fixup_geo_column_descriptor(TColumnType &col_type, const SQLTypes subtype, const int output_srid)
#define THRIFT_COUNTDESCRIPTORIMPL_CASE(kind)
static ExpressionRange makeDoubleRange(const double fp_min, const double fp_max, const bool has_nulls)
Definition: sqltypes.h:68
TExtArgumentType::type to_thrift(const ExtArgumentType &t)
CountDistinctImplType count_distinct_impl_type_from_thrift(const TCountDistinctImplType::type impl_type)
#define UNTHRIFT_COUNTDESCRIPTORIMPL_CASE(kind)
const std::vector< ExtArgumentType > & getInputArgs() const
Definition: sqldefs.h:78
const std::vector< ExtArgumentType > & getInputArgs() const
bool takes_arg(const TargetInfo &target_info)
TColumnType target_meta_info_to_thrift(const TargetMetaInfo &target, const size_t idx)
CountDistinctImplType
HOST DEVICE int get_comp_param() const
Definition: sqltypes.h:389
const std::vector< ExtArgumentType > & getSqlArgs() const
#define CHECK(condition)
Definition: Logger.h:222
SQLTypes type
Definition: sqltypes.h:1002
QueryDescriptionType
Definition: Types.h:29
std::vector< TargetMetaInfo > target_meta_infos_from_thrift(const TRowDescriptor &row_desc)
TAggKind::type agg_kind_to_thrift(const SQLAgg agg)
void setColRange(const PhysicalInput &, const ExpressionRange &)
TResultSetLayout::type layout_to_thrift(const QueryDescriptionType layout)
static ExpressionRange makeInvalidRange()
const std::string & get_resname() const
#define THRIFT_LAYOUT_CASE(layout)
bool is_distinct
Definition: TargetInfo.h:55
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:387
TTypeInfo type_info_to_thrift(const SQLTypeInfo &ti)
const bool usesManager() const
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:957
OutputBufferSizeType getOutputRowSizeType() const
#define UNTHRIFT_LAYOUT_CASE(layout)
#define IS_GEO(T)
Definition: sqltypes.h:298
#define THRIFT_AGGKIND_CASE(kind)
bool is_array() const
Definition: sqltypes.h:584
const std::vector< std::map< std::string, std::string > > & getAnnotations() const
TTargetInfo target_info_to_thrift(const TargetInfo &target_info)
TEncodingType::type encoding_to_thrift(const SQLTypeInfo &type_info)