mrhhsg commented on code in PR #68359:
URL: https://github.com/apache/doris/pull/68359#discussion_r4213928173
##########
be/src/exprs/function/function_regexp.cpp:
##########
@@ -288,17 +355,24 @@ class FunctionRegexpCount : public IFunction {
Status execute_impl(FunctionContext* context, Block& block, const
ColumnNumbers& arguments,
uint32_t result, size_t input_rows_count) const
override {
- auto result_data_column = ColumnInt32::create(input_rows_count);
- auto& result_data = result_data_column->get_data();
-
- ColumnPtr argument_columns[2];
-
- argument_columns[0] = block.get_by_position(arguments[0]).column;
- argument_columns[1] = block.get_by_position(arguments[1]).column;
- RegexpCountImpl::execute_impl(context, argument_columns,
input_rows_count, result_data);
-
- block.get_by_position(result).column = std::move(result_data_column);
- return Status::OK();
+ const bool result_nullable =
block.get_by_position(result).type->is_nullable();
+ return execute_regexp_with_nulls(
Review Comment:
Thanks, addressed in 554e1207632 (branch also rebased onto latest master).
- `execute_impl` now picks the path once per block with
`have_null_column(block, arguments)`.
- Non-nullable inputs: the original argument columns go straight into
`RegexpCountImpl::execute_impl<false>(..., nullptr)`; no temporary nested
block, no NULL map allocation, and the per-row null check is compiled out via
`if constexpr (CheckNull)`. If the caller declares a nullable result anyway,
the counts are wrapped with an all-zero null map so the declared type is
preserved.
- Nullable inputs keep the existing `execute_regexp_with_nulls` path
(`execute_impl<true>`, NULL rows skipped); the constant-pattern cache and
invalid-pattern error handling are unchanged.
- Added `FunctionLikeTest.regexp_count_non_nullable_arguments` (full / const
pattern, non-nullable and nullable declared result type);
`regexp_invalid_column_pattern_fails` already exercises the invalid-pattern
error on the non-nullable count path, and the mixed NULL / hidden-payload cases
are still covered.
--
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]