OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{RelAlgTranslator.cpp} Namespace Reference

Functions

SQLTypeInfo build_type_info (const SQLTypes sql_type, const int scale, const int precision)
 
std::pair< std::shared_ptr
< Analyzer::Expr >
, SQLQualifier
get_quantified_rhs (const RexScalar *rex_scalar, const RelAlgTranslator &translator)
 
std::pair< Datum, bool > datum_from_scalar_tv (const ScalarTargetValue *scalar_tv, const SQLTypeInfo &ti) noexcept
 
bool is_agg_supported_for_type (const SQLAgg &agg_kind, const SQLTypeInfo &arg_ti)
 
std::shared_ptr< Analyzer::Exprget_in_values_expr (std::shared_ptr< Analyzer::Expr > arg, const ResultSet &val_set)
 
void fill_dictionary_encoded_in_vals (std::vector< int64_t > &in_vals, std::atomic< size_t > &total_in_vals_count, const ResultSet *values_rowset, const std::pair< int64_t, int64_t > values_rowset_slice, const StringDictionaryProxy *source_dict, const StringDictionaryProxy *dest_dict, const int64_t needle_null_val)
 
void fill_integer_in_vals (std::vector< int64_t > &in_vals, std::atomic< size_t > &total_in_vals_count, const ResultSet *values_rowset, const std::pair< int64_t, int64_t > values_rowset_slice)
 
void fill_dictionary_encoded_in_vals (std::vector< int64_t > &in_vals, std::atomic< size_t > &total_in_vals_count, const ResultSet *values_rowset, const std::pair< int64_t, int64_t > values_rowset_slice, const std::vector< LeafHostInfo > &leaf_hosts, const DictRef source_dict_ref, const DictRef dest_dict_ref, const int32_t dest_generation, const int64_t needle_null_val)
 
void validate_datetime_datepart_argument (const std::shared_ptr< Analyzer::Constant > literal_expr)
 
std::shared_ptr
< Analyzer::Constant
makeNumericConstant (const SQLTypeInfo &ti, const long val)
 
std::string get_datetimeplus_rewrite_funcname (const SQLOps &op)
 
std::vector< Analyzer::OrderEntrytranslate_collation (const std::vector< SortField > &sort_fields)
 
bool supported_lower_bound (const RexWindowFunctionOperator::RexWindowBound &window_bound)
 
bool supported_upper_bound (const RexWindowFunctionOperator *rex_window_function)
 

Variables

const size_t g_max_integer_set_size {1 << 25}
 

Function Documentation

SQLTypeInfo anonymous_namespace{RelAlgTranslator.cpp}::build_type_info ( const SQLTypes  sql_type,
const int  scale,
const int  precision 
)

Definition at line 43 of file RelAlgTranslator.cpp.

References SQLTypeInfo::is_decimal(), SQLTypeInfo::set_precision(), and SQLTypeInfo::set_scale().

Referenced by RelAlgTranslator::translateLiteral().

45  {
46  SQLTypeInfo ti(sql_type, 0, 0, true);
47  if (ti.is_decimal()) {
48  ti.set_scale(scale);
49  ti.set_precision(precision);
50  }
51  return ti;
52 }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::pair<Datum, bool> anonymous_namespace{RelAlgTranslator.cpp}::datum_from_scalar_tv ( const ScalarTargetValue scalar_tv,
const SQLTypeInfo ti 
)
noexcept

Definition at line 77 of file RelAlgTranslator.cpp.

References CHECK, inline_fp_null_val(), inline_int_null_val(), kBIGINT, kBOOLEAN, kCHAR, kDATE, kDECIMAL, kDOUBLE, kFLOAT, kINT, kNUMERIC, kSMALLINT, kTEXT, kTIME, kTIMESTAMP, kTINYINT, and kVARCHAR.

Referenced by get_in_values_expr(), RelAlgTranslator::translateInOper(), and RelAlgTranslator::translateScalarSubquery().

78  {
79  Datum d{0};
80  bool is_null_const{false};
81  switch (ti.get_type()) {
82  case kBOOLEAN: {
83  const auto ival = boost::get<int64_t>(scalar_tv);
84  CHECK(ival);
85  if (*ival == inline_int_null_val(ti)) {
86  is_null_const = true;
87  } else {
88  d.boolval = *ival;
89  }
90  break;
91  }
92  case kTINYINT: {
93  const auto ival = boost::get<int64_t>(scalar_tv);
94  CHECK(ival);
95  if (*ival == inline_int_null_val(ti)) {
96  is_null_const = true;
97  } else {
98  d.tinyintval = *ival;
99  }
100  break;
101  }
102  case kSMALLINT: {
103  const auto ival = boost::get<int64_t>(scalar_tv);
104  CHECK(ival);
105  if (*ival == inline_int_null_val(ti)) {
106  is_null_const = true;
107  } else {
108  d.smallintval = *ival;
109  }
110  break;
111  }
112  case kINT: {
113  const auto ival = boost::get<int64_t>(scalar_tv);
114  CHECK(ival);
115  if (*ival == inline_int_null_val(ti)) {
116  is_null_const = true;
117  } else {
118  d.intval = *ival;
119  }
120  break;
121  }
122  case kDECIMAL:
123  case kNUMERIC:
124  case kBIGINT:
125  case kDATE:
126  case kTIME:
127  case kTIMESTAMP: {
128  const auto ival = boost::get<int64_t>(scalar_tv);
129  CHECK(ival);
130  if (*ival == inline_int_null_val(ti)) {
131  is_null_const = true;
132  } else {
133  d.bigintval = *ival;
134  }
135  break;
136  }
137  case kDOUBLE: {
138  const auto dval = boost::get<double>(scalar_tv);
139  CHECK(dval);
140  if (*dval == inline_fp_null_val(ti)) {
141  is_null_const = true;
142  } else {
143  d.doubleval = *dval;
144  }
145  break;
146  }
147  case kFLOAT: {
148  const auto fval = boost::get<float>(scalar_tv);
149  CHECK(fval);
150  if (*fval == inline_fp_null_val(ti)) {
151  is_null_const = true;
152  } else {
153  d.floatval = *fval;
154  }
155  break;
156  }
157  case kTEXT:
158  case kVARCHAR:
159  case kCHAR: {
160  auto nullable_sptr = boost::get<NullableString>(scalar_tv);
161  CHECK(nullable_sptr);
162  if (boost::get<void*>(nullable_sptr)) {
163  is_null_const = true;
164  } else {
165  auto sptr = boost::get<std::string>(nullable_sptr);
166  d.stringval = new std::string(*sptr);
167  }
168  break;
169  }
170  default:
171  CHECK(false) << "Unhandled type: " << ti.get_type_name();
172  }
173  return {d, is_null_const};
174 }
Definition: sqltypes.h:49
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:329
double inline_fp_null_val(const SQL_TYPE_INFO &ti)
Definition: sqltypes.h:52
Definition: sqltypes.h:53
std::string get_type_name() const
Definition: sqltypes.h:432
Definition: sqltypes.h:41
#define CHECK(condition)
Definition: Logger.h:209
int64_t inline_int_null_val(const SQL_TYPE_INFO &ti)
Definition: sqltypes.h:45

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void anonymous_namespace{RelAlgTranslator.cpp}::fill_dictionary_encoded_in_vals ( std::vector< int64_t > &  in_vals,
std::atomic< size_t > &  total_in_vals_count,
const ResultSet values_rowset,
const std::pair< int64_t, int64_t >  values_rowset_slice,
const StringDictionaryProxy source_dict,
const StringDictionaryProxy dest_dict,
const int64_t  needle_null_val 
)

Definition at line 638 of file RelAlgTranslator.cpp.

