OmniSciDB  c0231cc57d
 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)
91  default:
92  CHECK(false) << static_cast<int>(agg);
93  }
94  abort();
95 }
96 
97 #undef THRIFT_AGGKIND_CASE
98 
99 #define UNTHRIFT_AGGKIND_CASE(kind) \
100  case TAggKind::kind: \
101  return k##kind;
102 
104  switch (agg) {
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 }
118 
119 #undef UNTHRIFT_AGGKIND_CASE
120 
122  const std::vector<TColumnRange>& thrift_column_ranges) {
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) {
127  case TExpressionRangeType::INTEGER:
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;
135  case TExpressionRangeType::FLOAT:
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;
142  case TExpressionRangeType::DOUBLE:
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;
150  column_ranges.setColRange(phys_input, ExpressionRange::makeInvalidRange());
151  break;
152  default:
153  CHECK(false);
154  }
155  }
156  return column_ranges;
157 }
158 
160  const std::vector<TDictionaryGeneration>& thrift_string_dictionary_generations) {
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 }
170 
171 inline TTypeInfo type_info_to_thrift(const SQLTypeInfo& ti) {
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 }
188 
189 inline bool takes_arg(const TargetInfo& target_info) {
190  return target_info.is_agg &&
191  (target_info.agg_kind != kCOUNT || is_distinct_target(target_info));
192 }
193 
194 inline std::vector<TargetMetaInfo> target_meta_infos_from_thrift(
195  const TRowDescriptor& row_desc) {
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 }
202 
203 inline void fixup_geo_column_descriptor(TColumnType& col_type,
204  const SQLTypes subtype,
205  const int output_srid) {
206  col_type.col_type.precision = static_cast<int>(subtype);
207  col_type.col_type.scale = output_srid;
208 }
209 
210 inline TColumnType target_meta_info_to_thrift(const TargetMetaInfo& target,
211  const size_t idx) {
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 }
238 
239 inline TRowDescriptor target_meta_infos_to_thrift(
240  const std::vector<TargetMetaInfo>& targets) {
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 }
249 
250 inline TTargetInfo target_info_to_thrift(const TargetInfo& target_info) {
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 }
262 
263 inline TargetInfo target_info_from_thrift(const TTargetInfo& thrift_target_info) {
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)
271  : SQLTypeInfo(kNULLT, false);
272  target_info.skip_null_val = thrift_target_info.skip_nulls;
273  return target_info;
274 }
275 
276 inline std::vector<TTargetInfo> target_infos_to_thrift(
277  const std::vector<TargetInfo>& targets) {
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 }
284 
285 inline std::vector<TargetInfo> target_infos_from_thrift(
286  const std::vector<TTargetInfo>& thrift_targets) {
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 }
293 
294 #define THRIFT_COUNTDESCRIPTORIMPL_CASE(kind) \
295  case CountDistinctImplType::kind: \
296  return TCountDistinctImplType::kind;
297 
299  const CountDistinctImplType impl_type) {
300  switch (impl_type) {
304  default:
305  CHECK(false);
306  }
307  abort();
308 }
309 
310 #undef THRIFT_COUNTDESCRIPTORIMPL_CASE
311 
312 inline TCountDistinctDescriptor count_distinct_descriptor_to_thrift(
313  const CountDistinctDescriptor& count_distinct_descriptor) {
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 }
328 
329 #define UNTHRIFT_COUNTDESCRIPTORIMPL_CASE(kind) \
330  case TCountDistinctImplType::kind: \
331  return CountDistinctImplType::kind;
332 
334  const TCountDistinctImplType::type impl_type) {
335  switch (impl_type) {
339  default:
340  CHECK(false);
341  }
342  abort();
343 }
344 
345 #undef UNTHRIFT_COUNTDESCRIPTORIMPL_CASE
346 
348  const TCountDistinctDescriptor& thrift_count_distinct_descriptor) {
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 }
364 
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::ArrayTextEncodingNone:
413  case TExtArgumentType::ArrayTextEncodingDict:
415  case TExtArgumentType::GeoPoint:
417  case TExtArgumentType::GeoMultiPoint:
419  case TExtArgumentType::GeoLineString:
421  case TExtArgumentType::GeoMultiLineString:
423  case TExtArgumentType::Cursor:
425  case TExtArgumentType::GeoPolygon:
427  case TExtArgumentType::GeoMultiPolygon:
429  case TExtArgumentType::ColumnInt8:
431  case TExtArgumentType::ColumnInt16:
433  case TExtArgumentType::ColumnInt32:
435  case TExtArgumentType::ColumnInt64:
437  case TExtArgumentType::ColumnFloat:
439  case TExtArgumentType::ColumnDouble:
441  case TExtArgumentType::ColumnBool:
443  case TExtArgumentType::ColumnTextEncodingNone:
445  case TExtArgumentType::ColumnTextEncodingDict:
447  case TExtArgumentType::ColumnTimestamp:
449  case TExtArgumentType::TextEncodingNone:
451  case TExtArgumentType::TextEncodingDict:
453  case TExtArgumentType::Timestamp:
455  case TExtArgumentType::ColumnListInt8:
457  case TExtArgumentType::ColumnListInt16:
459  case TExtArgumentType::ColumnListInt32:
461  case TExtArgumentType::ColumnListInt64:
463  case TExtArgumentType::ColumnListFloat:
465  case TExtArgumentType::ColumnListDouble:
467  case TExtArgumentType::ColumnListBool:
469  case TExtArgumentType::ColumnListTextEncodingNone:
471  case TExtArgumentType::ColumnListTextEncodingDict:
473  case TExtArgumentType::ColumnArrayInt8:
475  case TExtArgumentType::ColumnArrayInt16:
477  case TExtArgumentType::ColumnArrayInt32:
479  case TExtArgumentType::ColumnArrayInt64:
481  case TExtArgumentType::ColumnArrayFloat:
483  case TExtArgumentType::ColumnArrayDouble:
485  case TExtArgumentType::ColumnArrayBool:
487  case TExtArgumentType::ColumnArrayTextEncodingNone:
489  case TExtArgumentType::ColumnArrayTextEncodingDict:
491  case TExtArgumentType::ColumnListArrayInt8:
493  case TExtArgumentType::ColumnListArrayInt16:
495  case TExtArgumentType::ColumnListArrayInt32:
497  case TExtArgumentType::ColumnListArrayInt64:
499  case TExtArgumentType::ColumnListArrayFloat:
501  case TExtArgumentType::ColumnListArrayDouble:
503  case TExtArgumentType::ColumnListArrayBool:
505  case TExtArgumentType::ColumnListArrayTextEncodingNone:
507  case TExtArgumentType::ColumnListArrayTextEncodingDict:
509  }
510  UNREACHABLE();
511  return ExtArgumentType{};
512 }
513 
515  switch (t) {
517  return TExtArgumentType::Int8;
519  return TExtArgumentType::Int16;
521  return TExtArgumentType::Int32;
523  return TExtArgumentType::Int64;
525  return TExtArgumentType::Float;
529  return TExtArgumentType::Void;
531  return TExtArgumentType::PInt8;
533  return TExtArgumentType::PInt16;
535  return TExtArgumentType::PInt32;
537  return TExtArgumentType::PInt64;
539  return TExtArgumentType::PFloat;
541  return TExtArgumentType::PDouble;
543  return TExtArgumentType::PBool;
545  return TExtArgumentType::Bool;
547  return TExtArgumentType::ArrayInt8;
549  return TExtArgumentType::ArrayInt16;
551  return TExtArgumentType::ArrayInt32;
553  return TExtArgumentType::ArrayInt64;
555  return TExtArgumentType::ArrayFloat;
557  return TExtArgumentType::ArrayDouble;
559  return TExtArgumentType::ArrayBool;
561  return TExtArgumentType::ArrayTextEncodingNone;
563  return TExtArgumentType::ArrayTextEncodingDict;
565  return TExtArgumentType::GeoPoint;
567  return TExtArgumentType::GeoMultiPoint;
569  return TExtArgumentType::GeoLineString;
571  return TExtArgumentType::GeoMultiLineString;
573  return TExtArgumentType::Cursor;
575  return TExtArgumentType::GeoPolygon;
577  return TExtArgumentType::GeoMultiPolygon;
579  return TExtArgumentType::ColumnInt8;
581  return TExtArgumentType::ColumnInt16;
583  return TExtArgumentType::ColumnInt32;
585  return TExtArgumentType::ColumnInt64;
587  return TExtArgumentType::ColumnFloat;
589  return TExtArgumentType::ColumnDouble;
591  return TExtArgumentType::ColumnBool;
593  return TExtArgumentType::ColumnTextEncodingNone;
595  return TExtArgumentType::ColumnTextEncodingDict;
597  return TExtArgumentType::ColumnTimestamp;
599  return TExtArgumentType::TextEncodingNone;
601  return TExtArgumentType::TextEncodingDict;
603  return TExtArgumentType::Timestamp;
605  return TExtArgumentType::ColumnListInt8;
607  return TExtArgumentType::ColumnListInt16;
609  return TExtArgumentType::ColumnListInt32;
611  return TExtArgumentType::ColumnListInt64;
613  return TExtArgumentType::ColumnListFloat;
615  return TExtArgumentType::ColumnListDouble;
617  return TExtArgumentType::ColumnListBool;
619  return TExtArgumentType::ColumnListTextEncodingNone;
621  return TExtArgumentType::ColumnListTextEncodingDict;
623  return TExtArgumentType::ColumnArrayInt8;
625  return TExtArgumentType::ColumnArrayInt16;
627  return TExtArgumentType::ColumnArrayInt32;
629  return TExtArgumentType::ColumnArrayInt64;
631  return TExtArgumentType::ColumnArrayFloat;
633  return TExtArgumentType::ColumnArrayDouble;
635  return TExtArgumentType::ColumnArrayBool;
637  return TExtArgumentType::ColumnArrayTextEncodingNone;
639  return TExtArgumentType::ColumnArrayTextEncodingDict;
641  return TExtArgumentType::ColumnListArrayInt8;
643  return TExtArgumentType::ColumnListArrayInt16;
645  return TExtArgumentType::ColumnListArrayInt32;
647  return TExtArgumentType::ColumnListArrayInt64;
649  return TExtArgumentType::ColumnListArrayFloat;
651  return TExtArgumentType::ColumnListArrayDouble;
653  return TExtArgumentType::ColumnListArrayBool;
655  return TExtArgumentType::ColumnListArrayTextEncodingDict;
657  return TExtArgumentType::ColumnListArrayTextEncodingNone;
658  }
659  UNREACHABLE();
660  return TExtArgumentType::type{};
661 }
662 
663 inline std::vector<ExtArgumentType> from_thrift(
664  const std::vector<TExtArgumentType::type>& v) {
665  std::vector<ExtArgumentType> result;
667  v.begin(),
668  v.end(),
669  std::back_inserter(result),
670  [](TExtArgumentType::type c) -> ExtArgumentType { return from_thrift(c); });
671  return result;
672 }
673 
674 inline std::vector<TExtArgumentType::type> to_thrift(
675  const std::vector<ExtArgumentType>& v) {
676  std::vector<TExtArgumentType::type> result;
678  v.begin(),
679  v.end(),
680  std::back_inserter(result),
681  [](ExtArgumentType c) -> TExtArgumentType::type { return to_thrift(c); });
682  return result;
683 }
684 
686  const TOutputBufferSizeType::type& t) {
687  switch (t) {
688  case TOutputBufferSizeType::kConstant:
690  case TOutputBufferSizeType::kUserSpecifiedConstantParameter:
692  case TOutputBufferSizeType::kUserSpecifiedRowMultiplier:
694  case TOutputBufferSizeType::kTableFunctionSpecifiedParameter:
696  case TOutputBufferSizeType::kPreFlightParameter:
698  }
699  UNREACHABLE();
701 }
702 
705  switch (t) {
707  return TOutputBufferSizeType::kConstant;
709  return TOutputBufferSizeType::kUserSpecifiedConstantParameter;
711  return TOutputBufferSizeType::kUserSpecifiedRowMultiplier;
713  return TOutputBufferSizeType::kTableFunctionSpecifiedParameter;
715  return TOutputBufferSizeType::kPreFlightParameter;
716  }
717  UNREACHABLE();
719 }
720 
721 inline TUserDefinedFunction to_thrift(const ExtensionFunction& udf) {
722  TUserDefinedFunction tfunc;
723  tfunc.name = udf.getName(/* keep_suffix */ true);
724  tfunc.argTypes = to_thrift(udf.getInputArgs());
725  tfunc.retType = to_thrift(udf.getRet());
726  return tfunc;
727 }
728 
729 inline TUserDefinedTableFunction to_thrift(const table_functions::TableFunction& func) {
730  TUserDefinedTableFunction tfunc;
731  tfunc.name = func.getName();
732  tfunc.sizerType = to_thrift(func.getOutputRowSizeType());
733  tfunc.sizerArgPos = func.getOutputRowSizeParameter();
734  tfunc.inputArgTypes = to_thrift(func.getInputArgs());
735  tfunc.outputArgTypes = to_thrift(func.getOutputArgs());
736  tfunc.sqlArgTypes = to_thrift(func.getSqlArgs());
737  tfunc.annotations = func.getAnnotations();
738  return tfunc;
739 }
740 
741 inline std::vector<TUserDefinedTableFunction> to_thrift(
742  const std::vector<table_functions::TableFunction>& v) {
743  std::vector<TUserDefinedTableFunction> result;
744  std::transform(v.begin(),
745  v.end(),
746  std::back_inserter(result),
747  [](table_functions::TableFunction c) -> TUserDefinedTableFunction {
748  return to_thrift(c);
749  });
750  return result;
751 }
752 
753 } // namespace ThriftSerializers
754 
755 #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:405
SQLAgg
Definition: sqldefs.h:72
StringDictionaryGenerations string_dictionary_generations_from_thrift(const std::vector< TDictionaryGeneration > &thrift_string_dictionary_generations)
HOST DEVICE int get_size() const
Definition: sqltypes.h:414
Descriptor for the storage layout use for (approximate) count distinct operations.
TDatumType::type type_to_thrift(const SQLTypeInfo &type_info)
SQLTypes
Definition: sqltypes.h:52
#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:409
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:404
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:107
const std::vector< ExtArgumentType > & getOutputArgs() const
OUTPUT transform(INPUT const &input, FUNC const &func)
Definition: misc.h:296
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:407
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:67
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:77
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:413
const std::vector< ExtArgumentType > & getSqlArgs() const
#define CHECK(condition)
Definition: Logger.h:222
SQLTypes type
Definition: sqltypes.h:1023
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:411
TTypeInfo type_info_to_thrift(const SQLTypeInfo &ti)
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:981
OutputBufferSizeType getOutputRowSizeType() const
#define UNTHRIFT_LAYOUT_CASE(layout)
#define IS_GEO(T)
Definition: sqltypes.h:323
#define THRIFT_AGGKIND_CASE(kind)
bool is_array() const
Definition: sqltypes.h:608
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)