github-actions[bot] commented on code in PR #64624:
URL: https://github.com/apache/doris/pull/64624#discussion_r3576229962
##########
be/src/exprs/function/function_agg_state.h:
##########
@@ -69,8 +81,17 @@ class FunctionAggState : public IFunction {
for (size_t i = 0; i < arguments.size(); i++) {
DataTypePtr signature =
assert_cast<const
DataTypeAggState*>(_return_type.get())->get_sub_types()[i];
- ColumnPtr column =
-
block.get_by_position(arguments[i]).column->convert_to_full_column_if_const();
+ ColumnPtr column;
+ if (_always_const_argument_idx[i]) {
+ column = block.get_by_position(arguments[i]).column;
+ if (const auto* const_column =
check_and_get_column<ColumnConst>(*column)) {
+ column = const_column->get_data_column_ptr();
+ }
+ column = ColumnConst::create(std::move(column),
input_rows_count);
Review Comment:
`FunctionAggState` still assumes a required-constant child is physically a
`ColumnConst` or a one-row column. FE only checks `isConstant()`, though, and
deterministic constants are not guaranteed to keep that physical shape once
folding is skipped. For example, with `debug_skip_fold_constant=true`,
`percentile_approx_state(col_double, 0.5, cardinality(array_repeat(1, 2048)))`
passes the FE const checks, but BE `FunctionSize` deliberately disables default
const handling and returns a full `ColumnInt64` of `input_rows_count` rows.
This branch does not reduce that full column to row 0 before calling
`ColumnConst::create`, whose nested column must have size 1, so the valid
`_state` call fails with an internal ColumnConst-size error before
serialization. Please normalize non-ColumnConst required constants to a
single-row column here, or route these aggregate const indexes through the
scalar constant-argument API, and add a positive `_state` case for a
non-literal constant expression.
--
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]