OmniSciDB  085a039ca4
 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 45 of file RelAlgTranslator.cpp.

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

Referenced by RelAlgTranslator::translateLiteral().

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

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

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

673  {
674  CHECK(in_vals.empty());
675  bool dicts_are_equal = source_dict == dest_dict;
676  for (auto index = values_rowset_slice.first; index < values_rowset_slice.second;
677  ++index) {
678  const auto row = values_rowset->getOneColRow(index);
679  if (UNLIKELY(!row.valid)) {
680  continue;
681  }
682  if (dicts_are_equal) {
683  in_vals.push_back(row.value);
684  } else {
685  const int string_id =
686  row.value == needle_null_val
687  ? needle_null_val
688  : dest_dict->getIdOfString(source_dict->getString(row.value));
689  if (string_id != StringDictionary::INVALID_STR_ID) {
690  in_vals.push_back(string_id);
691  }
692  }
693  if (UNLIKELY(g_enable_watchdog && (in_vals.size() & 1023) == 0 &&
694  total_in_vals_count.fetch_add(1024) >= g_max_integer_set_size)) {
695  throw std::runtime_error(
696  "Unable to handle 'expr IN (subquery)', subquery returned 30M+ rows.");
697  }
698  }
699 }
std::string getString(int32_t string_id) const
static constexpr int32_t INVALID_STR_ID
bool g_enable_watchdog
#define UNLIKELY(x)
Definition: likely.h:25
#define CHECK(condition)
Definition: Logger.h:223
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 727 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.

736  {
737  CHECK(in_vals.empty());
738  std::vector<int32_t> source_ids;
739  source_ids.reserve(values_rowset->entryCount());
740  bool has_nulls = false;
741  if (source_dict_ref == dest_dict_ref) {
742  in_vals.reserve(values_rowset_slice.second - values_rowset_slice.first +
743  1); // Add 1 to cover interval
744  for (auto index = values_rowset_slice.first; index < values_rowset_slice.second;
745  ++index) {
746  const auto row = values_rowset->getOneColRow(index);
747  if (!row.valid) {
748  continue;
749  }
750  if (row.value != needle_null_val) {
751  in_vals.push_back(row.value);
752  if (UNLIKELY(g_enable_watchdog && (in_vals.size() & 1023) == 0 &&
753  total_in_vals_count.fetch_add(1024) >= g_max_integer_set_size)) {
754  throw std::runtime_error(
755  "Unable to handle 'expr IN (subquery)', subquery returned 30M+ rows.");
756  }
757  } else {
758  has_nulls = true;
759  }
760  }
761  if (has_nulls) {
762  in_vals.push_back(
763  needle_null_val); // we've deduped null values as an optimization, although
764  // this is not required by consumer
765  }
766  return;
767  }
768  // Code path below is for when dictionaries are not shared
769  for (auto index = values_rowset_slice.first; index < values_rowset_slice.second;
770  ++index) {
771  const auto row = values_rowset->getOneColRow(index);
772  if (row.valid) {
773  if (row.value != needle_null_val) {
774  source_ids.push_back(row.value);
775  } else {
776  has_nulls = true;
777  }
778  }
779  }
780  std::vector<int32_t> dest_ids;
781  translate_string_ids(dest_ids,
782  leaf_hosts.front(),
783  dest_dict_ref,
784  source_ids,
785  source_dict_ref,
786  dest_generation);
787  CHECK_EQ(dest_ids.size(), source_ids.size());
788  in_vals.reserve(dest_ids.size() + (has_nulls ? 1 : 0));
789  if (has_nulls) {
790  in_vals.push_back(needle_null_val);
791  }
792  for (const int32_t dest_id : dest_ids) {
793  if (dest_id != StringDictionary::INVALID_STR_ID) {
794  in_vals.push_back(dest_id);
795  if (UNLIKELY(g_enable_watchdog && (in_vals.size() & 1023) == 0 &&
796  total_in_vals_count.fetch_add(1024) >= g_max_integer_set_size)) {
797  throw std::runtime_error(
798  "Unable to handle 'expr IN (subquery)', subquery returned 30M+ rows.");
799  }
800  }
801  }
802 }
#define CHECK_EQ(x, y)
Definition: Logger.h:231
static constexpr int32_t INVALID_STR_ID
bool g_enable_watchdog
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:223

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

References CHECK, g_enable_watchdog, g_max_integer_set_size, and UNLIKELY.

Referenced by RelAlgTranslator::getInIntegerSetExpr().

704  {
705  CHECK(in_vals.empty());
706  for (auto index = values_rowset_slice.first; index < values_rowset_slice.second;
707  ++index) {
708  const auto row = values_rowset->getOneColRow(index);
709  if (row.valid) {
710  in_vals.push_back(row.value);
711  if (UNLIKELY(g_enable_watchdog && (in_vals.size() & 1023) == 0 &&
712  total_in_vals_count.fetch_add(1024) >= g_max_integer_set_size)) {
713  throw std::runtime_error(
714  "Unable to handle 'expr IN (subquery)', subquery returned 30M+ rows.");
715  }
716  }
717  }
718 }
bool g_enable_watchdog
#define UNLIKELY(x)
Definition: likely.h:25
#define CHECK(condition)
Definition: Logger.h:223

+ Here is the caller graph for this function:

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

Definition at line 1169 of file RelAlgTranslator.cpp.

References CHECK, and kPLUS.

Referenced by RelAlgTranslator::translateDatePlusMinus().

1169  {
1170  CHECK(op == kPLUS);
1171  return "DATETIME_PLUS"s;
1172 }
Definition: sqldefs.h:41
#define CHECK(condition)
Definition: Logger.h:223

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

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