References CHECK, g_enable_watchdog, g_max_integer_set_size, StringDictionaryProxy::getIdOfString(), StringDictionaryProxy::getString(), StringDictionary::INVALID_STR_ID, and UNLIKELY.

Referenced by RelAlgTranslator::getInIntegerSetExpr().

645  {
646  CHECK(in_vals.empty());
647  bool dicts_are_equal = source_dict == dest_dict;
648  for (auto index = values_rowset_slice.first; index < values_rowset_slice.second;
649  ++index) {
650  const auto row = values_rowset->getOneColRow(index);
651  if (UNLIKELY(!row.valid)) {
652  continue;
653  }
654  if (dicts_are_equal) {
655  in_vals.push_back(row.value);
656  } else {
657  const int string_id =
658  row.value == needle_null_val
659  ? needle_null_val
660  : dest_dict->getIdOfString(source_dict->getString(row.value));
661  if (string_id != StringDictionary::INVALID_STR_ID) {
662  in_vals.push_back(string_id);
663  }
664  }
665  if (UNLIKELY(g_enable_watchdog && (in_vals.size() & 1023) == 0 &&
666  total_in_vals_count.fetch_add(1024) >= g_max_integer_set_size)) {
667  throw std::runtime_error(
668  "Unable to handle 'expr IN (subquery)', subquery returned 30M+ rows.");
669  }
670  }
671 }
bool g_enable_watchdog
std::string getString(int32_t string_id) const
static constexpr int32_t INVALID_STR_ID
#define UNLIKELY(x)
Definition: likely.h:25
#define CHECK(condition)
Definition: Logger.h:209
int32_t getIdOfString(const std::string &str) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void anonymous_namespace{RelAlgTranslator.cpp}::fill_dictionary_encoded_in_vals ( std::vector< int64_t > &  in_vals,
std::atomic< size_t > &  total_in_vals_count,
const ResultSet values_rowset,
const std::pair< int64_t, int64_t >  values_rowset_slice,
const std::vector< LeafHostInfo > &  leaf_hosts,
const DictRef  source_dict_ref,
const DictRef  dest_dict_ref,
const int32_t  dest_generation,
const int64_t  needle_null_val 
)

Definition at line 699 of file RelAlgTranslator.cpp.

References CHECK, CHECK_EQ, g_enable_watchdog, g_max_integer_set_size, StringDictionary::INVALID_STR_ID, translate_string_ids(), and UNLIKELY.

