OmniSciDB  cde582ebc3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Analyzer::BinOper Class Reference

#include <Analyzer.h>

+ Inheritance diagram for Analyzer::BinOper:
+ Collaboration diagram for Analyzer::BinOper:

Public Member Functions

 BinOper (const SQLTypeInfo &ti, bool has_agg, SQLOps o, SQLQualifier q, std::shared_ptr< Analyzer::Expr > l, std::shared_ptr< Analyzer::Expr > r)
 
 BinOper (SQLTypes t, SQLOps o, SQLQualifier q, std::shared_ptr< Analyzer::Expr > l, std::shared_ptr< Analyzer::Expr > r)
 
SQLOps get_optype () const
 
bool is_overlaps_oper () const
 
SQLQualifier get_qualifier () const
 
const Exprget_left_operand () const
 
const Exprget_right_operand () const
 
const std::shared_ptr
< Analyzer::Expr
get_own_left_operand () const
 
const std::shared_ptr
< Analyzer::Expr
get_own_right_operand () const
 
void check_group_by (const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const override
 
std::shared_ptr< Analyzer::Exprdeep_copy () const override
 
std::shared_ptr< Analyzer::Exprnormalize_simple_predicate (int &rte_idx) const override
 
void group_predicates (std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
 
void collect_rte_idx (std::set< int > &rte_idx_set) const override
 
void collect_column_var (std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
 
std::shared_ptr< Analyzer::Exprrewrite_with_targetlist (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
 
std::shared_ptr< Analyzer::Exprrewrite_with_child_targetlist (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
 
std::shared_ptr< Analyzer::Exprrewrite_agg_to_var (const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
 
bool operator== (const Expr &rhs) const override
 
std::string toString () const override
 
void find_expr (bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
 
- Public Member Functions inherited from Analyzer::Expr
 Expr (SQLTypes t, bool notnull)
 
 Expr (SQLTypes t, int d, bool notnull)
 
 Expr (SQLTypes t, int d, int s, bool notnull)
 
 Expr (const SQLTypeInfo &ti, bool has_agg=false)
 
virtual ~Expr ()
 
std::shared_ptr< Analyzer::Exprget_shared_ptr ()
 
const SQLTypeInfoget_type_info () const
 
void set_type_info (const SQLTypeInfo &ti)
 
bool get_contains_agg () const
 
void set_contains_agg (bool a)
 
virtual std::shared_ptr
< Analyzer::Expr
add_cast (const SQLTypeInfo &new_type_info)
 
virtual size_t get_num_column_vars (const bool include_agg) const
 
virtual void print () const
 
virtual void add_unique (std::list< const Expr * > &expr_list) const
 
std::shared_ptr< Analyzer::Exprdecompress ()
 
virtual void get_domain (DomainSet &domain_set) const
 

Static Public Member Functions

static SQLTypeInfo analyze_type_info (SQLOps op, const SQLTypeInfo &left_type, const SQLTypeInfo &right_type, SQLTypeInfo *new_left_type, SQLTypeInfo *new_right_type)
 
static SQLTypeInfo common_numeric_type (const SQLTypeInfo &type1, const SQLTypeInfo &type2)
 
static SQLTypeInfo common_string_type (const SQLTypeInfo &type1, const SQLTypeInfo &type2)
 
static bool simple_predicate_has_simple_cast (const std::shared_ptr< Analyzer::Expr > cast_operand, const std::shared_ptr< Analyzer::Expr > const_operand)
 

Private Attributes

SQLOps optype
 
SQLQualifier qualifier
 
std::shared_ptr< Analyzer::Exprleft_operand
 
std::shared_ptr< Analyzer::Exprright_operand
 

Additional Inherited Members

- Protected Attributes inherited from Analyzer::Expr
SQLTypeInfo type_info
 
bool contains_agg
 

Detailed Description

Definition at line 427 of file Analyzer.h.

Constructor & Destructor Documentation

Analyzer::BinOper::BinOper ( const SQLTypeInfo ti,
bool  has_agg,
SQLOps  o,
SQLQualifier  q,
std::shared_ptr< Analyzer::Expr l,
std::shared_ptr< Analyzer::Expr r 
)
inline

Definition at line 429 of file Analyzer.h.

435  : Expr(ti, has_agg), optype(o), qualifier(q), left_operand(l), right_operand(r) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:72
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524
SQLQualifier qualifier
Definition: Analyzer.h:521
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523
Analyzer::BinOper::BinOper ( SQLTypes  t,
SQLOps  o,
SQLQualifier  q,
std::shared_ptr< Analyzer::Expr l,
std::shared_ptr< Analyzer::Expr r 
)
inline

Definition at line 436 of file Analyzer.h.

441  : Expr(t, l->get_type_info().get_notnull() && r->get_type_info().get_notnull())
442  , optype(o)
443  , qualifier(q)
444  , left_operand(l)
445  , right_operand(r) {}
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:72
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524
SQLQualifier qualifier
Definition: Analyzer.h:521
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523

Member Function Documentation

SQLTypeInfo Analyzer::BinOper::analyze_type_info ( SQLOps  op,
const SQLTypeInfo left_type,
const SQLTypeInfo right_type,
SQLTypeInfo new_left_type,
SQLTypeInfo new_right_type 
)
static

Definition at line 250 of file Analyzer.cpp.

References CHECK, common_numeric_type(), SQLTypeInfo::get_dimension(), SQLTypeInfo::get_notnull(), SQLTypeInfo::get_scale(), SQLTypeInfo::get_type(), SQLTypeInfo::get_type_name(), IS_ARITHMETIC, SQLTypeInfo::is_boolean(), IS_COMPARISON, SQLTypeInfo::is_decimal(), SQLTypeInfo::is_integer(), IS_LOGIC, SQLTypeInfo::is_number(), SQLTypeInfo::is_string(), SQLTypeInfo::is_time(), SQLTypeInfo::is_timeinterval(), kBOOLEAN, kDATE, kMINUS, kMODULO, kMULTIPLY, kPLUS, kTIME, kTIMESTAMP, SQLTypeInfo::set_dimension(), SQLTypeInfo::set_notnull(), and SQLTypeInfo::set_scale().

Referenced by Parser::BetweenExpr::analyze(), and Parser::OperExpr::normalize().

254  {
255  SQLTypeInfo result_type;
256  SQLTypeInfo common_type;
257  *new_left_type = left_type;
258  *new_right_type = right_type;
259  if (IS_LOGIC(op)) {
260  if (left_type.get_type() != kBOOLEAN || right_type.get_type() != kBOOLEAN) {
261  throw std::runtime_error(
262  "non-boolean operands cannot be used in logic operations.");
263  }
264  result_type = SQLTypeInfo(kBOOLEAN, false);
265  } else if (IS_COMPARISON(op)) {
266  if (left_type != right_type) {
267  if (left_type.is_number() && right_type.is_number()) {
268  common_type = common_numeric_type(left_type, right_type);
269  *new_left_type = common_type;
270  new_left_type->set_notnull(left_type.get_notnull());
271  *new_right_type = common_type;
272  new_right_type->set_notnull(right_type.get_notnull());
273  } else if (left_type.is_time() && right_type.is_time()) {
274  switch (left_type.get_type()) {
275  case kTIMESTAMP:
276  switch (right_type.get_type()) {
277  case kTIME:
278  throw std::runtime_error("Cannont compare between TIMESTAMP and TIME.");
279  break;
280  case kDATE:
281  *new_left_type = SQLTypeInfo(left_type.get_type(),
282  left_type.get_dimension(),
283  0,
284  left_type.get_notnull());
285  *new_right_type = *new_left_type;
286  new_right_type->set_notnull(right_type.get_notnull());
287  break;
288  case kTIMESTAMP:
289  *new_left_type = SQLTypeInfo(
290  kTIMESTAMP,
291  std::max(left_type.get_dimension(), right_type.get_dimension()),
292  0,
293  left_type.get_notnull());
294  *new_right_type = SQLTypeInfo(
295  kTIMESTAMP,
296  std::max(left_type.get_dimension(), right_type.get_dimension()),
297  0,
298  right_type.get_notnull());
299  break;
300  default:
301  CHECK(false);
302  }
303  break;
304  case kTIME:
305  switch (right_type.get_type()) {
306  case kTIMESTAMP:
307  throw std::runtime_error("Cannont compare between TIME and TIMESTAMP.");
308  break;
309  case kDATE:
310  throw std::runtime_error("Cannont compare between TIME and DATE.");
311  break;
312  case kTIME:
313  *new_left_type = SQLTypeInfo(
314  kTIME,
315  std::max(left_type.get_dimension(), right_type.get_dimension()),
316  0,
317  left_type.get_notnull());
318  *new_right_type = SQLTypeInfo(
319  kTIME,
320  std::max(left_type.get_dimension(), right_type.get_dimension()),
321  0,
322  right_type.get_notnull());
323  break;
324  default:
325  CHECK(false);
326  }
327  break;
328  case kDATE:
329  switch (right_type.get_type()) {
330  case kTIMESTAMP:
331  *new_left_type = SQLTypeInfo(right_type.get_type(),
332  right_type.get_dimension(),
333  0,
334  left_type.get_notnull());
335  *new_right_type = *new_left_type;
336  new_right_type->set_notnull(right_type.get_notnull());
337  break;
338  case kDATE:
339  *new_left_type = SQLTypeInfo(left_type.get_type(),
340  left_type.get_dimension(),
341  0,
342  left_type.get_notnull());
343  *new_right_type = *new_left_type;
344  new_right_type->set_notnull(right_type.get_notnull());
345  break;
346  case kTIME:
347  throw std::runtime_error("Cannont compare between DATE and TIME.");
348  break;
349  default:
350  CHECK(false);
351  }
352  break;
353  default:
354  CHECK(false);
355  }
356  } else if (left_type.is_string() && right_type.is_time()) {
357  *new_left_type = right_type;
358  new_left_type->set_notnull(left_type.get_notnull());
359  *new_right_type = right_type;
360  } else if (left_type.is_time() && right_type.is_string()) {
361  *new_left_type = left_type;
362  *new_right_type = left_type;
363  new_right_type->set_notnull(right_type.get_notnull());
364  } else if (left_type.is_string() && right_type.is_string()) {
365  *new_left_type = left_type;
366  *new_right_type = right_type;
367  } else if (left_type.is_boolean() && right_type.is_boolean()) {
368  const bool notnull = left_type.get_notnull() && right_type.get_notnull();
369  common_type = SQLTypeInfo(kBOOLEAN, notnull);
370  *new_left_type = common_type;
371  *new_right_type = common_type;
372  } else {
373  throw std::runtime_error("Cannot compare between " + left_type.get_type_name() +
374  " and " + right_type.get_type_name());
375  }
376  }
377  result_type = SQLTypeInfo(kBOOLEAN, false);
378  } else if (op == kMINUS &&
379  (left_type.get_type() == kDATE || left_type.get_type() == kTIMESTAMP) &&
380  right_type.is_timeinterval()) {
381  *new_left_type = left_type;
382  *new_right_type = right_type;
383  result_type = left_type;
384  } else if (IS_ARITHMETIC(op)) {
385  if (!(left_type.is_number() || left_type.is_timeinterval()) ||
386  !(right_type.is_number() || right_type.is_timeinterval())) {
387  throw std::runtime_error("non-numeric operands in arithmetic operations.");
388  }
389  if (op == kMODULO && (!left_type.is_integer() || !right_type.is_integer())) {
390  throw std::runtime_error("non-integer operands in modulo operation.");
391  }
392  common_type = common_numeric_type(left_type, right_type);
393  if (common_type.is_decimal()) {
394  if (op == kMULTIPLY) {
395  // Decimal multiplication requires common_type adjustment:
396  // dimension and scale of the result should be increased.
397  auto new_dimension = left_type.get_dimension() + right_type.get_dimension();
398  // If new dimension is over 20 digits, the result may overflow, or it may not.
399  // Rely on the runtime overflow detection rather than a static check here.
400  if (common_type.get_dimension() < new_dimension) {
401  common_type.set_dimension(new_dimension);
402  }
403  common_type.set_scale(left_type.get_scale() + right_type.get_scale());
404  } else if (op == kPLUS || op == kMINUS) {
405  // Scale should remain the same but dimension could actually go up
406  common_type.set_dimension(common_type.get_dimension() + 1);
407  }
408  }
409  *new_left_type = common_type;
410  new_left_type->set_notnull(left_type.get_notnull());
411  *new_right_type = common_type;
412  new_right_type->set_notnull(right_type.get_notnull());
413  if (op == kMULTIPLY) {
414  new_left_type->set_scale(left_type.get_scale());
415  new_right_type->set_scale(right_type.get_scale());
416  }
417  result_type = common_type;
418  } else {
419  throw std::runtime_error("invalid binary operator type.");
420  }
421  result_type.set_notnull(left_type.get_notnull() && right_type.get_notnull());
422  return result_type;
423 }
#define IS_LOGIC(X)
Definition: sqldefs.h:60
Definition: sqltypes.h:49
HOST DEVICE int get_scale() const
Definition: sqltypes.h:334
Definition: sqldefs.h:40
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:329
bool is_number() const
Definition: sqltypes.h:515
bool is_time() const
Definition: sqltypes.h:516
bool is_integer() const
Definition: sqltypes.h:512
void set_scale(int s)
Definition: sqltypes.h:434
bool is_timeinterval() const
Definition: sqltypes.h:521
static SQLTypeInfo common_numeric_type(const SQLTypeInfo &type1, const SQLTypeInfo &type2)
Definition: Analyzer.cpp:465
bool is_boolean() const
Definition: sqltypes.h:517
Definition: sqltypes.h:53
Definition: sqldefs.h:39
#define IS_ARITHMETIC(X)
Definition: sqldefs.h:61
void set_dimension(int d)
Definition: sqltypes.h:431
HOST DEVICE int get_dimension() const
Definition: sqltypes.h:331
std::string get_type_name() const
Definition: sqltypes.h:443
void set_notnull(bool n)
Definition: sqltypes.h:436
#define CHECK(condition)
Definition: Logger.h:222
bool is_string() const
Definition: sqltypes.h:510
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:336
bool is_decimal() const
Definition: sqltypes.h:513
#define IS_COMPARISON(X)
Definition: sqldefs.h:57

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Analyzer::BinOper::check_group_by ( const std::list< std::shared_ptr< Analyzer::Expr >> &  groupby) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1460 of file Analyzer.cpp.

References left_operand, and right_operand.

1461  {
1462  left_operand->check_group_by(groupby);
1463  right_operand->check_group_by(groupby);
1464 }
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523
void Analyzer::BinOper::collect_column_var ( std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &  colvar_set,
bool  include_agg 
) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 477 of file Analyzer.h.

References left_operand, and right_operand.

480  {
481  left_operand->collect_column_var(colvar_set, include_agg);
482  right_operand->collect_column_var(colvar_set, include_agg);
483  }
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523
void Analyzer::BinOper::collect_rte_idx ( std::set< int > &  rte_idx_set) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 473 of file Analyzer.h.

References left_operand, and right_operand.

473  {
474  left_operand->collect_rte_idx(rte_idx_set);
475  right_operand->collect_rte_idx(rte_idx_set);
476  }
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523
SQLTypeInfo Analyzer::BinOper::common_numeric_type ( const SQLTypeInfo type1,
const SQLTypeInfo type2 
)
static

Definition at line 465 of file Analyzer.cpp.

References CHECK, SQLTypeInfo::get_dimension(), SQLTypeInfo::get_notnull(), SQLTypeInfo::get_scale(), SQLTypeInfo::get_type(), SQLTypeInfo::get_type_name(), SQLTypeInfo::is_boolean(), SQLTypeInfo::is_integer(), SQLTypeInfo::is_number(), SQLTypeInfo::is_timeinterval(), kBIGINT, kDECIMAL, kDOUBLE, kFLOAT, kINT, kNUMERIC, kSMALLINT, kTINYINT, and SQLTypeInfo::set_fixed_size().

Referenced by Parser::InValues::analyze(), analyze_type_info(), and Parser::CaseExpr::normalize().

466  {
467  SQLTypeInfo common_type;
468  const bool notnull = type1.get_notnull() && type2.get_notnull();
469  if (type1.get_type() == type2.get_type()) {
470  CHECK(((type1.is_number() || type1.is_timeinterval()) &&
471  (type2.is_number() || type2.is_timeinterval())) ||
472  (type1.is_boolean() && type2.is_boolean()));
473  common_type = SQLTypeInfo(type1.get_type(),
474  std::max(type1.get_dimension(), type2.get_dimension()),
475  std::max(type1.get_scale(), type2.get_scale()),
476  notnull);
477  return common_type;
478  }
479  std::string timeinterval_op_error{
480  "Operator type not supported for time interval arithmetic: "};
481  if (type1.is_timeinterval()) {
482  if (!type2.is_integer()) {
483  throw std::runtime_error(timeinterval_op_error + type2.get_type_name());
484  }
485  return type1;
486  }
487  if (type2.is_timeinterval()) {
488  if (!type1.is_integer()) {
489  throw std::runtime_error(timeinterval_op_error + type1.get_type_name());
490  }
491  return type2;
492  }
493  CHECK(type1.is_number() && type2.is_number());
494  switch (type1.get_type()) {
495  case kTINYINT:
496  switch (type2.get_type()) {
497  case kSMALLINT:
498  common_type = SQLTypeInfo(kSMALLINT, notnull);
499  break;
500  case kINT:
501  common_type = SQLTypeInfo(kINT, notnull);
502  break;
503  case kBIGINT:
504  common_type = SQLTypeInfo(kBIGINT, notnull);
505  break;
506  case kFLOAT:
507  common_type = SQLTypeInfo(kFLOAT, notnull);
508  break;
509  case kDOUBLE:
510  common_type = SQLTypeInfo(kDOUBLE, notnull);
511  break;
512  case kNUMERIC:
513  case kDECIMAL:
514  common_type =
516  std::max(5 + type2.get_scale(), type2.get_dimension()),
517  type2.get_scale(),
518  notnull);
519  break;
520  default:
521  CHECK(false);
522  }
523  break;
524  case kSMALLINT:
525  switch (type2.get_type()) {
526  case kTINYINT:
527  common_type = SQLTypeInfo(kSMALLINT, notnull);
528  break;
529  case kINT:
530  common_type = SQLTypeInfo(kINT, notnull);
531  break;
532  case kBIGINT:
533  common_type = SQLTypeInfo(kBIGINT, notnull);
534  break;
535  case kFLOAT:
536  common_type = SQLTypeInfo(kFLOAT, notnull);
537  break;
538  case kDOUBLE:
539  common_type = SQLTypeInfo(kDOUBLE, notnull);
540  break;
541  case kNUMERIC:
542  case kDECIMAL:
543  common_type =
545  std::max(5 + type2.get_scale(), type2.get_dimension()),
546  type2.get_scale(),
547  notnull);
548  break;
549  default:
550  CHECK(false);
551  }
552  break;
553  case kINT:
554  switch (type2.get_type()) {
555  case kTINYINT:
556  common_type = SQLTypeInfo(kINT, notnull);
557  break;
558  case kSMALLINT:
559  common_type = SQLTypeInfo(kINT, notnull);
560  break;
561  case kBIGINT:
562  common_type = SQLTypeInfo(kBIGINT, notnull);
563  break;
564  case kFLOAT:
565  common_type = SQLTypeInfo(kFLOAT, notnull);
566  break;
567  case kDOUBLE:
568  common_type = SQLTypeInfo(kDOUBLE, notnull);
569  break;
570  case kNUMERIC:
571  case kDECIMAL:
572  common_type = SQLTypeInfo(
573  kDECIMAL,
574  std::max(std::min(19, 10 + type2.get_scale()), type2.get_dimension()),
575  type2.get_scale(),
576  notnull);
577  break;
578  default:
579  CHECK(false);
580  }
581  break;
582  case kBIGINT:
583  switch (type2.get_type()) {
584  case kTINYINT:
585  common_type = SQLTypeInfo(kBIGINT, notnull);
586  break;
587  case kSMALLINT:
588  common_type = SQLTypeInfo(kBIGINT, notnull);
589  break;
590  case kINT:
591  common_type = SQLTypeInfo(kBIGINT, notnull);
592  break;
593  case kFLOAT:
594  common_type = SQLTypeInfo(kFLOAT, notnull);
595  break;
596  case kDOUBLE:
597  common_type = SQLTypeInfo(kDOUBLE, notnull);
598  break;
599  case kNUMERIC:
600  case kDECIMAL:
601  common_type = SQLTypeInfo(kDECIMAL, 19, type2.get_scale(), notnull);
602  break;
603  default:
604  CHECK(false);
605  }
606  break;
607  case kFLOAT:
608  switch (type2.get_type()) {
609  case kTINYINT:
610  common_type = SQLTypeInfo(kFLOAT, notnull);
611  break;
612  case kSMALLINT:
613  common_type = SQLTypeInfo(kFLOAT, notnull);
614  break;
615  case kINT:
616  common_type = SQLTypeInfo(kFLOAT, notnull);
617  break;
618  case kBIGINT:
619  common_type = SQLTypeInfo(kFLOAT, notnull);
620  break;
621  case kDOUBLE:
622  common_type = SQLTypeInfo(kDOUBLE, notnull);
623  break;
624  case kNUMERIC:
625  case kDECIMAL:
626  common_type = SQLTypeInfo(kFLOAT, notnull);
627  break;
628  default:
629  CHECK(false);
630  }
631  break;
632  case kDOUBLE:
633  switch (type2.get_type()) {
634  case kTINYINT:
635  case kSMALLINT:
636  case kINT:
637  case kBIGINT:
638  case kFLOAT:
639  case kNUMERIC:
640  case kDECIMAL:
641  common_type = SQLTypeInfo(kDOUBLE, notnull);
642  break;
643  default:
644  CHECK(false);
645  }
646  break;
647  case kNUMERIC:
648  case kDECIMAL:
649  switch (type2.get_type()) {
650  case kTINYINT:
651  common_type =
653  std::max(3 + type1.get_scale(), type1.get_dimension()),
654  type1.get_scale(),
655  notnull);
656  break;
657  case kSMALLINT:
658  common_type =
660  std::max(5 + type1.get_scale(), type1.get_dimension()),
661  type1.get_scale(),
662  notnull);
663  break;
664  case kINT:
665  common_type = SQLTypeInfo(
666  kDECIMAL,
667  std::max(std::min(19, 10 + type1.get_scale()), type2.get_dimension()),
668  type1.get_scale(),
669  notnull);
670  break;
671  case kBIGINT:
672  common_type = SQLTypeInfo(kDECIMAL, 19, type1.get_scale(), notnull);
673  break;
674  case kFLOAT:
675  common_type = SQLTypeInfo(kFLOAT, notnull);
676  break;
677  case kDOUBLE:
678  common_type = SQLTypeInfo(kDOUBLE, notnull);
679  break;
680  case kNUMERIC:
681  case kDECIMAL: {
682  int common_scale = std::max(type1.get_scale(), type2.get_scale());
683  common_type = SQLTypeInfo(kDECIMAL,
684  std::max(type1.get_dimension() - type1.get_scale(),
685  type2.get_dimension() - type2.get_scale()) +
686  common_scale,
687  common_scale,
688  notnull);
689  break;
690  }
691  default:
692  CHECK(false);
693  }
694  break;
695  default:
696  CHECK(false);
697  }
698  common_type.set_fixed_size();
699  return common_type;
700 }
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
bool is_integer() const
Definition: sqltypes.h:512
bool is_timeinterval() const
Definition: sqltypes.h:521
bool is_boolean() const
Definition: sqltypes.h:517
HOST DEVICE int get_dimension() const
Definition: sqltypes.h:331
std::string get_type_name() const
Definition: sqltypes.h:443
#define CHECK(condition)
Definition: Logger.h:222
Definition: sqltypes.h:45
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:336

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SQLTypeInfo Analyzer::BinOper::common_string_type ( const SQLTypeInfo type1,
const SQLTypeInfo type2 
)
static

Definition at line 425 of file Analyzer.cpp.

References CHECK, SQLTypeInfo::get_comp_param(), SQLTypeInfo::get_compression(), SQLTypeInfo::get_dimension(), SQLTypeInfo::get_notnull(), SQLTypeInfo::get_type(), SQLTypeInfo::is_string(), kENCODING_DICT, kENCODING_NONE, kNULLT, kTEXT, kVARCHAR, and TRANSIENT_DICT.

Referenced by Parser::InValues::analyze().

426  {
427  SQLTypeInfo common_type;
429  int comp_param = 0;
430  CHECK(type1.is_string() && type2.is_string());
431  // if type1 and type2 have the same DICT encoding then keep it
432  // otherwise, they must be decompressed
433  if (type1.get_compression() == kENCODING_DICT &&
434  type2.get_compression() == kENCODING_DICT) {
435  if (type1.get_comp_param() == type2.get_comp_param() ||
436  type1.get_comp_param() == TRANSIENT_DICT(type2.get_comp_param())) {
437  comp = kENCODING_DICT;
438  comp_param = std::min(type1.get_comp_param(), type2.get_comp_param());
439  }
440  } else if (type1.get_compression() == kENCODING_DICT &&
441  type2.get_compression() == kENCODING_NONE) {
442  comp_param = type1.get_comp_param();
443  } else if (type1.get_compression() == kENCODING_NONE &&
444  type2.get_compression() == kENCODING_DICT) {
445  comp_param = type2.get_comp_param();
446  } else {
447  comp_param = std::max(type1.get_comp_param(),
448  type2.get_comp_param()); // preserve previous comp_param if set
449  }
450  const bool notnull = type1.get_notnull() && type2.get_notnull();
451  if (type1.get_type() == kTEXT || type2.get_type() == kTEXT) {
452  common_type = SQLTypeInfo(kTEXT, 0, 0, notnull, comp, comp_param, kNULLT);
453  return common_type;
454  }
455  common_type = SQLTypeInfo(kVARCHAR,
456  std::max(type1.get_dimension(), type2.get_dimension()),
457  0,
458  notnull,
459  comp,
460  comp_param,
461  kNULLT);
462  return common_type;
463 }
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:329
EncodingType
Definition: sqltypes.h:233
Definition: sqltypes.h:52
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:337
HOST DEVICE int get_dimension() const
Definition: sqltypes.h:331
HOST DEVICE int get_comp_param() const
Definition: sqltypes.h:338
#define CHECK(condition)
Definition: Logger.h:222
bool is_string() const
Definition: sqltypes.h:510
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:336
#define TRANSIENT_DICT(ID)
Definition: sqltypes.h:260

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::shared_ptr< Analyzer::Expr > Analyzer::BinOper::deep_copy ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 106 of file Analyzer.cpp.

References Analyzer::Expr::contains_agg, left_operand, optype, qualifier, right_operand, and Analyzer::Expr::type_info.

Referenced by normalize_simple_predicate().

106  {
107  return makeExpr<BinOper>(type_info,
108  contains_agg,
109  optype,
110  qualifier,
111  left_operand->deep_copy(),
112  right_operand->deep_copy());
113 }
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524
SQLQualifier qualifier
Definition: Analyzer.h:521
SQLTypeInfo type_info
Definition: Analyzer.h:182
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523
bool contains_agg
Definition: Analyzer.h:183

+ Here is the caller graph for this function:

void Analyzer::BinOper::find_expr ( bool(*)(const Expr *)  f,
std::list< const Expr * > &  expr_list 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 3056 of file Analyzer.cpp.

References Analyzer::Expr::add_unique(), anonymous_namespace{Utm.h}::f, left_operand, and right_operand.

3056  {
3057  if (f(this)) {
3058  add_unique(expr_list);
3059  return;
3060  }
3061  left_operand->find_expr(f, expr_list);
3062  right_operand->find_expr(f, expr_list);
3063 }
virtual void add_unique(std::list< const Expr * > &expr_list) const
Definition: Analyzer.cpp:3046
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524
constexpr double f
Definition: Utm.h:31
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523

+ Here is the call graph for this function:

const Expr* Analyzer::BinOper::get_left_operand ( ) const
inline

Definition at line 449 of file Analyzer.h.

References left_operand.

Referenced by anonymous_namespace{CompareIR.cpp}::check_array_comp_cond(), CodeGenerator::checkExpressionRanges(), CodeGenerator::codegenArith(), CodeGenerator::codegenArrayAt(), CodeGenerator::codegenCmp(), CodeGenerator::codegenDeciDiv(), CodeGenerator::codegenFpArith(), CodeGenerator::codegenIntArith(), CodeGenerator::codegenLogical(), CodeGenerator::codegenLogicalShortCircuit(), anonymous_namespace{PerfectJoinHashTable.cpp}::get_cols(), anonymous_namespace{HashJoin.cpp}::get_cols(), anonymous_namespace{LogicalIR.cpp}::get_likelihood(), anonymous_namespace{LogicalIR.cpp}::get_weight(), getExpressionRange(), CodeGenerator::hashJoinLhsTuple(), RelAlgExecutor::isRowidLookup(), anonymous_namespace{CompareIR.cpp}::lower_multicol_compare(), HashJoin::normalizeColumnPairs(), QueryPlanDagExtractor::normalizeColumnsPair(), operator==(), Executor::skipFragment(), ScalarExprToSql::visitBinOper(), anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitBinOper(), DeepCopyVisitor::visitBinOper(), ScalarExprVisitor< std::unordered_set< InputColDescriptor > >::visitBinOper(), anonymous_namespace{RelAlgExecutor.cpp}::TextEncodingCastCountVisitor::visitBinOper(), and anonymous_namespace{ExpressionRewrite.cpp}::ConstantFoldingVisitor::visitBinOper().

449 { return left_operand.get(); }
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523

+ Here is the caller graph for this function:

const std::shared_ptr<Analyzer::Expr> Analyzer::BinOper::get_own_left_operand ( ) const
inline
const std::shared_ptr<Analyzer::Expr> Analyzer::BinOper::get_own_right_operand ( ) const
inline

Definition at line 454 of file Analyzer.h.

References right_operand.

Referenced by CodeGenerator::codegenCmp(), anonymous_namespace{CompareIR.cpp}::lower_bw_eq(), anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitBinOper(), anonymous_namespace{ExpressionRewrite.cpp}::RecursiveOrToInVisitor::visitBinOper(), and anonymous_namespace{ExpressionRewrite.cpp}::ConstantFoldingVisitor::visitBinOper().

454  {
455  return right_operand;
456  }
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524

+ Here is the caller graph for this function:

SQLQualifier Analyzer::BinOper::get_qualifier ( ) const
inline

Definition at line 448 of file Analyzer.h.

References qualifier.

Referenced by CodeGenerator::codegenCmp(), anonymous_namespace{LogicalIR.cpp}::is_qualified_bin_oper(), anonymous_namespace{CompareIR.cpp}::lower_bw_eq(), DeepCopyVisitor::visitBinOper(), anonymous_namespace{ExpressionRewrite.cpp}::RecursiveOrToInVisitor::visitBinOper(), and anonymous_namespace{ExpressionRewrite.cpp}::ConstantFoldingVisitor::visitBinOper().

448 { return qualifier; }
SQLQualifier qualifier
Definition: Analyzer.h:521

+ Here is the caller graph for this function:

const Expr* Analyzer::BinOper::get_right_operand ( ) const
inline

Definition at line 450 of file Analyzer.h.

References right_operand.

Referenced by anonymous_namespace{CompareIR.cpp}::check_array_comp_cond(), CodeGenerator::checkExpressionRanges(), CodeGenerator::codegenArith(), CodeGenerator::codegenArrayAt(), CodeGenerator::codegenCmp(), CodeGenerator::codegenDeciDiv(), CodeGenerator::codegenFpArith(), CodeGenerator::codegenIntArith(), CodeGenerator::codegenLogical(), CodeGenerator::codegenLogicalShortCircuit(), anonymous_namespace{LogicalIR.cpp}::contains_unsafe_division(), anonymous_namespace{PerfectJoinHashTable.cpp}::get_cols(), anonymous_namespace{HashJoin.cpp}::get_cols(), getExpressionRange(), CodeGenerator::hashJoinLhsTuple(), anonymous_namespace{CompareIR.cpp}::lower_multicol_compare(), anonymous_namespace{WindowExpressionRewrite.cpp}::matches_gt_bigint_zero(), HashJoin::normalizeColumnPairs(), QueryPlanDagExtractor::normalizeColumnsPair(), operator==(), anonymous_namespace{LogicalIR.cpp}::should_defer_eval(), ScalarExprToSql::visitBinOper(), anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitBinOper(), DeepCopyVisitor::visitBinOper(), ScalarExprVisitor< std::unordered_set< InputColDescriptor > >::visitBinOper(), and anonymous_namespace{RelAlgExecutor.cpp}::TextEncodingCastCountVisitor::visitBinOper().

450 { return right_operand.get(); }
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524

+ Here is the caller graph for this function:

void Analyzer::BinOper::group_predicates ( std::list< const Expr * > &  scan_predicates,
std::list< const Expr * > &  join_predicates,
std::list< const Expr * > &  const_predicates 
) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1564 of file Analyzer.cpp.

References kAND, left_operand, optype, and right_operand.

1566  {
1567  if (optype == kAND) {
1568  left_operand->group_predicates(scan_predicates, join_predicates, const_predicates);
1569  right_operand->group_predicates(scan_predicates, join_predicates, const_predicates);
1570  return;
1571  }
1572  std::set<int> rte_idx_set;
1573  left_operand->collect_rte_idx(rte_idx_set);
1574  right_operand->collect_rte_idx(rte_idx_set);
1575  if (rte_idx_set.size() > 1) {
1576  join_predicates.push_back(this);
1577  } else if (rte_idx_set.size() == 1) {
1578  scan_predicates.push_back(this);
1579  } else {
1580  const_predicates.push_back(this);
1581  }
1582 }
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523
Definition: sqldefs.h:36
bool Analyzer::BinOper::is_overlaps_oper ( ) const
inline

Definition at line 447 of file Analyzer.h.

References kOVERLAPS, and optype.

Referenced by HashJoin::normalizeColumnPairs().

447 { return optype == kOVERLAPS; }

+ Here is the caller graph for this function:

std::shared_ptr< Analyzer::Expr > Analyzer::BinOper::normalize_simple_predicate ( int &  rte_idx) const
overridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 1499 of file Analyzer.cpp.

References COMMUTE_COMPARISON, Analyzer::Expr::contains_agg, deep_copy(), Analyzer::ColumnVar::get_rte_idx(), IS_COMPARISON, kONE, left_operand, optype, qualifier, right_operand, simple_predicate_has_simple_cast(), and Analyzer::Expr::type_info.

1499  {
1500  rte_idx = -1;
1501  if (!IS_COMPARISON(optype) || qualifier != kONE) {
1502  return nullptr;
1503  }
1504  if (expr_is<UOper>(left_operand)) {
1506  auto uo = std::dynamic_pointer_cast<UOper>(left_operand);
1507  auto cv = std::dynamic_pointer_cast<ColumnVar>(uo->get_own_operand());
1508  rte_idx = cv->get_rte_idx();
1509  return this->deep_copy();
1510  }
1511  } else if (expr_is<UOper>(right_operand)) {
1513  auto uo = std::dynamic_pointer_cast<UOper>(right_operand);
1514  auto cv = std::dynamic_pointer_cast<ColumnVar>(uo->get_own_operand());
1515  rte_idx = cv->get_rte_idx();
1516  return makeExpr<BinOper>(type_info,
1517  contains_agg,
1519  qualifier,
1520  right_operand->deep_copy(),
1521  left_operand->deep_copy());
1522  }
1523  } else if (expr_is<ColumnVar>(left_operand) && !expr_is<Var>(left_operand) &&
1524  expr_is<Constant>(right_operand)) {
1525  auto cv = std::dynamic_pointer_cast<ColumnVar>(left_operand);
1526  rte_idx = cv->get_rte_idx();
1527  return this->deep_copy();
1528  } else if (expr_is<Constant>(left_operand) && expr_is<ColumnVar>(right_operand) &&
1529  !expr_is<Var>(right_operand)) {
1530  auto cv = std::dynamic_pointer_cast<ColumnVar>(right_operand);
1531  rte_idx = cv->get_rte_idx();
1532  return makeExpr<BinOper>(type_info,
1533  contains_agg,
1535  qualifier,
1536  right_operand->deep_copy(),
1537  left_operand->deep_copy());
1538  }
1539  return nullptr;
1540 }
static bool simple_predicate_has_simple_cast(const std::shared_ptr< Analyzer::Expr > cast_operand, const std::shared_ptr< Analyzer::Expr > const_operand)
Definition: Analyzer.cpp:1475
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524
SQLQualifier qualifier
Definition: Analyzer.h:521
SQLTypeInfo type_info
Definition: Analyzer.h:182
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523
Definition: sqldefs.h:70
#define COMMUTE_COMPARISON(X)
Definition: sqldefs.h:63
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:106
bool contains_agg
Definition: Analyzer.h:183
#define IS_COMPARISON(X)
Definition: sqldefs.h:57

+ Here is the call graph for this function:

bool Analyzer::BinOper::operator== ( const Expr rhs) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2250 of file Analyzer.cpp.

References get_left_operand(), get_optype(), get_right_operand(), left_operand, optype, and right_operand.

2250  {
2251  if (typeid(rhs) != typeid(BinOper)) {
2252  return false;
2253  }
2254  const BinOper& rhs_bo = dynamic_cast<const BinOper&>(rhs);
2255  return optype == rhs_bo.get_optype() && *left_operand == *rhs_bo.get_left_operand() &&
2256  *right_operand == *rhs_bo.get_right_operand();
2257 }
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524
BinOper(const SQLTypeInfo &ti, bool has_agg, SQLOps o, SQLQualifier q, std::shared_ptr< Analyzer::Expr > l, std::shared_ptr< Analyzer::Expr > r)
Definition: Analyzer.h:429
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523

+ Here is the call graph for this function:

std::shared_ptr<Analyzer::Expr> Analyzer::BinOper::rewrite_agg_to_var ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 502 of file Analyzer.h.

References Analyzer::Expr::contains_agg, left_operand, optype, qualifier, right_operand, and Analyzer::Expr::type_info.

503  {
504  return makeExpr<BinOper>(type_info,
505  contains_agg,
506  optype,
507  qualifier,
508  left_operand->rewrite_agg_to_var(tlist),
509  right_operand->rewrite_agg_to_var(tlist));
510  }
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524
SQLQualifier qualifier
Definition: Analyzer.h:521
SQLTypeInfo type_info
Definition: Analyzer.h:182
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523
bool contains_agg
Definition: Analyzer.h:183
std::shared_ptr<Analyzer::Expr> Analyzer::BinOper::rewrite_with_child_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 493 of file Analyzer.h.

References Analyzer::Expr::contains_agg, left_operand, optype, qualifier, right_operand, and Analyzer::Expr::type_info.

494  {
495  return makeExpr<BinOper>(type_info,
496  contains_agg,
497  optype,
498  qualifier,
499  left_operand->rewrite_with_child_targetlist(tlist),
500  right_operand->rewrite_with_child_targetlist(tlist));
501  }
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524
SQLQualifier qualifier
Definition: Analyzer.h:521
SQLTypeInfo type_info
Definition: Analyzer.h:182
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523
bool contains_agg
Definition: Analyzer.h:183
std::shared_ptr<Analyzer::Expr> Analyzer::BinOper::rewrite_with_targetlist ( const std::vector< std::shared_ptr< TargetEntry >> &  tlist) const
inlineoverridevirtual

Reimplemented from Analyzer::Expr.

Definition at line 484 of file Analyzer.h.

References Analyzer::Expr::contains_agg, left_operand, optype, qualifier, right_operand, and Analyzer::Expr::type_info.

485  {
486  return makeExpr<BinOper>(type_info,
487  contains_agg,
488  optype,
489  qualifier,
490  left_operand->rewrite_with_targetlist(tlist),
491  right_operand->rewrite_with_targetlist(tlist));
492  }
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524
SQLQualifier qualifier
Definition: Analyzer.h:521
SQLTypeInfo type_info
Definition: Analyzer.h:182
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523
bool contains_agg
Definition: Analyzer.h:183
bool Analyzer::BinOper::simple_predicate_has_simple_cast ( const std::shared_ptr< Analyzer::Expr cast_operand,
const std::shared_ptr< Analyzer::Expr const_operand 
)
static

Definition at line 1475 of file Analyzer.cpp.

References Analyzer::Expr::get_type_info(), and kCAST.

Referenced by normalize_simple_predicate().

1477  {
1478  if (expr_is<UOper>(cast_operand) && expr_is<Constant>(const_operand)) {
1479  auto u_expr = std::dynamic_pointer_cast<UOper>(cast_operand);
1480  if (u_expr->get_optype() != kCAST) {
1481  return false;
1482  }
1483  if (!(expr_is<Analyzer::ColumnVar>(u_expr->get_own_operand()) &&
1484  !expr_is<Analyzer::Var>(u_expr->get_own_operand()))) {
1485  return false;
1486  }
1487  const auto& ti = u_expr->get_type_info();
1488  if (ti.is_time() && u_expr->get_operand()->get_type_info().is_time()) {
1489  // Allow casts between time types to pass through
1490  return true;
1491  } else if (ti.is_integer() && u_expr->get_operand()->get_type_info().is_integer()) {
1492  // Allow casts between integer types to pass through
1493  return true;
1494  }
1495  }
1496  return false;
1497 }
Definition: sqldefs.h:48

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string Analyzer::BinOper::toString ( ) const
overridevirtual

Implements Analyzer::Expr.

Definition at line 2631 of file Analyzer.cpp.

References kALL, kAND, kANY, kARRAY_AT, kDIVIDE, kEQ, kGE, kGT, kLE, kLT, kMINUS, kMODULO, kMULTIPLY, kNE, kOR, kOVERLAPS, kPLUS, left_operand, optype, qualifier, and right_operand.

Referenced by CodeGenerator::getArithWithOverflowIntrinsic().

2631  {
2632  std::string op;
2633  switch (optype) {
2634  case kEQ:
2635  op = "= ";
2636  break;
2637  case kNE:
2638  op = "<> ";
2639  break;
2640  case kLT:
2641  op = "< ";
2642  break;
2643  case kLE:
2644  op = "<= ";
2645  break;
2646  case kGT:
2647  op = "> ";
2648  break;
2649  case kGE:
2650  op = ">= ";
2651  break;
2652  case kAND:
2653  op = "AND ";
2654  break;
2655  case kOR:
2656  op = "OR ";
2657  break;
2658  case kMINUS:
2659  op = "- ";
2660  break;
2661  case kPLUS:
2662  op = "+ ";
2663  break;
2664  case kMULTIPLY:
2665  op = "* ";
2666  break;
2667  case kDIVIDE:
2668  op = "/ ";
2669  break;
2670  case kMODULO:
2671  op = "% ";
2672  break;
2673  case kARRAY_AT:
2674  op = "[] ";
2675  break;
2676  case kOVERLAPS:
2677  op = "OVERLAPS ";
2678  break;
2679  default:
2680  break;
2681  }
2682  std::string str{"("};
2683  str += op;
2684  if (qualifier == kANY) {
2685  str += "ANY ";
2686  } else if (qualifier == kALL) {
2687  str += "ALL ";
2688  }
2689  str += left_operand->toString();
2690  str += right_operand->toString();
2691  str += ") ";
2692  return str;
2693 }
Definition: sqldefs.h:70
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:524
Definition: sqldefs.h:34
Definition: sqldefs.h:35
Definition: sqldefs.h:37
Definition: sqldefs.h:29
Definition: sqldefs.h:40
SQLQualifier qualifier
Definition: Analyzer.h:521
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:523
Definition: sqldefs.h:36
Definition: sqldefs.h:70
Definition: sqldefs.h:33
Definition: sqldefs.h:39
Definition: sqldefs.h:31
Definition: sqldefs.h:32

+ Here is the caller graph for this function:

Member Data Documentation


The documentation for this class was generated from the following files: