github-actions[bot] commented on code in PR #68579:
URL: https://github.com/apache/doris/pull/68579#discussion_r4214420312
##########
be/src/exprs/function/array/function_array_apply.cpp:
##########
@@ -88,11 +90,11 @@ class FunctionArrayApply : public IFunction {
DataTypePtr src_column_type = block.get_by_position(arguments[0]).type;
auto nested_type = assert_cast<const
DataTypeArray&>(*src_column_type).get_nested_type();
+ // op and val are constants checked in FE, so the first row holds
their values. A constant
+ // expression such as an IF one is not a ColumnConst.
const std::string& condition =
block.get_by_position(arguments[1]).column->get_data_at(0).to_string();
-
- const ColumnConst& rhs_value_column =
- static_cast<const
ColumnConst&>(*block.get_by_position(arguments[2]).column.get());
+ const IColumn& rhs_value_column =
*block.get_by_position(arguments[2]).column;
Review Comment:
[P2] Keep a constant source array compact when the value is a full column.
This newly accepted first-row value path makes `array_apply(array_repeat(1,
262144), '>', if(crc32('') = 0, 2, 3))` bypass the all-constant shortcut. Over
1024 rows, line 80 expands the one source array to roughly 268 million elements
and builds a matching filter, although every result is empty. Evaluate that
source once with the first-row operator/value and return a ColumnConst result.
##########
be/src/exprs/function/function_string_digest.cpp:
##########
@@ -226,9 +226,10 @@ class FunctionStringDigestSHA2 : public IFunction {
Status execute_impl(FunctionContext* context, Block& block, const
ColumnNumbers& arguments,
uint32_t result, size_t input_rows_count) const
override {
- DCHECK(!is_column_const(*block.get_by_position(arguments[0]).column));
-
- ColumnPtr data_col = block.get_by_position(arguments[0]).column;
+ // The input is a constant too when the digest length is a constant BE
evaluates to a full
+ // column, such as uniform(...).
+ ColumnPtr data_col =
+
block.get_by_position(arguments[0]).column->convert_to_full_column_if_const();
Review Comment:
[P2] Avoid copying a constant SHA2 input once per row. When the digest
length is a BE-evaluated full column (as in the new `full_column_constant_be`
case), this conversion expands a `ColumnConst` source before checking the
length. `ColumnConst::convert_to_full_column()` physically inserts the source
for every row, so `sha2(repeat('x', 1048576), if(crc32('') = 0, 256, 224))`
over 1024 rows needs about 1 GiB of temporary input storage. Keep the source
const and index row 0 when hashing; that also avoids the allocation when the
length is invalid.
--
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]