971 std::shared_ptr<Analyzer::Expr> arg_expr;
973 if (boost::iequals(*
name_,
"count")) {
977 arg_expr =
arg_->analyze(catalog, query, allow_tlist_ref);
980 throw std::runtime_error(
981 "Strings must be dictionary-encoded in COUNT(DISTINCT).");
984 throw std::runtime_error(
"Only COUNT(DISTINCT) is supported on arrays.");
990 throw std::runtime_error(
"Cannot compute " + *
name_ +
" with argument '*'.");
992 if (boost::iequals(*
name_,
"min")) {
994 arg_expr =
arg_->analyze(catalog, query, allow_tlist_ref);
995 arg_expr = arg_expr->decompress();
996 result_type = arg_expr->get_type_info();
997 }
else if (boost::iequals(*
name_,
"max")) {
999 arg_expr =
arg_->analyze(catalog, query, allow_tlist_ref);
1000 arg_expr = arg_expr->decompress();
1001 result_type = arg_expr->get_type_info();
1002 }
else if (boost::iequals(*
name_,
"avg")) {
1004 arg_expr =
arg_->analyze(catalog, query, allow_tlist_ref);
1005 if (!arg_expr->get_type_info().is_number()) {
1006 throw std::runtime_error(
"Cannot compute AVG on non-number-type arguments.");
1008 arg_expr = arg_expr->decompress();
1010 }
else if (boost::iequals(*
name_,
"sum")) {
1012 arg_expr =
arg_->analyze(catalog, query, allow_tlist_ref);
1013 if (!arg_expr->get_type_info().is_number()) {
1014 throw std::runtime_error(
"Cannot compute SUM on non-number-type arguments.");
1016 arg_expr = arg_expr->decompress();
1018 : arg_expr->get_type_info();
1019 }
else if (boost::iequals(*
name_,
"unnest")) {
1020 arg_expr =
arg_->analyze(catalog, query, allow_tlist_ref);
1021 const SQLTypeInfo& arg_ti = arg_expr->get_type_info();
1023 throw std::runtime_error(
arg_->to_string() +
" is not of array type.");
1027 throw std::runtime_error(
"invalid function name: " + *
name_);
1029 if (arg_expr->get_type_info().is_string() ||
1030 arg_expr->get_type_info().get_type() ==
kARRAY) {
1031 throw std::runtime_error(
1032 "Only COUNT(DISTINCT ) aggregate is supported on strings and arrays.");
1037 return makeExpr<Analyzer::AggExpr>(
1038 result_type, agg_type, arg_expr,
is_distinct,
nullptr);
HOST DEVICE SQLTypes get_type() const
std::unique_ptr< std::string > name_
std::unique_ptr< Expr > arg_
HOST DEVICE EncodingType get_compression() const
SQLTypeInfo get_elem_type() const
bool is_distinct(const size_t input_idx, const RelAlgNode *node)