378 if (left_expr->get_type_info().is_date_in_days() ||
379 right_expr->get_type_info().is_date_in_days()) {
381 left_expr = left_expr->decompress();
382 right_expr = right_expr->decompress();
384 const auto& left_type = left_expr->get_type_info();
385 auto right_type = right_expr->get_type_info();
388 CHECK(!std::dynamic_pointer_cast<Analyzer::Subquery>(right_expr));
389 if (right_type.get_type() !=
kARRAY) {
390 throw std::runtime_error(
391 "Existential or universal qualifiers can only be used in front of a subquery "
393 "expression of array type.");
395 right_type = right_type.get_elem_type();
400 optype, left_type, right_type, &new_left_type, &new_right_type);
401 if (result_type.is_timeinterval()) {
402 return makeExpr<Analyzer::BinOper>(
403 result_type,
false, optype, qual, left_expr, right_expr);
405 if (left_type != new_left_type) {
406 left_expr = left_expr->add_cast(new_left_type);
408 if (right_type != new_right_type) {
410 right_expr = right_expr->add_cast(new_right_type);
412 right_expr = right_expr->add_cast(new_right_type.
get_array_type());
419 throw std::runtime_error(
420 "Comparison operators are not yet supported for geospatial types.");
426 if (optype ==
kEQ || optype ==
kNE) {
432 const bool should_translate_strings =
434 if (should_translate_strings && (optype ==
kEQ || optype ==
kNE)) {
440 auto& expr_to_cast = ti == new_left_type ? right_expr : left_expr;
442 ti.set_dict_intersection();
443 expr_to_cast = expr_to_cast->add_cast(ti);
448 left_expr = left_expr->decompress();
449 right_expr = right_expr->decompress();
455 left_expr = left_expr->decompress();
456 right_expr = right_expr->decompress();
459 if (!(optype ==
kEQ || optype ==
kNE)) {
462 left_expr = left_expr->decompress();
463 right_expr = right_expr->decompress();
477 right_expr = right_expr->add_cast(ti);
485 left_expr = left_expr->add_cast(ti);
487 left_expr = left_expr->decompress();
488 right_expr = right_expr->decompress();
492 left_expr = left_expr->decompress();
493 right_expr = right_expr->decompress();
495 bool has_agg = (left_expr->get_contains_agg() || right_expr->get_contains_agg());
496 return makeExpr<Analyzer::BinOper>(
497 result_type, has_agg, optype, qual, left_expr, right_expr);
bool exprs_share_one_and_same_rte_idx(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