708  {
709  CHECK(in_vals.empty());
710  std::vector<int32_t> source_ids;
711  source_ids.reserve(values_rowset->entryCount());
712  bool has_nulls = false;
713  if (source_dict_ref == dest_dict_ref) {
714  in_vals.reserve(values_rowset_slice.second - values_rowset_slice.first +
715  1); // Add 1 to cover interval
716  for (auto index = values_rowset_slice.first; index < values_rowset_slice.second;
717  ++index) {
718  const auto row = values_rowset->getOneColRow(index);
719  if (!row.valid) {
720  continue;
721  }
722  if (row.value != needle_null_val) {
723  in_vals.push_back(row.value);
724  if (UNLIKELY(g_enable_watchdog && (in_vals.size() & 1023) == 0 &&
725  total_in_vals_count.fetch_add(1024) >= g_max_integer_set_size)) {
726  throw std::runtime_error(
727  "Unable to handle 'expr IN (subquery)', subquery returned 30M+ rows.");
728  }
729  } else {
730  has_nulls = true;
731  }
732  }
733  if (has_nulls) {
734  in_vals.push_back(
735  needle_null_val); // we've deduped null values as an optimization, although
736  // this is not required by consumer
737  }
738  return;
739  }
740  // Code path below is for when dictionaries are not shared
741  for (auto index = values_rowset_slice.first; index < values_rowset_slice.second;
742  ++index) {
743  const auto row = values_rowset->getOneColRow(index);
744  if (row.valid) {
745  if (row.value != needle_null_val) {
746  source_ids.push_back(row.value);
747  } else {
748  has_nulls = true;
749  }
750  }
751  }
752  std::vector<int32_t> dest_ids;
753  translate_string_ids(dest_ids,
754  leaf_hosts.front(),
755  dest_dict_ref,
756  source_ids,
757  source_dict_ref,
758  dest_generation);
759  CHECK_EQ(dest_ids.size(), source_ids.size());
760  in_vals.reserve(dest_ids.size() + (has_nulls ? 1 : 0));
761  if (has_nulls) {
762  in_vals.push_back(needle_null_val);
763  }
764  for (const int32_t dest_id : dest_ids) {
765  if (dest_id != StringDictionary::INVALID_STR_ID) {
766  in_vals.push_back(dest_id);
767  if (UNLIKELY(g_enable_watchdog && (in_vals.size() & 1023) == 0 &&
768  total_in_vals_count.fetch_add(1024) >= g_max_integer_set_size)) {
769  throw std::runtime_error(
770  "Unable to handle 'expr IN (subquery)', subquery returned 30M+ rows.");
771  }
772  }
773  }
774 }
#define CHECK_EQ(x, y)
Definition: Logger.h:217
bool g_enable_watchdog
static constexpr int32_t INVALID_STR_ID
void translate_string_ids(std::vector< int32_t > &dest_ids, const LeafHostInfo &dict_server_host, const DictRef dest_dict_ref, const std::vector< int32_t > &source_ids, const DictRef source_dict_ref, const int32_t dest_generation)
#define UNLIKELY(x)
Definition: likely.h:25
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the call graph for this function:

void anonymous_namespace{RelAlgTranslator.cpp}::fill_integer_in_vals ( std::vector< int64_t > &  in_vals,
std::atomic< size_t > &  total_in_vals_count,
const ResultSet values_rowset,
const std::pair< int64_t, int64_t >  values_rowset_slice 
)

Definition at line 673 of file RelAlgTranslator.cpp.

References CHECK, g_enable_watchdog, g_max_integer_set_size, and UNLIKELY.

Referenced by RelAlgTranslator::getInIntegerSetExpr().

676  {
677  CHECK(in_vals.empty());
678  for (auto index = values_rowset_slice.first; index < values_rowset_slice.second;
679  ++index) {
680  const auto row = values_rowset->getOneColRow(index);
681  if (row.valid) {
682  in_vals.push_back(row.value);
683  if (UNLIKELY(g_enable_watchdog && (in_vals.size() & 1023) == 0 &&
684  total_in_vals_count.fetch_add(1024) >= g_max_integer_set_size)) {
685  throw std::runtime_error(
686  "Unable to handle 'expr IN (subquery)', subquery returned 30M+ rows.");
687  }
688  }
689  }
690 }
bool g_enable_watchdog
#define UNLIKELY(x)
Definition: likely.h:25
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the caller graph for this function:

std::string anonymous_namespace{RelAlgTranslator.cpp}::get_datetimeplus_rewrite_funcname ( const SQLOps op)

Definition at line 1138 of file RelAlgTranslator.cpp.

References CHECK, and kPLUS.

Referenced by RelAlgTranslator::translateDatePlusMinus().

1138  {
1139  CHECK(op == kPLUS);
1140  return "DATETIME_PLUS"s;
1141 }
Definition: sqldefs.h:41
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the caller graph for this function:

std::shared_ptr<Analyzer::Expr> anonymous_namespace{RelAlgTranslator.cpp}::get_in_values_expr ( std::shared_ptr< Analyzer::Expr arg,
const ResultSet val_set 
)

Definition at line 493 of file RelAlgTranslator.cpp.

References threading_serial::async(), result_set::can_use_parallel_algorithms(), cpu_threads(), datum_from_scalar_tv(), g_enable_watchdog, i, kCAST, and kENCODING_NONE.

Referenced by RelAlgTranslator::translateInOper().