Referenced by RelAlgTranslator::translateInOper().

522  {
524  return nullptr;
525  }
526  if (val_set.rowCount() > 5000000 && g_enable_watchdog) {
527  throw std::runtime_error(
528  "Unable to handle 'expr IN (subquery)', subquery returned 5M+ rows.");
529  }
530  std::list<std::shared_ptr<Analyzer::Expr>> value_exprs;
531  const size_t fetcher_count = cpu_threads();
532  std::vector<std::list<std::shared_ptr<Analyzer::Expr>>> expr_set(
533  fetcher_count, std::list<std::shared_ptr<Analyzer::Expr>>());
534  std::vector<std::future<void>> fetcher_threads;
535  const auto& ti = arg->get_type_info();
536  const auto entry_count = val_set.entryCount();
537  for (size_t i = 0,
538  start_entry = 0,
539  stride = (entry_count + fetcher_count - 1) / fetcher_count;
540  i < fetcher_count && start_entry < entry_count;
541  ++i, start_entry += stride) {
542  const auto end_entry = std::min(start_entry + stride, entry_count);
543  fetcher_threads.push_back(std::async(
545  [&](std::list<std::shared_ptr<Analyzer::Expr>>& in_vals,
546  const size_t start,
547  const size_t end) {
548  for (auto index = start; index < end; ++index) {
549  auto row = val_set.getRowAt(index);
550  if (row.empty()) {
551  continue;
552  }
553  auto scalar_tv = boost::get<ScalarTargetValue>(&row[0]);
554  Datum d{0};
555  bool is_null_const{false};
556  std::tie(d, is_null_const) = datum_from_scalar_tv(scalar_tv, ti);
557  if (ti.is_string() && ti.get_compression() != kENCODING_NONE) {
558  auto ti_none_encoded = ti;
559  ti_none_encoded.set_compression(kENCODING_NONE);
560  auto none_encoded_string =
561  makeExpr<Analyzer::Constant>(ti, is_null_const, d);
562  auto dict_encoded_string = std::make_shared<Analyzer::UOper>(
563  ti, false, kCAST, none_encoded_string);
564  in_vals.push_back(dict_encoded_string);
565  } else {
566  in_vals.push_back(makeExpr<Analyzer::Constant>(ti, is_null_const, d));
567  }
568  }
569  },
570  std::ref(expr_set[i]),
571  start_entry,
572  end_entry));
573  }
574  for (auto& child : fetcher_threads) {
575  child.get();
576  }
577 
578  val_set.moveToBegin();
579  for (auto& exprs : expr_set) {
580  value_exprs.splice(value_exprs.end(), exprs);
581  }
582  return makeExpr<Analyzer::InValues>(arg, value_exprs);
583 }
Definition: sqldefs.h:49
future< Result > async(Fn &&fn, Args &&...args)
bool g_enable_watchdog
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:1449

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

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

Referenced by RelAlgTranslator::translateOper().

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

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

Referenced by RelAlgTranslator::translateAggregateRex().

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

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

1102  {
1103  CHECK(ti.is_number());
1104  Datum datum{0};
1105  switch (ti.get_type()) {
1106  case kTINYINT: {
1107  datum.tinyintval = val;
1108  break;
1109  }
1110  case kSMALLINT: {
1111  datum.smallintval = val;
1112  break;
1113  }
1114  case kINT: {
1115  datum.intval = val;
1116  break;
1117  }
1118  case kBIGINT: {
1119  datum.bigintval = val;
1120  break;
1121  }
1122  case kDECIMAL:
1123  case kNUMERIC: {
1124  datum.bigintval = val * exp_to_scale(ti.get_scale());
1125  break;
1126  }
1127  case kFLOAT: {
1128  datum.floatval = val;
1129  break;
1130  }
1131  case kDOUBLE: {
1132  datum.doubleval = val;
1133  break;
1134  }
1135  default:
1136  CHECK(false);
1137  }
1138  return makeExpr<Analyzer::Constant>(ti, false, datum);
1139 }
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:515
#define CHECK(condition)
Definition: Logger.h:223
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 1865 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().

1865  {
1866  const auto& window_bound = rex_window_function->getUpperBound();
1867  const bool to_current_row = !window_bound.unbounded && !window_bound.preceding &&
1868  !window_bound.following && window_bound.is_current_row &&
1869  !window_bound.offset && window_bound.order_key == 1;
1870  switch (rex_window_function->getKind()) {
1875  return to_current_row;
1876  }
1877  default: {
1878  return rex_window_function->getOrderKeys().empty()
1879  ? (window_bound.unbounded && !window_bound.preceding &&
1880  window_bound.following && !window_bound.is_current_row &&
1881  !window_bound.offset && window_bound.order_key == 2)
1882  : to_current_row;
1883  }
1884  }
1885 }
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 1846 of file RelAlgTranslator.cpp.

References Descending, and First.

Referenced by RelAlgTranslator::translateWindowFunction().

1847  {
1848  std::vector<Analyzer::OrderEntry> collation;
1849  for (size_t i = 0; i < sort_fields.size(); ++i) {
1850  const auto& sort_field = sort_fields[i];
1851  collation.emplace_back(i,
1852  sort_field.getSortDir() == SortDirection::Descending,
1853  sort_field.getNullsPosition() == NullSortedPosition::First);
1854  }
1855  return collation;
1856 }

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

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

1076  {
1077  if (!literal_expr || literal_expr->get_is_null()) {
1078  throw std::runtime_error("The 'DatePart' argument must be a not 'null' literal.");
1079  }
1080 }

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

Referenced by fill_dictionary_encoded_in_vals(), and fill_integer_in_vals().