This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 2de8432ed6b [fix](Nereids) fix Illegal aggregate node: group by and
output is empty #35497 (#35498)
2de8432ed6b is described below
commit 2de8432ed6b9a236670963437fca767c0dcda9de
Author: 924060929 <[email protected]>
AuthorDate: Tue May 28 15:14:54 2024 +0800
[fix](Nereids) fix Illegal aggregate node: group by and output is empty
#35497 (#35498)
---
be/src/runtime/descriptors.cpp | 5 +++++
be/src/vec/exec/scan/vfile_scanner.cpp | 1 +
be/src/vec/functions/function_string.h | 6 +++---
.../suites/nereids_p0/aggregate/aggregate.groovy | 15 +++++++++++++++
4 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/be/src/runtime/descriptors.cpp b/be/src/runtime/descriptors.cpp
index 2c532dd1d58..e7e153ea737 100644
--- a/be/src/runtime/descriptors.cpp
+++ b/be/src/runtime/descriptors.cpp
@@ -381,11 +381,13 @@ RowDescriptor::RowDescriptor(const DescriptorTbl&
desc_tbl, const std::vector<TT
DCHECK_GT(row_tuples.size(), 0);
_num_materialized_slots = 0;
_num_null_slots = 0;
+ _num_slots = 0;
for (int i = 0; i < row_tuples.size(); ++i) {
TupleDescriptor* tupleDesc =
desc_tbl.get_tuple_descriptor(row_tuples[i]);
_num_materialized_slots += tupleDesc->num_materialized_slots();
_num_null_slots += tupleDesc->num_null_slots();
+ _num_slots += tupleDesc->slots().size();
_tuple_desc_map.push_back(tupleDesc);
DCHECK(_tuple_desc_map.back() != nullptr);
}
@@ -399,6 +401,7 @@ RowDescriptor::RowDescriptor(TupleDescriptor* tuple_desc,
bool is_nullable)
: _tuple_desc_map(1, tuple_desc), _tuple_idx_nullable_map(1,
is_nullable) {
init_tuple_idx_map();
init_has_varlen_slots();
+ _num_slots = tuple_desc->slots().size();
}
RowDescriptor::RowDescriptor(const RowDescriptor& lhs_row_desc, const
RowDescriptor& rhs_row_desc) {
@@ -414,6 +417,8 @@ RowDescriptor::RowDescriptor(const RowDescriptor&
lhs_row_desc, const RowDescrip
rhs_row_desc._tuple_idx_nullable_map.end());
init_tuple_idx_map();
init_has_varlen_slots();
+
+ _num_slots = lhs_row_desc.num_slots() + rhs_row_desc.num_slots();
}
void RowDescriptor::init_tuple_idx_map() {
diff --git a/be/src/vec/exec/scan/vfile_scanner.cpp
b/be/src/vec/exec/scan/vfile_scanner.cpp
index 3a6c9ff7eb7..6143fbd2681 100644
--- a/be/src/vec/exec/scan/vfile_scanner.cpp
+++ b/be/src/vec/exec/scan/vfile_scanner.cpp
@@ -1,3 +1,4 @@
+
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
diff --git a/be/src/vec/functions/function_string.h
b/be/src/vec/functions/function_string.h
index 6db68727b9f..537b5748f3c 100644
--- a/be/src/vec/functions/function_string.h
+++ b/be/src/vec/functions/function_string.h
@@ -2460,7 +2460,7 @@ StringRef do_money_format(FunctionContext* context,
UInt32 scale, T int_value, T
auto multiplier = common::exp10_i128(std::abs(static_cast<int>(scale -
3)));
// do devide first to avoid overflow
// after round frac_value will be positive by design.
- frac_value = std::abs(frac_value / multiplier) + 5;
+ frac_value = std::abs(static_cast<int>(frac_value / multiplier)) + 5;
frac_value /= 10;
} else if (scale < 2) {
DCHECK(frac_value < 100);
@@ -2501,8 +2501,8 @@ StringRef do_money_format(FunctionContext* context,
UInt32 scale, T int_value, T
memcpy(result_data + (append_sign_manually ? 1 : 0), p, integer_str_len);
*(result_data + whole_decimal_str_len - 3) = '.';
- *(result_data + whole_decimal_str_len - 2) = '0' + std::abs(frac_value /
10);
- *(result_data + whole_decimal_str_len - 1) = '0' + std::abs(frac_value %
10);
+ *(result_data + whole_decimal_str_len - 2) = '0' +
std::abs(static_cast<int>(frac_value / 10));
+ *(result_data + whole_decimal_str_len - 1) = '0' +
std::abs(static_cast<int>(frac_value % 10));
return result;
};
diff --git a/regression-test/suites/nereids_p0/aggregate/aggregate.groovy
b/regression-test/suites/nereids_p0/aggregate/aggregate.groovy
index cf8b51d328c..9fcdfa5d118 100644
--- a/regression-test/suites/nereids_p0/aggregate/aggregate.groovy
+++ b/regression-test/suites/nereids_p0/aggregate/aggregate.groovy
@@ -343,4 +343,19 @@ suite("aggregate") {
"""
exception "aggregate function cannot contain aggregate parameters"
}
+
+ sql "drop table if exists
table_10_undef_partitions2_keys3_properties4_distributed_by5"
+
+ sql """create table
table_10_undef_partitions2_keys3_properties4_distributed_by5 (
+ col_bigint_undef_signed bigint/*agg_type_placeholder*/ ,
+ col_varchar_10__undef_signed
varchar(10)/*agg_type_placeholder*/ ,
+ col_varchar_64__undef_signed varchar(64)/*agg_type_placeholder*/
,
+ pk int/*agg_type_placeholder*/
+ ) engine=olap
+ distributed by hash(pk) buckets 10
+ properties("replication_num" = "1")"""
+
+ sql "insert into
table_10_undef_partitions2_keys3_properties4_distributed_by5(pk,col_bigint_undef_signed,col_varchar_10__undef_signed,col_varchar_64__undef_signed)
values
(0,111,'from','t'),(1,null,'h','out'),(2,3814,'get','q'),(3,5166561111626303305,'s','right'),(4,2688963514917402600,'b','hey'),(5,-5065987944147755706,'p','mean'),(6,31061,'v','d'),(7,122,'the','t'),(8,-2882446,'going','a'),(9,-43,'y','a');"
+
+ sql "SELECT MIN( `pk` ) FROM
table_10_undef_partitions2_keys3_properties4_distributed_by5 WHERE (
col_varchar_64__undef_signed LIKE CONCAT ('come' , '%' ) OR
col_varchar_10__undef_signed IN ( 'could' , 'was' , 'that' ) ) OR ( `pk` IS
NULL OR ( `pk` <> 186 ) ) AND ( `pk` IS NOT NULL OR `pk` BETWEEN 255 AND -99
+ 8 ) AND ( ( `pk` != 6 ) OR `pk` IS NULL );"
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]