github-actions[bot] commented on code in PR #65624:
URL: https://github.com/apache/doris/pull/65624#discussion_r3584370293
##########
be/src/format_v2/column_mapper.cpp:
##########
@@ -2038,7 +2040,39 @@ Status TableColumnMapper::localize_filters(const
std::vector<TableFilter>& table
auto localized_conjunct =
VExprContext::create_shared(std::move(localized_root));
RETURN_IF_ERROR(rewrite_context.prepare_created_exprs(localized_conjunct.get()));
file_request->conjuncts.push_back(std::move(localized_conjunct));
+ for (const auto global_index : table_filter.global_indices) {
+ const auto* mapping = _find_filter_mapping(global_index);
+ if (mapping != nullptr && mapping->file_local_id.has_value() &&
+
filter_conversion_has_local_source(mapping->filter_conversion)) {
+
localized_predicate_columns.emplace(*mapping->file_local_id);
+ }
+ }
+ }
+ }
+
+ // Candidate columns are added before expression rewriting because their
file-block positions
+ // are needed to localize slot refs. If rewriting rejects every filter
that references a visible
+ // column, restore that output column to the lazy non-predicate set
instead of forcing it through
+ // the eager predicate path.
+ for (auto& mapping : _mappings) {
+ if (!mapping.file_local_id.has_value()) {
+ continue;
+ }
+ const auto local_id = LocalColumnId(*mapping.file_local_id);
+ if (localized_predicate_columns.contains(local_id)) {
+ continue;
+ }
+ const auto predicate_it = std::ranges::find_if(
+ file_request->predicate_columns, [local_id](const
LocalColumnIndex& projection) {
+ return projection.column_id() == local_id;
+ });
+ if (predicate_it == file_request->predicate_columns.end()) {
+ continue;
}
+ file_request->predicate_columns.erase(predicate_it);
+ RETURN_IF_ERROR(add_scan_column(file_request, &mapping, false,
Review Comment:
This demotion drops the filter-only nested projection that was merged while
the column was still a predicate candidate. For example, the existing
`MapFilterOnlyValueChildMergesWithOutputProjection` test builds output
`m.value.b` with a residual filter on `m.value.a`: `add_scan_column(..., true,
&filter_projections)` first creates a merged `{a,b}` projection, but when
localization fails this new block erases that projection and re-adds the column
via `add_scan_column(..., false, ...)`, which rebuilds from the output mapping
only and loses `value.a`. That means the unchanged test no longer gets the
projection it asserts, and a direct mapper caller using the same contract
cannot evaluate the residual filter. Please preserve the merged projection when
moving it to `non_predicate_columns` (or otherwise carry the filter projections
through the demotion).
--
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]