494  {
496  return nullptr;
497  }
498  if (val_set.rowCount() > 5000000 && g_enable_watchdog) {
499  throw std::runtime_error(
500  "Unable to handle 'expr IN (subquery)', subquery returned 5M+ rows.");
501  }
502  std::list<std::shared_ptr<Analyzer::Expr>> value_exprs;
503  const size_t fetcher_count = cpu_threads();
504  std::vector<std::list<std::shared_ptr<Analyzer::Expr>>> expr_set(
505  fetcher_count, std::list<std::shared_ptr<Analyzer::Expr>>());
506  std::vector<std::future<void>> fetcher_threads;
507  const auto& ti = arg->get_type_info();
508  const auto entry_count = val_set.entryCount();
509  for (size_t i = 0,
510  start_entry = 0,
511  stride = (entry_count + fetcher_count - 1) / fetcher_count;
512  i < fetcher_count && start_entry < entry_count;
513  ++i, start_entry += stride) {
514  const auto end_entry = std::min(start_entry + stride, entry_count);
515  fetcher_threads.push_back(std::async(
517  [&](std::list<std::shared_ptr<Analyzer::Expr>>& in_vals,
518  const size_t start,
519  const size_t end) {
520  for (auto index = start; index < end; ++index) {
521  auto row = val_set.getRowAt(index);
522  if (row.empty()) {
523  continue;
524  }
525  auto scalar_tv = boost::get<ScalarTargetValue>(&row[0]);
526  Datum d{0};
527  bool is_null_const{false};
528  std::tie(d, is_null_const) = datum_from_scalar_tv(scalar_tv, ti);
529  if (ti.is_string() && ti.get_compression() != kENCODING_NONE) {
530  auto ti_none_encoded = ti;
531  ti_none_encoded.set_compression(kENCODING_NONE);
532  auto none_encoded_string =
533  makeExpr<Analyzer::Constant>(ti, is_null_const, d);
534  auto dict_encoded_string = std::make_shared<Analyzer::UOper>(
535  ti, false, kCAST, none_encoded_string);
536  in_vals.push_back(dict_encoded_string);
537  } else {
538  in_vals.push_back(makeExpr<Analyzer::Constant>(ti, is_null_const, d));
539  }
540  }
541  },
542  std::ref(expr_set[i]),
543  start_entry,
544  end_entry));
545  }
546  for (auto& child : fetcher_threads) {
547  child.get();
548  }
549 
550  val_set.moveToBegin();
551  for (auto& exprs : expr_set) {
552  value_exprs.splice(value_exprs.end(), exprs);
553  }
554  return makeExpr<Analyzer::InValues>(arg, value_exprs);
555 }
bool g_enable_watchdog
Definition: sqldefs.h:49
future< Result > async(Fn &&fn, Args &&...args)
std::pair< Datum, bool > datum_from_scalar_tv(const ScalarTargetValue *scalar_tv, const SQLTypeInfo &ti) noexcept
int cpu_threads()
Definition: thread_count.h:24
bool can_use_parallel_algorithms(const ResultSet &rows)
Definition: ResultSet.cpp:1135

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::pair<std::shared_ptr<Analyzer::Expr>, SQLQualifier> anonymous_namespace{RelAlgTranslator.cpp}::get_quantified_rhs ( const RexScalar rex_scalar,
const RelAlgTranslator translator 
)

Definition at line 54 of file RelAlgTranslator.cpp.

References CHECK_EQ, RexFunctionOperator::getName(), kALL, kANY, kCAST, kONE, and RelAlgTranslator::translateScalarRex().

Referenced by RelAlgTranslator::translateOper().

