OmniSciDB  a987f07e93
 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)
93  default:
94  CHECK(false) << static_cast<int>(agg);
95  }
96  abort();
97 }
98 
99 #undef THRIFT_AGGKIND_CASE
100 
101 #define UNTHRIFT_AGGKIND_CASE(kind) \
102  case TAggKind::kind: \
103  return k##kind;
104 
106  switch (agg) {
112  UNTHRIFT_AGGKIND_CASE(APPROX_COUNT_DISTINCT)
113  UNTHRIFT_AGGKIND_CASE(SAMPLE)
114  UNTHRIFT_AGGKIND_CASE(SINGLE_VALUE)
117  default:
118  CHECK(false) << static_cast<int>(agg);
119  }
120  abort();
121 }
122 
123 #undef UNTHRIFT_AGGKIND_CASE
124 
126  const std::vector<TColumnRange>& thrift_column_ranges) {
127  AggregatedColRange column_ranges;
128  for (const auto& thrift_column_range : thrift_column_ranges) {
129  PhysicalInput phys_input{thrift_column_range.col_id, thrift_column_range.table_id};
130  switch (thrift_column_range.type) {
131  case TExpressionRangeType::INTEGER:
132  column_ranges.setColRange(
133  phys_input,
134  ExpressionRange::makeIntRange(thrift_column_range.int_min,
135  thrift_column_range.int_max,
136  thrift_column_range.bucket,
137  thrift_column_range.has_nulls));
138  break;
139  case TExpressionRangeType::FLOAT:
140  column_ranges.setColRange(
141  phys_input,
142  ExpressionRange::makeFloatRange(thrift_column_range.fp_min,
143  thrift_column_range.fp_max,
144  thrift_column_range.has_nulls));
145  break;
146  case TExpressionRangeType::DOUBLE:
147  column_ranges.setColRange(
148  phys_input,
149  ExpressionRange::makeDoubleRange(thrift_column_range.fp_min,
150  thrift_column_range.fp_max,
151  thrift_column_range.has_nulls));
152  break;
154  column_ranges.setColRange(phys_input, ExpressionRange::makeInvalidRange());
155  break;
156  default:
157  CHECK(false);
158  }
159  }
160  return column_ranges;
161 }
162 
164  const std::vector<TDictionaryGeneration>& thrift_string_dictionary_generations) {
165  StringDictionaryGenerations string_dictionary_generations;
166  for (const auto& thrift_string_dictionary_generation :
167  thrift_string_dictionary_generations) {
168  string_dictionary_generations.setGeneration(
169  thrift_string_dictionary_generation.dict_id,
170  thrift_string_dictionary_generation.entry_count);
171  }
172  return string_dictionary_generations;
173 }
174 
175 inline TTypeInfo type_info_to_thrift(const SQLTypeInfo& ti) {
176  TTypeInfo thrift_ti;
177  thrift_ti.type =
179  thrift_ti.encoding = encoding_to_thrift(ti);
180  thrift_ti.nullable = !ti.get_notnull();
181  thrift_ti.is_array = ti.is_array();
182  // TODO: Properly serialize geospatial subtype. For now, the value in precision is the
183  // same as the value in scale; overload the precision field with the subtype of the
184  // geospatial type (currently kGEOMETRY or kGEOGRAPHY)
185  thrift_ti.precision =
186  IS_GEO(ti.get_type()) ? static_cast<int32_t>(ti.get_subtype()) : ti.get_precision();
187  thrift_ti.scale = ti.get_scale();
188  thrift_ti.comp_param = ti.get_comp_param();
189  thrift_ti.size = ti.get_size();
190  return thrift_ti;
191 }
192 
193 inline bool takes_arg(const TargetInfo& target_info) {
194  return target_info.is_agg &&
195  (target_info.agg_kind != kCOUNT || is_distinct_target(target_info));
196 }
197 
198 inline std::vector<TargetMetaInfo> target_meta_infos_from_thrift(
199  const TRowDescriptor& row_desc) {
200  std::vector<TargetMetaInfo> target_meta_infos;
201  for (const auto& col : row_desc) {
202  target_meta_infos.emplace_back(col.col_name, type_info_from_thrift(col.col_type));
203  }
204  return target_meta_infos;
205 }
206 
207 inline void fixup_geo_column_descriptor(TColumnType& col_type,
208  const SQLTypes subtype,
209  const int output_srid) {
210  col_type.col_type.precision = static_cast<int>(subtype);
211  col_type.col_type.scale = output_srid;
212 }
213 
214 inline TColumnType target_meta_info_to_thrift(const TargetMetaInfo& target,
215  const size_t idx) {
216  TColumnType proj_info;
217  proj_info.col_name = target.get_resname();
218  if (proj_info.col_name.empty()) {
219  proj_info.col_name = "result_" + std::to_string(idx + 1);
220  }
221  const auto& target_ti = target.get_type_info();
222  proj_info.col_type.type = type_to_thrift(target_ti);
223  proj_info.col_type.encoding = encoding_to_thrift(target_ti);
224  proj_info.col_type.nullable = !target_ti.get_notnull();
225  proj_info.col_type.is_array = target_ti.get_type() == kARRAY;
226  if (IS_GEO(target_ti.get_type())) {
228  proj_info, target_ti.get_subtype(), target_ti.get_output_srid());
229  } else {
230  proj_info.col_type.precision = target_ti.get_precision();
231  proj_info.col_type.scale = target_ti.get_scale();
232  }
233  if (target_ti.get_type() == kDATE) {
234  proj_info.col_type.size = target_ti.get_size();
235  }
236  proj_info.col_type.comp_param =
237  (target_ti.is_date_in_days() && target_ti.get_comp_param() == 0)
238  ? 32
239  : target_ti.get_comp_param();
240  return proj_info;
241 }
242 
243 inline TRowDescriptor target_meta_infos_to_thrift(
244  const std::vector<TargetMetaInfo>& targets) {
245  TRowDescriptor row_desc;
246  size_t i = 0;
247  for (const auto& target : targets) {
248  row_desc.push_back(target_meta_info_to_thrift(target, i));
249  ++i;
250  }
251  return row_desc;
252 }
253 
254 inline TTargetInfo target_info_to_thrift(const TargetInfo& target_info) {
255  TTargetInfo thrift_target_info;
256  thrift_target_info.is_agg = target_info.is_agg;
257  thrift_target_info.kind = agg_kind_to_thrift(target_info.agg_kind);
258  thrift_target_info.type = type_info_to_thrift(target_info.sql_type);
259  thrift_target_info.arg_type = takes_arg(target_info)
260  ? type_info_to_thrift(target_info.agg_arg_type)
261  : thrift_target_info.type;
262  thrift_target_info.skip_nulls = target_info.skip_null_val;
263  thrift_target_info.is_distinct = target_info.is_distinct;
264  return thrift_target_info;
265 }
266 
267 inline TargetInfo target_info_from_thrift(const TTargetInfo& thrift_target_info) {
268  TargetInfo target_info;
269  target_info.is_agg = thrift_target_info.is_agg;
270  target_info.agg_kind = agg_kind_from_thrift(thrift_target_info.kind);
271  target_info.sql_type = type_info_from_thrift(thrift_target_info.type);
272  target_info.is_distinct = thrift_target_info.is_distinct;
273  target_info.agg_arg_type = takes_arg(target_info)
274  ? type_info_from_thrift(thrift_target_info.arg_type)
275  : SQLTypeInfo(kNULLT, false);
276  target_info.skip_null_val = thrift_target_info.skip_nulls;
277  return target_info;
278 }
279 
280 inline std::vector<TTargetInfo> target_infos_to_thrift(
281  const std::vector<TargetInfo>& targets) {
282  std::vector<TTargetInfo> thrift_targets;
283  for (const auto& target_info : targets) {
284  thrift_targets.push_back(target_info_to_thrift(target_info));
285  }
286  return thrift_targets;
287 }
288 
289 inline std::vector<TargetInfo> target_infos_from_thrift(
290  const std::vector<TTargetInfo>& thrift_targets) {
291  std::vector<TargetInfo> targets;
292  for (const auto& thrift_target_info : thrift_targets) {
293  targets.push_back(target_info_from_thrift(thrift_target_info));
294  }
295  return targets;
296 }
297 
298 #define THRIFT_COUNTDESCRIPTORIMPL_CASE(kind) \
299  case CountDistinctImplType::kind: \
300  return TCountDistinctImplType::kind;
301 
303  const CountDistinctImplType impl_type) {
304  switch (impl_type) {
308  default:
309  CHECK(false);
310  }
311  abort();
312 }
313 
314 #undef THRIFT_COUNTDESCRIPTORIMPL_CASE
315 
316 inline TCountDistinctDescriptor count_distinct_descriptor_to_thrift(
317  const CountDistinctDescriptor& count_distinct_descriptor) {
318  TCountDistinctDescriptor thrift_count_distinct_descriptor;
319  thrift_count_distinct_descriptor.impl_type =
320  count_distinct_impl_type_to_thrift(count_distinct_descriptor.impl_type_);
321  thrift_count_distinct_descriptor.min_val = count_distinct_descriptor.min_val;
322  thrift_count_distinct_descriptor.bitmap_sz_bits =
323  count_distinct_descriptor.bitmap_sz_bits;
324  thrift_count_distinct_descriptor.approximate = count_distinct_descriptor.approximate;
325  thrift_count_distinct_descriptor.device_type =
326  count_distinct_descriptor.device_type == ExecutorDeviceType::GPU ? TDeviceType::GPU
327  : TDeviceType::CPU;
328  thrift_count_distinct_descriptor.sub_bitmap_count =
329  count_distinct_descriptor.sub_bitmap_count;
330  return thrift_count_distinct_descriptor;
331 }
332 
333 #define UNTHRIFT_COUNTDESCRIPTORIMPL_CASE(kind) \
334  case TCountDistinctImplType::kind: \
335  return CountDistinctImplType::kind;
336 
338  const TCountDistinctImplType::type impl_type) {
339  switch (impl_type) {
343  default:
344  CHECK(false);
345  }
346  abort();
347 }
348 
349 #undef UNTHRIFT_COUNTDESCRIPTORIMPL_CASE
350 
352  const TCountDistinctDescriptor& thrift_count_distinct_descriptor) {
353  CountDistinctDescriptor count_distinct_descriptor;
354  count_distinct_descriptor.impl_type_ =
355  count_distinct_impl_type_from_thrift(thrift_count_distinct_descriptor.impl_type);
356  count_distinct_descriptor.min_val = thrift_count_distinct_descriptor.min_val;
357  count_distinct_descriptor.bitmap_sz_bits =
358  thrift_count_distinct_descriptor.bitmap_sz_bits;
359  count_distinct_descriptor.approximate = thrift_count_distinct_descriptor.approximate;
360  count_distinct_descriptor.device_type =
361  thrift_count_distinct_descriptor.device_type == TDeviceType::GPU
364  count_distinct_descriptor.sub_bitmap_count =
365  thrift_count_distinct_descriptor.sub_bitmap_count;
366  return count_distinct_descriptor;
367 }
368 
370  switch (t) {
371  case TExtArgumentType::Int8:
372  return ExtArgumentType::Int8;
373  case TExtArgumentType::Int16:
374  return ExtArgumentType::Int16;
375  case TExtArgumentType::Int32:
376  return ExtArgumentType::Int32;
377  case TExtArgumentType::Int64:
378  return ExtArgumentType::Int64;
379  case TExtArgumentType::Float:
380  return ExtArgumentType::Float;
383  case TExtArgumentType::Void:
384  return ExtArgumentType::Void;
385  case TExtArgumentType::PInt8:
386  return ExtArgumentType::PInt8;
387  case TExtArgumentType::PInt16:
389  case TExtArgumentType::PInt32:
391  case TExtArgumentType::PInt64:
393  case TExtArgumentType::PFloat:
395  case TExtArgumentType::PDouble:
397  case TExtArgumentType::PBool:
398  return ExtArgumentType::PBool;
399  case TExtArgumentType::Bool:
400  return ExtArgumentType::Bool;
401  case TExtArgumentType::ArrayInt8:
403  case TExtArgumentType::ArrayInt16:
405  case TExtArgumentType::ArrayInt32:
407  case TExtArgumentType::ArrayInt64:
409  case TExtArgumentType::ArrayFloat:
411  case TExtArgumentType::ArrayDouble:
413  case TExtArgumentType::ArrayBool:
415  case TExtArgumentType::ArrayTextEncodingNone:
417  case TExtArgumentType::ArrayTextEncodingDict:
419  case TExtArgumentType::GeoPoint:
421  case TExtArgumentType::GeoMultiPoint:
423  case TExtArgumentType::GeoLineString:
425  case TExtArgumentType::GeoMultiLineString:
427  case TExtArgumentType::Cursor:
429  case TExtArgumentType::GeoPolygon:
431  case TExtArgumentType::GeoMultiPolygon:
433  case TExtArgumentType::ColumnInt8:
435  case TExtArgumentType::ColumnInt16:
437  case TExtArgumentType::ColumnInt32:
439  case TExtArgumentType::ColumnInt64:
441  case TExtArgumentType::ColumnFloat:
443  case TExtArgumentType::ColumnDouble:
445  case TExtArgumentType::ColumnBool:
447  case TExtArgumentType::ColumnTextEncodingNone:
449  case TExtArgumentType::ColumnTextEncodingDict:
451  case TExtArgumentType::ColumnTimestamp:
453  case TExtArgumentType::TextEncodingNone:
455  case TExtArgumentType::TextEncodingDict:
457  case TExtArgumentType::Timestamp:
459  case TExtArgumentType::ColumnListInt8:
461  case TExtArgumentType::ColumnListInt16:
463  case TExtArgumentType::ColumnListInt32:
465  case TExtArgumentType::ColumnListInt64:
467  case TExtArgumentType::ColumnListFloat:
469  case TExtArgumentType::ColumnListDouble:
471  case TExtArgumentType::ColumnListBool:
473  case TExtArgumentType::ColumnListTextEncodingNone:
475  case TExtArgumentType::ColumnListTextEncodingDict:
477  case TExtArgumentType::ColumnArrayInt8:
479  case TExtArgumentType::ColumnArrayInt16:
481  case TExtArgumentType::ColumnArrayInt32:
483  case TExtArgumentType::ColumnArrayInt64:
485  case TExtArgumentType::ColumnArrayFloat:
487  case TExtArgumentType::ColumnArrayDouble:
489  case TExtArgumentType::ColumnArrayBool:
491  case TExtArgumentType::ColumnArrayTextEncodingNone:
493  case TExtArgumentType::ColumnArrayTextEncodingDict:
495  case TExtArgumentType::ColumnListArrayInt8:
497  case TExtArgumentType::ColumnListArrayInt16:
499  case TExtArgumentType::ColumnListArrayInt32:
501  case TExtArgumentType::ColumnListArrayInt64:
503  case TExtArgumentType::ColumnListArrayFloat:
505  case TExtArgumentType::ColumnListArrayDouble:
507  case TExtArgumentType::ColumnListArrayBool:
509  case TExtArgumentType::ColumnListArrayTextEncodingNone:
511  case TExtArgumentType::ColumnListArrayTextEncodingDict:
513  case TExtArgumentType::DayTimeInterval:
515  case TExtArgumentType::YearMonthTimeInterval:
517  }
518  UNREACHABLE();
519  return ExtArgumentType{};
520 }
521 
523  switch (t) {
525  return TExtArgumentType::Int8;
527  return TExtArgumentType::Int16;
529  return TExtArgumentType::Int32;
531  return TExtArgumentType::Int64;
533  return TExtArgumentType::Float;
537  return TExtArgumentType::Void;
539  return TExtArgumentType::PInt8;
541  return TExtArgumentType::PInt16;
543  return TExtArgumentType::PInt32;
545  return TExtArgumentType::PInt64;
547  return TExtArgumentType::PFloat;
549  return TExtArgumentType::PDouble;
551  return TExtArgumentType::PBool;
553  return TExtArgumentType::Bool;
555  return TExtArgumentType::ArrayInt8;
557  return TExtArgumentType::ArrayInt16;
559  return TExtArgumentType::ArrayInt32;
561  return TExtArgumentType::ArrayInt64;
563  return TExtArgumentType::ArrayFloat;
565  return TExtArgumentType::ArrayDouble;
567  return TExtArgumentType::ArrayBool;
569  return TExtArgumentType::ArrayTextEncodingNone;
571  return TExtArgumentType::ArrayTextEncodingDict;
573  return TExtArgumentType::GeoPoint;
575  return TExtArgumentType::GeoMultiPoint;
577  return TExtArgumentType::GeoLineString;
579  return TExtArgumentType::GeoMultiLineString;
581  return TExtArgumentType::Cursor;
583  return TExtArgumentType::GeoPolygon;
585  return TExtArgumentType::GeoMultiPolygon;
587  return TExtArgumentType::ColumnInt8;
589  return TExtArgumentType::ColumnInt16;
591  return TExtArgumentType::ColumnInt32;
593  return TExtArgumentType::ColumnInt64;
595  return TExtArgumentType::ColumnFloat;
597  return TExtArgumentType::ColumnDouble;
599  return TExtArgumentType::ColumnBool;
601  return TExtArgumentType::ColumnTextEncodingNone;
603  return TExtArgumentType::ColumnTextEncodingDict;
605  return TExtArgumentType::ColumnTimestamp;
607  return TExtArgumentType::TextEncodingNone;
609  return TExtArgumentType::TextEncodingDict;
611  return TExtArgumentType::Timestamp;
613  return TExtArgumentType::ColumnListInt8;
615  return TExtArgumentType::ColumnListInt16;
617  return TExtArgumentType::ColumnListInt32;
619  return TExtArgumentType::ColumnListInt64;
621  return TExtArgumentType::ColumnListFloat;
623  return TExtArgumentType::ColumnListDouble;
625  return TExtArgumentType::ColumnListBool;
627  return TExtArgumentType::ColumnListTextEncodingNone;
629  return TExtArgumentType::ColumnListTextEncodingDict;
631  return TExtArgumentType::ColumnArrayInt8;
633  return TExtArgumentType::ColumnArrayInt16;
635  return TExtArgumentType::ColumnArrayInt32;
637  return TExtArgumentType::ColumnArrayInt64;
639  return TExtArgumentType::ColumnArrayFloat;
641  return TExtArgumentType::ColumnArrayDouble;
643  return TExtArgumentType::ColumnArrayBool;
645  return TExtArgumentType::ColumnArrayTextEncodingNone;
647  return TExtArgumentType::ColumnArrayTextEncodingDict;
649  return TExtArgumentType::ColumnListArrayInt8;
651  return TExtArgumentType::ColumnListArrayInt16;
653  return TExtArgumentType::ColumnListArrayInt32;
655  return TExtArgumentType::ColumnListArrayInt64;
657  return TExtArgumentType::ColumnListArrayFloat;
659  return TExtArgumentType::ColumnListArrayDouble;
661  return TExtArgumentType::ColumnListArrayBool;
663  return TExtArgumentType::ColumnListArrayTextEncodingDict;
665  return TExtArgumentType::ColumnListArrayTextEncodingNone;
667  return TExtArgumentType::DayTimeInterval;
669  return TExtArgumentType::YearMonthTimeInterval;
670  }
671  UNREACHABLE();
672  return TExtArgumentType::type{};
673 }
674 
675 inline std::vector<ExtArgumentType> from_thrift(
676  const std::vector<TExtArgumentType::type>& v) {
677  std::vector<ExtArgumentType> result;
679  v.begin(),
680  v.end(),
681  std::back_inserter(result),
682  [](TExtArgumentType::type c) -> ExtArgumentType { return from_thrift(c); });
683  return result;
684 }
685 
686 inline std::vector<TExtArgumentType::type> to_thrift(
687  const std::vector<ExtArgumentType>& v) {
688  std::vector<TExtArgumentType::type> result;
690  v.begin(),
691  v.end(),
692  std::back_inserter(result),
693  [](ExtArgumentType c) -> TExtArgumentType::type { return to_thrift(c); });
694  return result;
695 }
696 
698  const TOutputBufferSizeType::type& t) {
699  switch (t) {
700  case TOutputBufferSizeType::kConstant:
702  case TOutputBufferSizeType::kUserSpecifiedConstantParameter:
704  case TOutputBufferSizeType::kUserSpecifiedRowMultiplier:
706  case TOutputBufferSizeType::kTableFunctionSpecifiedParameter:
708  case TOutputBufferSizeType::kPreFlightParameter:
710  }
711  UNREACHABLE();
713 }
714 
717  switch (t) {
719  return TOutputBufferSizeType::kConstant;
721  return TOutputBufferSizeType::kUserSpecifiedConstantParameter;
723  return TOutputBufferSizeType::kUserSpecifiedRowMultiplier;
725  return TOutputBufferSizeType::kTableFunctionSpecifiedParameter;
727  return TOutputBufferSizeType::kPreFlightParameter;
728  }
729  UNREACHABLE();
731 }
732 
733 inline TUserDefinedFunction to_thrift(const ExtensionFunction& udf) {
734  TUserDefinedFunction tfunc;
735  tfunc.name = udf.getName(/* keep_suffix */ true);
736  tfunc.argTypes = to_thrift(udf.getInputArgs());
737  tfunc.retType = to_thrift(udf.getRet());
738  tfunc.annotations = udf.getAnnotations();
739  return tfunc;
740 }
741 
742 inline TUserDefinedTableFunction to_thrift(const table_functions::TableFunction& func) {
743  TUserDefinedTableFunction tfunc;
744  tfunc.name = func.getName();
745  tfunc.sizerType = to_thrift(func.getOutputRowSizeType());
746  tfunc.sizerArgPos = func.getOutputRowSizeParameter();
747  tfunc.inputArgTypes = to_thrift(func.getInputArgs());
748  tfunc.outputArgTypes = to_thrift(func.getOutputArgs());
749  tfunc.sqlArgTypes = to_thrift(func.getSqlArgs());
750  tfunc.annotations = func.getAnnotations();
751  return tfunc;
752 }
753 
754 inline std::vector<TUserDefinedTableFunction> to_thrift(
755  const std::vector<table_functions::TableFunction>& v) {
756  std::vector<TUserDefinedTableFunction> result;
757  std::transform(v.begin(),
758  v.end(),
759  std::back_inserter(result),
760  [](table_functions::TableFunction c) -> TUserDefinedTableFunction {
761  return to_thrift(c);
762  });
763  return result;
764 }
765 
766 } // namespace ThriftSerializers
767 
768 #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:333
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:289
SQLTypes type
Definition: sqltypes.h:1006
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
const std::vector< std::map< std::string, std::string > > & getAnnotations() const
TTypeInfo type_info_to_thrift(const SQLTypeInfo &ti)
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)