386 if (left_expr->get_type_info().is_date_in_days() ||
387 right_expr->get_type_info().is_date_in_days()) {
389 left_expr = left_expr->decompress();
390 right_expr = right_expr->decompress();
392 const auto& left_type = left_expr->get_type_info();
393 auto right_type = right_expr->get_type_info();
396 CHECK(!std::dynamic_pointer_cast<Analyzer::Subquery>(right_expr));
397 if (right_type.get_type() !=
kARRAY) {
398 throw std::runtime_error(
399 "Existential or universal qualifiers can only be used in front of a subquery "
401 "expression of array type.");
403 right_type = right_type.get_elem_type();
408 optype, left_type, right_type, &new_left_type, &new_right_type);
409 if (result_type.is_timeinterval()) {
410 return makeExpr<Analyzer::BinOper>(
411 result_type,
false, optype, qual, left_expr, right_expr);
413 if (left_type != new_left_type) {
414 left_expr = left_expr->add_cast(new_left_type);
416 if (right_type != new_right_type) {
418 right_expr = right_expr->add_cast(new_right_type);
420 right_expr = right_expr->add_cast(new_right_type.
get_array_type());
427 throw std::runtime_error(
428 "Comparison operators are not yet supported for geospatial types.");
434 if (optype ==
kEQ || optype ==
kNE) {
446 auto& expr_to_cast = ti == new_left_type ? right_expr : left_expr;
448 ti.set_dict_intersection();
449 expr_to_cast = expr_to_cast->add_cast(ti);
454 left_expr = left_expr->decompress();
455 right_expr = right_expr->decompress();
461 left_expr = left_expr->decompress();
462 right_expr = right_expr->decompress();
465 if (!(optype ==
kEQ || optype ==
kNE)) {
468 left_expr = left_expr->decompress();
469 right_expr = right_expr->decompress();
483 right_expr = right_expr->add_cast(ti);
491 left_expr = left_expr->add_cast(ti);
493 left_expr = left_expr->decompress();
494 right_expr = right_expr->decompress();
498 left_expr = left_expr->decompress();
499 right_expr = right_expr->decompress();
501 bool has_agg = (left_expr->get_contains_agg() || right_expr->get_contains_agg());
502 return makeExpr<Analyzer::BinOper>(
503 result_type, has_agg, optype, qual, left_expr, right_expr);
bool should_translate_strings(const std::shared_ptr< Analyzer::Expr > &lhs_expr, const std::shared_ptr< Analyzer::Expr > &rhs_expr)
SQLTypeInfo get_array_type() const
HOST DEVICE EncodingType get_compression() const
HOST DEVICE int get_comp_param() const
static SQLTypeInfo analyze_type_info(SQLOps op, const SQLTypeInfo &left_type, const SQLTypeInfo &right_type, SQLTypeInfo *new_left_type, SQLTypeInfo *new_right_type)
SQLTypeInfo const & get_str_dict_cast_type(const SQLTypeInfo &lhs_type_info, const SQLTypeInfo &rhs_type_info, const Executor *executor)
const shared::StringDictKey & getStringDictKey() const