56  {
57  std::shared_ptr<Analyzer::Expr> rhs;
58  SQLQualifier sql_qual{kONE};
59  const auto rex_operator = dynamic_cast<const RexOperator*>(rex_scalar);
60  if (!rex_operator) {
61  return std::make_pair(rhs, sql_qual);
62  }
63  const auto rex_function = dynamic_cast<const RexFunctionOperator*>(rex_operator);
64  const auto qual_str = rex_function ? rex_function->getName() : "";
65  if (qual_str == "PG_ANY"sv || qual_str == "PG_ALL"sv) {
66  CHECK_EQ(size_t(1), rex_function->size());
67  rhs = translator.translateScalarRex(rex_function->getOperand(0));
68  sql_qual = (qual_str == "PG_ANY"sv) ? kANY : kALL;
69  }
70  if (!rhs && rex_operator->getOperator() == kCAST) {
71  CHECK_EQ(size_t(1), rex_operator->size());
72  std::tie(rhs, sql_qual) = get_quantified_rhs(rex_operator->getOperand(0), translator);
73  }
74  return std::make_pair(rhs, sql_qual);
75 }
Definition: sqldefs.h:69
#define CHECK_EQ(x, y)
Definition: Logger.h:217
SQLQualifier
Definition: sqldefs.h:69
std::shared_ptr< Analyzer::Expr > translateScalarRex(const RexScalar *rex) const
Definition: sqldefs.h:49
Definition: sqldefs.h:69
std::pair< std::shared_ptr< Analyzer::Expr >, SQLQualifier > get_quantified_rhs(const RexScalar *rex_scalar, const RelAlgTranslator &translator)
Definition: sqldefs.h:69
const std::string & getName() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool anonymous_namespace{RelAlgTranslator.cpp}::is_agg_supported_for_type ( const SQLAgg agg_kind,
const SQLTypeInfo arg_ti 
)

Definition at line 214 of file RelAlgTranslator.cpp.

References SQLTypeInfo::is_boolean(), SQLTypeInfo::is_number(), SQLTypeInfo::is_time(), kAVG, kMAX, kMIN, and kSUM.

Referenced by RelAlgTranslator::translateAggregateRex().

214  {
215  if ((agg_kind == kMIN || agg_kind == kMAX || agg_kind == kSUM || agg_kind == kAVG) &&
216  !(arg_ti.is_number() || arg_ti.is_boolean() || arg_ti.is_time())) {
217  return false;
218  }
219 
220  return true;
221 }
bool is_number() const
Definition: sqltypes.h:514
bool is_time() const
Definition: sqltypes.h:515
Definition: sqldefs.h:73
Definition: sqldefs.h:75
bool is_boolean() const
Definition: sqltypes.h:516
Definition: sqldefs.h:74
Definition: sqldefs.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::shared_ptr<Analyzer::Constant> anonymous_namespace{RelAlgTranslator.cpp}::makeNumericConstant ( const SQLTypeInfo ti,
const long  val 
)

Definition at line 1070 of file RelAlgTranslator.cpp.

References CHECK, exp_to_scale(), SQLTypeInfo::get_scale(), SQLTypeInfo::get_type(), SQLTypeInfo::is_number(), kBIGINT, kDECIMAL, kDOUBLE, kFLOAT, kINT, kNUMERIC, kSMALLINT, and kTINYINT.

Referenced by RelAlgTranslator::translateAbs(), RelAlgTranslator::translateCardinality(), RelAlgTranslator::translateDatePlusMinus(), and RelAlgTranslator::translateSign().

