OmniSciDB  06b3bd477c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 44 of file RelAlgTranslator.cpp.

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

Referenced by RelAlgTranslator::translateLiteral().

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

+ 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 78 of file RelAlgTranslator.cpp.

References CHECK(), inline_fp_null_val(), inline_int_null_val(), kBIGINT, 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().

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

+ 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 593 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().

600  {
601  CHECK(in_vals.empty());
602  bool dicts_are_equal = source_dict == dest_dict;
603  for (auto index = values_rowset_slice.first; index < values_rowset_slice.second;
604  ++index) {
605  const auto row = values_rowset->getOneColRow(index);
606  if (UNLIKELY(!row.valid)) {
607  continue;
608  }
609  if (dicts_are_equal) {
610  in_vals.push_back(row.value);
611  } else {
612  const int string_id =
613  row.value == needle_null_val
614  ? needle_null_val
615  : dest_dict->getIdOfString(source_dict->getString(row.value));
616  if (string_id != StringDictionary::INVALID_STR_ID) {
617  in_vals.push_back(string_id);
618  }
619  }
620  if (UNLIKELY(g_enable_watchdog && (in_vals.size() & 1023) == 0 &&
621  total_in_vals_count.fetch_add(1024) >= g_max_integer_set_size)) {
622  throw std::runtime_error(
623  "Unable to handle 'expr IN (subquery)', subquery returned 30M+ rows.");
624  }
625  }
626 }
bool g_enable_watchdog
std::string getString(int32_t string_id) const
static constexpr int32_t INVALID_STR_ID
CHECK(cgen_state)
#define UNLIKELY(x)
Definition: likely.h:20
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 654 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.

663  {
664  CHECK(in_vals.empty());
665  std::vector<int32_t> source_ids;
666  source_ids.reserve(values_rowset->entryCount());
667  bool has_nulls = false;
668  if (source_dict_ref == dest_dict_ref) {
669  in_vals.reserve(values_rowset_slice.second - values_rowset_slice.first +
670  1); // Add 1 to cover interval
671  for (auto index = values_rowset_slice.first; index < values_rowset_slice.second;
672  ++index) {
673  const auto row = values_rowset->getOneColRow(index);
674  if (!row.valid) {
675  continue;
676  }
677  if (row.value != needle_null_val) {
678  in_vals.push_back(row.value);
679  if (UNLIKELY(g_enable_watchdog && (in_vals.size() & 1023) == 0 &&
680  total_in_vals_count.fetch_add(1024) >= g_max_integer_set_size)) {
681  throw std::runtime_error(
682  "Unable to handle 'expr IN (subquery)', subquery returned 30M+ rows.");
683  }
684  } else {
685  has_nulls = true;
686  }
687  }
688  if (has_nulls) {
689  in_vals.push_back(
690  needle_null_val); // we've deduped null values as an optimization, although
691  // this is not required by consumer
692  }
693  return;
694  }
695  // Code path below is for when dictionaries are not shared
696  for (auto index = values_rowset_slice.first; index < values_rowset_slice.second;
697  ++index) {
698  const auto row = values_rowset->getOneColRow(index);
699  if (row.valid) {
700  if (row.value != needle_null_val) {
701  source_ids.push_back(row.value);
702  } else {
703  has_nulls = true;
704  }
705  }
706  }
707  std::vector<int32_t> dest_ids;
708  translate_string_ids(dest_ids,
709  leaf_hosts.front(),
710  dest_dict_ref,
711  source_ids,
712  source_dict_ref,
713  dest_generation);
714  CHECK_EQ(dest_ids.size(), source_ids.size());
715  in_vals.reserve(dest_ids.size() + (has_nulls ? 1 : 0));
716  if (has_nulls) {
717  in_vals.push_back(needle_null_val);
718  }
719  for (const int32_t dest_id : dest_ids) {
720  if (dest_id != StringDictionary::INVALID_STR_ID) {
721  in_vals.push_back(dest_id);
722  if (UNLIKELY(g_enable_watchdog && (in_vals.size() & 1023) == 0 &&
723  total_in_vals_count.fetch_add(1024) >= g_max_integer_set_size)) {
724  throw std::runtime_error(
725  "Unable to handle 'expr IN (subquery)', subquery returned 30M+ rows.");
726  }
727  }
728  }
729 }
#define CHECK_EQ(x, y)
Definition: Logger.h:205
bool g_enable_watchdog
static constexpr int32_t INVALID_STR_ID
CHECK(cgen_state)
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:20

+ 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 628 of file RelAlgTranslator.cpp.

References CHECK(), g_enable_watchdog, g_max_integer_set_size, and UNLIKELY.

Referenced by RelAlgTranslator::getInIntegerSetExpr().

631  {
632  CHECK(in_vals.empty());
633  for (auto index = values_rowset_slice.first; index < values_rowset_slice.second;
634  ++index) {
635  const auto row = values_rowset->getOneColRow(index);
636  if (row.valid) {
637  in_vals.push_back(row.value);
638  if (UNLIKELY(g_enable_watchdog && (in_vals.size() & 1023) == 0 &&
639  total_in_vals_count.fetch_add(1024) >= g_max_integer_set_size)) {
640  throw std::runtime_error(
641  "Unable to handle 'expr IN (subquery)', subquery returned 30M+ rows.");
642  }
643  }
644  }
645 }
bool g_enable_watchdog
CHECK(cgen_state)
#define UNLIKELY(x)
Definition: likely.h:20

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 1079 of file RelAlgTranslator.cpp.

References CHECK(), and kPLUS.

Referenced by RelAlgTranslator::translateDatePlusMinus().

1079  {
1080  CHECK(op == kPLUS);
1081  return "DATETIME_PLUS"s;
1082 }
Definition: sqldefs.h:41
CHECK(cgen_state)

+ Here is the call graph for this function:

+ 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 449 of file RelAlgTranslator.cpp.

References can_use_parallel_algorithms(), cpu_threads(), datum_from_scalar_tv(), g_enable_watchdog, kCAST, and kENCODING_NONE.

Referenced by RelAlgTranslator::translateInOper().

450  {
451  if (!can_use_parallel_algorithms(val_set)) {
452  return nullptr;
453  }
454  if (val_set.rowCount() > 5000000 && g_enable_watchdog) {
455  throw std::runtime_error(
456  "Unable to handle 'expr IN (subquery)', subquery returned 5M+ rows.");
457  }
458  std::list<std::shared_ptr<Analyzer::Expr>> value_exprs;
459  const size_t fetcher_count = cpu_threads();
460  std::vector<std::list<std::shared_ptr<Analyzer::Expr>>> expr_set(
461  fetcher_count, std::list<std::shared_ptr<Analyzer::Expr>>());
462  std::vector<std::future<void>> fetcher_threads;
463  const auto& ti = arg->get_type_info();
464  const auto entry_count = val_set.entryCount();
465  for (size_t i = 0,
466  start_entry = 0,
467  stride = (entry_count + fetcher_count - 1) / fetcher_count;
468  i < fetcher_count && start_entry < entry_count;
469  ++i, start_entry += stride) {
470  const auto end_entry = std::min(start_entry + stride, entry_count);
471  fetcher_threads.push_back(std::async(
472  std::launch::async,
473  [&](std::list<std::shared_ptr<Analyzer::Expr>>& in_vals,
474  const size_t start,
475  const size_t end) {
476  for (auto index = start; index < end; ++index) {
477  auto row = val_set.getRowAt(index);
478  if (row.empty()) {
479  continue;
480  }
481  auto scalar_tv = boost::get<ScalarTargetValue>(&row[0]);
482  Datum d{0};
483  bool is_null_const{false};
484  std::tie(d, is_null_const) = datum_from_scalar_tv(scalar_tv, ti);
485  if (ti.is_string() && ti.get_compression() != kENCODING_NONE) {
486  auto ti_none_encoded = ti;
487  ti_none_encoded.set_compression(kENCODING_NONE);
488  auto none_encoded_string =
489  makeExpr<Analyzer::Constant>(ti, is_null_const, d);
490  auto dict_encoded_string = std::make_shared<Analyzer::UOper>(
491  ti, false, kCAST, none_encoded_string);
492  in_vals.push_back(dict_encoded_string);
493  } else {
494  in_vals.push_back(makeExpr<Analyzer::Constant>(ti, is_null_const, d));
495  }
496  }
497  },
498  std::ref(expr_set[i]),
499  start_entry,
500  end_entry));
501  }
502  for (auto& child : fetcher_threads) {
503  child.get();
504  }
505 
506  val_set.moveToBegin();
507  for (auto& exprs : expr_set) {
508  value_exprs.splice(value_exprs.end(), exprs);
509  }
510  return makeExpr<Analyzer::InValues>(arg, value_exprs);
511 }
bool g_enable_watchdog
Definition: sqldefs.h:49
bool can_use_parallel_algorithms(const ResultSet &rows)
Definition: ResultSet.cpp:996
std::pair< Datum, bool > datum_from_scalar_tv(const ScalarTargetValue *scalar_tv, const SQLTypeInfo &ti) noexcept
int cpu_threads()
Definition: thread_count.h:25

+ 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 55 of file RelAlgTranslator.cpp.

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

Referenced by RelAlgTranslator::translateOper().

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

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

Referenced by RelAlgTranslator::translateAggregateRex().

205  {
206  if ((agg_kind == kMIN || agg_kind == kMAX || agg_kind == kSUM || agg_kind == kAVG) &&
207  !(arg_ti.is_number() || arg_ti.is_boolean() || arg_ti.is_time())) {
208  return false;
209  }
210 
211  return true;
212 }
bool is_number() const
Definition: sqltypes.h:420
bool is_time() const
Definition: sqltypes.h:421
Definition: sqldefs.h:73
Definition: sqldefs.h:75
bool is_boolean() const
Definition: sqltypes.h:422
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 980 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::translateDateadd(), RelAlgTranslator::translateDatePlusMinus(), and RelAlgTranslator::translateSign().

981  {
982  CHECK(ti.is_number());
983  Datum datum{0};
984  switch (ti.get_type()) {
985  case kTINYINT: {
986  datum.tinyintval = val;
987  break;
988  }
989  case kSMALLINT: {
990  datum.smallintval = val;
991  break;
992  }
993  case kINT: {
994  datum.intval = val;
995  break;
996  }
997  case kBIGINT: {
998  datum.bigintval = val;
999  break;
1000  }
1001  case kDECIMAL:
1002  case kNUMERIC: {
1003  datum.bigintval = val * exp_to_scale(ti.get_scale());
1004  break;
1005  }
1006  case kFLOAT: {
1007  datum.floatval = val;
1008  break;
1009  }
1010  case kDOUBLE: {
1011  datum.doubleval = val;
1012  break;
1013  }
1014  default:
1015  CHECK(false);
1016  }
1017  return makeExpr<Analyzer::Constant>(ti, false, datum);
1018 }
HOST DEVICE int get_scale() const
Definition: sqltypes.h:263
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:258
bool is_number() const
Definition: sqltypes.h:420
CHECK(cgen_state)
uint64_t exp_to_scale(const unsigned exp)
Definition: sqltypes.h:46

+ 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 1657 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().

1657  {
1658  const auto& window_bound = rex_window_function->getUpperBound();
1659  const bool to_current_row = !window_bound.unbounded && !window_bound.preceding &&
1660  !window_bound.following && window_bound.is_current_row &&
1661  !window_bound.offset && window_bound.order_key == 1;
1662  switch (rex_window_function->getKind()) {
1667  return to_current_row;
1668  }
1669  default: {
1670  return rex_window_function->getOrderKeys().empty()
1671  ? (window_bound.unbounded && !window_bound.preceding &&
1672  window_bound.following && !window_bound.is_current_row &&
1673  !window_bound.offset && window_bound.order_key == 2)
1674  : to_current_row;
1675  }
1676  }
1677 }
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 1638 of file RelAlgTranslator.cpp.

References Descending, and First.

Referenced by RelAlgTranslator::translateWindowFunction().

1639  {
1640  std::vector<Analyzer::OrderEntry> collation;
1641  for (size_t i = 0; i < sort_fields.size(); ++i) {
1642  const auto& sort_field = sort_fields[i];
1643  collation.emplace_back(i,
1644  sort_field.getSortDir() == SortDirection::Descending,
1645  sort_field.getNullsPosition() == NullSortedPosition::First);
1646  }
1647  return collation;
1648 }

+ 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 954 of file RelAlgTranslator.cpp.

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

955  {
956  if (!literal_expr || literal_expr->get_is_null()) {
957  throw std::runtime_error("The 'DatePart' argument must be a not 'null' literal.");
958  }
959 }

+ 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 591 of file RelAlgTranslator.cpp.

Referenced by fill_dictionary_encoded_in_vals(), and fill_integer_in_vals().