965 std::shared_ptr<Analyzer::Expr> arg_expr;
967 if (boost::iequals(*
name_,
"count")) {
971 arg_expr =
arg_->analyze(catalog, query, allow_tlist_ref);
974 throw std::runtime_error(
975 "Strings must be dictionary-encoded in COUNT(DISTINCT).");
978 throw std::runtime_error(
"Only COUNT(DISTINCT) is supported on arrays.");
984 throw std::runtime_error(
"Cannot compute " + *
name_ +
" with argument '*'.");
986 if (boost::iequals(*
name_,
"min")) {
988 arg_expr =
arg_->analyze(catalog, query, allow_tlist_ref);
989 arg_expr = arg_expr->decompress();
990 result_type = arg_expr->get_type_info();
991 }
else if (boost::iequals(*
name_,
"max")) {
993 arg_expr =
arg_->analyze(catalog, query, allow_tlist_ref);
994 arg_expr = arg_expr->decompress();
995 result_type = arg_expr->get_type_info();
996 }
else if (boost::iequals(*
name_,
"avg")) {
998 arg_expr =
arg_->analyze(catalog, query, allow_tlist_ref);
999 if (!arg_expr->get_type_info().is_number()) {
1000 throw std::runtime_error(
"Cannot compute AVG on non-number-type arguments.");
1002 arg_expr = arg_expr->decompress();
1004 }
else if (boost::iequals(*
name_,
"sum")) {
1006 arg_expr =
arg_->analyze(catalog, query, allow_tlist_ref);
1007 if (!arg_expr->get_type_info().is_number()) {
1008 throw std::runtime_error(
"Cannot compute SUM on non-number-type arguments.");
1010 arg_expr = arg_expr->decompress();
1012 : arg_expr->get_type_info();
1013 }
else if (boost::iequals(*
name_,
"unnest")) {
1014 arg_expr =
arg_->analyze(catalog, query, allow_tlist_ref);
1015 const SQLTypeInfo& arg_ti = arg_expr->get_type_info();
1017 throw std::runtime_error(
arg_->to_string() +
" is not of array type.");
1021 throw std::runtime_error(
"invalid function name: " + *
name_);
1023 if (arg_expr->get_type_info().is_string() ||
1024 arg_expr->get_type_info().get_type() ==
kARRAY) {
1025 throw std::runtime_error(
1026 "Only COUNT(DISTINCT ) aggregate is supported on strings and arrays.");
1031 return makeExpr<Analyzer::AggExpr>(
1032 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)