1071  {
1072  CHECK(ti.is_number());
1073  Datum datum{0};
1074  switch (ti.get_type()) {
1075  case kTINYINT: {
1076  datum.tinyintval = val;
1077  break;
1078  }
1079  case kSMALLINT: {
1080  datum.smallintval = val;
1081  break;
1082  }
1083  case kINT: {
1084  datum.intval = val;
1085  break;
1086  }
1087  case kBIGINT: {
1088  datum.bigintval = val;
1089  break;
1090  }
1091  case kDECIMAL:
1092  case kNUMERIC: {
1093  datum.bigintval = val * exp_to_scale(ti.get_scale());
1094  break;
1095  }
1096  case kFLOAT: {
1097  datum.floatval = val;
1098  break;
1099  }
1100  case kDOUBLE: {
1101  datum.doubleval = val;
1102  break;
1103  }
1104  default:
1105  CHECK(false);
1106  }
1107  return makeExpr<Analyzer::Constant>(ti, false, datum);
1108 }
HOST DEVICE int get_scale() const
Definition: sqltypes.h:334
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:329
bool is_number() const
Definition: sqltypes.h:514
#define CHECK(condition)
Definition: Logger.h:209
uint64_t exp_to_scale(const unsigned exp)
Definition: sqltypes.h:45

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool anonymous_namespace{RelAlgTranslator.cpp}::supported_lower_bound ( const RexWindowFunctionOperator::RexWindowBound window_bound)
bool anonymous_namespace{RelAlgTranslator.cpp}::supported_upper_bound ( const RexWindowFunctionOperator rex_window_function)

Definition at line 1769 of file RelAlgTranslator.cpp.

References CUME_DIST, DENSE_RANK, RexWindowFunctionOperator::getKind(), RexWindowFunctionOperator::getOrderKeys(), RexWindowFunctionOperator::getUpperBound(), RANK, ROW_NUMBER, and RexWindowFunctionOperator::RexWindowBound::unbounded.

Referenced by RelAlgTranslator::translateWindowFunction().

1769  {
1770  const auto& window_bound = rex_window_function->getUpperBound();
1771  const bool to_current_row = !window_bound.unbounded && !window_bound.preceding &&
1772  !window_bound.following && window_bound.is_current_row &&
1773  !window_bound.offset && window_bound.order_key == 1;
1774  switch (rex_window_function->getKind()) {
1779  return to_current_row;
1780  }
1781  default: {
1782  return rex_window_function->getOrderKeys().empty()
1783  ? (window_bound.unbounded && !window_bound.preceding &&
1784  window_bound.following && !window_bound.is_current_row &&
1785  !window_bound.offset && window_bound.order_key == 2)
1786  : to_current_row;
1787  }
1788  }
1789 }
SqlWindowFunctionKind getKind() const
const RexWindowBound & getUpperBound() const
const ConstRexScalarPtrVector & getOrderKeys() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector<Analyzer::OrderEntry> anonymous_namespace{RelAlgTranslator.cpp}::translate_collation ( const std::vector< SortField > &  sort_fields)

Definition at line 1750 of file RelAlgTranslator.cpp.

References Descending, First, and i.

Referenced by RelAlgTranslator::translateWindowFunction().

1751  {
1752  std::vector<Analyzer::OrderEntry> collation;
1753  for (size_t i = 0; i < sort_fields.size(); ++i) {
1754  const auto& sort_field = sort_fields[i];
1755  collation.emplace_back(i,
1756  sort_field.getSortDir() == SortDirection::Descending,
1757  sort_field.getNullsPosition() == NullSortedPosition::First);
1758  }
1759  return collation;
1760 }

+ Here is the caller graph for this function:

void anonymous_namespace{RelAlgTranslator.cpp}::validate_datetime_datepart_argument ( const std::shared_ptr< Analyzer::Constant literal_expr)
inline

Definition at line 1044 of file RelAlgTranslator.cpp.

Referenced by RelAlgTranslator::translateDateadd(), RelAlgTranslator::translateDatediff(), RelAlgTranslator::translateDatepart(), and RelAlgTranslator::translateExtract().

1045  {
1046  if (!literal_expr || literal_expr->get_is_null()) {
1047  throw std::runtime_error("The 'DatePart' argument must be a not 'null' literal.");
1048  }
1049 }

+ Here is the caller graph for this function:

Variable Documentation

const size_t anonymous_namespace{RelAlgTranslator.cpp}::g_max_integer_set_size {1 << 25}

Definition at line 636 of file RelAlgTranslator.cpp.

Referenced by fill_dictionary_encoded_in_vals(), and fill_integer_in_vals().