yy782 commented on code in PR #68136:
URL: https://github.com/apache/doris/pull/68136#discussion_r4057064278
##########
be/src/exprs/aggregate/aggregate_function_simple_factory.h:
##########
@@ -144,18 +144,19 @@ class AggregateFunctionSimpleFactory {
}
}
- if (nullable) {
- return nullable_aggregate_functions.find(name_str) ==
nullable_aggregate_functions.end()
- ? nullptr
- : nullable_aggregate_functions[name_str](name_str,
argument_types,
-
result_type, result_is_nullable,
- attr);
- } else {
- return aggregate_functions.find(name_str) ==
aggregate_functions.end()
- ? nullptr
- : aggregate_functions[name_str](name_str,
argument_types, result_type,
- result_is_nullable,
attr);
+ const auto& functions = nullable ? nullable_aggregate_functions :
aggregate_functions;
+ auto function_iter = functions.find(name_str);
+ if (function_iter == functions.end()) {
+ return nullptr;
+ }
+
+ auto function = function_iter->second(name_str, argument_types,
result_type,
+ result_is_nullable, attr);
+ if (function != nullptr) {
+ DCHECK_LE(function->align_of_data(), 16)
Review Comment:
I've been reading the aggregate function module and found this PR. I noticed
the value 16 here duplicates the hard-coded alignment in
`MemTable::_init_row_for_agg` (be/src/load/memtable/memtable.cpp:566) — it’s
the same invariant split across two modules.
I was wondering: if someone later changes the alignment at line 566 (say to
32), there may not be any hint pointing them to this `DCHECK_LE(..., 16)`, and
the assert could become stale. In a debug build, it might false-fail with
"requires unsupported alignment" even though MemTable allocation is correct.
Maybe adding a cross-referencing comment either here or at line 566 could
help keep the two values in sync?
Just my two cents. Thanks for your time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]