From 4c07ddb3905b320e630088c7505b7f8351ceab6a Mon Sep 17 00:00:00 2001 From: shuke987 Date: Fri, 20 Mar 2026 12:27:36 +0800 Subject: [PATCH 1/2] [cleanup](build) Replace #include runtime_state.h with forward declaration in 14 headers In 14 header files, runtime_state.h was included but RuntimeState was only used as a pointer/reference parameter. Replace with forward declaration to reduce header dependency fan-out and improve incremental build times. For header-only files, added "class RuntimeState;" forward declaration. For files with corresponding .cpp, ensured the .cpp has the full include. Verified: full BE build passes with zero compilation errors. --- be/src/exec/common/hash_table/hash_table_set_build.h | 3 ++- .../exec/runtime_filter/runtime_filter_producer_helper_cross.h | 3 ++- .../exec/runtime_filter/runtime_filter_producer_helper_set.h | 3 ++- be/src/exec/sink/tablet_sink_hash_partitioner.cpp | 1 + be/src/exec/sink/tablet_sink_hash_partitioner.h | 3 ++- be/src/exprs/lambda_function/lambda_function.h | 3 ++- be/src/exprs/short_circuit_evaluation_expr.cpp | 1 + be/src/exprs/short_circuit_evaluation_expr.h | 3 ++- be/src/exprs/vcolumn_ref.h | 3 ++- be/src/exprs/vcondition_expr.cpp | 1 + be/src/exprs/vcondition_expr.h | 1 - be/src/exprs/vectorized_fn_call.h | 1 - be/src/exprs/vexpr_context.h | 1 - be/src/exprs/vtopn_pred.h | 3 ++- be/src/runtime/task_execution_context.cpp | 2 ++ be/src/runtime/task_execution_context.h | 2 -- be/src/storage/compaction/collection_statistics.cpp | 1 + be/src/storage/compaction/collection_statistics.h | 3 ++- be/src/storage/index/ann/ann_topn_runtime.h | 2 +- be/src/storage/rowset/rowset_reader_context.h | 3 ++- 20 files changed, 27 insertions(+), 16 deletions(-) diff --git a/be/src/exec/common/hash_table/hash_table_set_build.h b/be/src/exec/common/hash_table/hash_table_set_build.h index 7ad20a5942ece4..dad349a1a1d1c0 100644 --- a/be/src/exec/common/hash_table/hash_table_set_build.h +++ b/be/src/exec/common/hash_table/hash_table_set_build.h @@ -17,9 +17,10 @@ #include "core/column/column.h" #include "exec/operator/set_sink_operator.h" -#include "runtime/runtime_state.h" namespace doris { + +class RuntimeState; #include "common/compile_check_begin.h" constexpr size_t CHECK_FRECUENCY = 65536; template diff --git a/be/src/exec/runtime_filter/runtime_filter_producer_helper_cross.h b/be/src/exec/runtime_filter/runtime_filter_producer_helper_cross.h index d13e8b76b090eb..30b4cf1007e0c4 100644 --- a/be/src/exec/runtime_filter/runtime_filter_producer_helper_cross.h +++ b/be/src/exec/runtime_filter/runtime_filter_producer_helper_cross.h @@ -24,9 +24,10 @@ #include "exec/runtime_filter/runtime_filter_producer_helper.h" #include "exprs/vexpr.h" #include "exprs/vexpr_context.h" -#include "runtime/runtime_state.h" namespace doris { + +class RuntimeState; #include "common/compile_check_begin.h" // this class used in cross join node class RuntimeFilterProducerHelperCross : public RuntimeFilterProducerHelper { diff --git a/be/src/exec/runtime_filter/runtime_filter_producer_helper_set.h b/be/src/exec/runtime_filter/runtime_filter_producer_helper_set.h index 9def71af0ebbb1..69f89009c8969e 100644 --- a/be/src/exec/runtime_filter/runtime_filter_producer_helper_set.h +++ b/be/src/exec/runtime_filter/runtime_filter_producer_helper_set.h @@ -25,9 +25,10 @@ #include "exec/runtime_filter/runtime_filter_producer_helper.h" #include "exprs/vexpr.h" #include "exprs/vexpr_context.h" -#include "runtime/runtime_state.h" namespace doris { + +class RuntimeState; #include "common/compile_check_begin.h" // this class used in set sink node class RuntimeFilterProducerHelperSet : public RuntimeFilterProducerHelper { diff --git a/be/src/exec/sink/tablet_sink_hash_partitioner.cpp b/be/src/exec/sink/tablet_sink_hash_partitioner.cpp index 5c68b444f0fea5..2ab60aa6a71c1a 100644 --- a/be/src/exec/sink/tablet_sink_hash_partitioner.cpp +++ b/be/src/exec/sink/tablet_sink_hash_partitioner.cpp @@ -16,6 +16,7 @@ // under the License. #include "exec/sink/tablet_sink_hash_partitioner.h" +#include "runtime/runtime_state.h" #include #include diff --git a/be/src/exec/sink/tablet_sink_hash_partitioner.h b/be/src/exec/sink/tablet_sink_hash_partitioner.h index ee594814074462..98aaf1d228a82e 100644 --- a/be/src/exec/sink/tablet_sink_hash_partitioner.h +++ b/be/src/exec/sink/tablet_sink_hash_partitioner.h @@ -23,10 +23,11 @@ #include "exec/sink/vrow_distribution.h" #include "exec/sink/vtablet_block_convertor.h" #include "exec/sink/vtablet_finder.h" -#include "runtime/runtime_state.h" #include "storage/tablet_info.h" namespace doris { + +class RuntimeState; #include "common/compile_check_begin.h" class TabletSinkHashPartitioner final : public PartitionerBase { public: diff --git a/be/src/exprs/lambda_function/lambda_function.h b/be/src/exprs/lambda_function/lambda_function.h index c76a71e86dcd16..218f316e24a401 100644 --- a/be/src/exprs/lambda_function/lambda_function.h +++ b/be/src/exprs/lambda_function/lambda_function.h @@ -21,9 +21,10 @@ #include "core/block/block.h" #include "exprs/vexpr.h" #include "exprs/vexpr_context.h" -#include "runtime/runtime_state.h" namespace doris { + +class RuntimeState; class VExpr; class LambdaFunction { public: diff --git a/be/src/exprs/short_circuit_evaluation_expr.cpp b/be/src/exprs/short_circuit_evaluation_expr.cpp index 1ebc4bfa3254be..a60a8fd105f85e 100644 --- a/be/src/exprs/short_circuit_evaluation_expr.cpp +++ b/be/src/exprs/short_circuit_evaluation_expr.cpp @@ -16,6 +16,7 @@ // under the License. #include "exprs/short_circuit_evaluation_expr.h" +#include "runtime/runtime_state.h" #include diff --git a/be/src/exprs/short_circuit_evaluation_expr.h b/be/src/exprs/short_circuit_evaluation_expr.h index bd845cb1cca1ab..2ec51d36c26bc9 100644 --- a/be/src/exprs/short_circuit_evaluation_expr.h +++ b/be/src/exprs/short_circuit_evaluation_expr.h @@ -22,10 +22,11 @@ #include "common/status.h" #include "exprs/vexpr.h" #include "exprs/vexpr_context.h" -#include "runtime/runtime_state.h" namespace doris { +class RuntimeState; + class Block; class VExprContext; struct ColumnAndSelector; diff --git a/be/src/exprs/vcolumn_ref.h b/be/src/exprs/vcolumn_ref.h index b1f94e5d1c0a8d..4a30996302c96a 100644 --- a/be/src/exprs/vcolumn_ref.h +++ b/be/src/exprs/vcolumn_ref.h @@ -21,9 +21,10 @@ #include "exprs/function/function.h" #include "exprs/vexpr.h" #include "runtime/descriptors.h" -#include "runtime/runtime_state.h" namespace doris { + +class RuntimeState; class VColumnRef final : public VExpr { ENABLE_FACTORY_CREATOR(VColumnRef); diff --git a/be/src/exprs/vcondition_expr.cpp b/be/src/exprs/vcondition_expr.cpp index 66966ee36973b2..c1964b3dd1daf7 100644 --- a/be/src/exprs/vcondition_expr.cpp +++ b/be/src/exprs/vcondition_expr.cpp @@ -16,6 +16,7 @@ // under the License. #include "exprs/vcondition_expr.h" +#include "runtime/runtime_state.h" #include diff --git a/be/src/exprs/vcondition_expr.h b/be/src/exprs/vcondition_expr.h index 956ed746348a8d..2b2abcf2db40dc 100644 --- a/be/src/exprs/vcondition_expr.h +++ b/be/src/exprs/vcondition_expr.h @@ -27,7 +27,6 @@ #include "exprs/vexpr_context.h" #include "exprs/vliteral.h" #include "exprs/vslot_ref.h" -#include "runtime/runtime_state.h" namespace doris { class RowDescriptor; class RuntimeState; diff --git a/be/src/exprs/vectorized_fn_call.h b/be/src/exprs/vectorized_fn_call.h index 979a0d5c1f8750..12b61f3bfcc3cf 100644 --- a/be/src/exprs/vectorized_fn_call.h +++ b/be/src/exprs/vectorized_fn_call.h @@ -29,7 +29,6 @@ #include "exprs/vexpr_context.h" #include "exprs/vliteral.h" #include "exprs/vslot_ref.h" -#include "runtime/runtime_state.h" #include "storage/index/ann/ann_range_search_runtime.h" namespace doris { diff --git a/be/src/exprs/vexpr_context.h b/be/src/exprs/vexpr_context.h index 5b6aaafdddda34..c6b3c8a480e091 100644 --- a/be/src/exprs/vexpr_context.h +++ b/be/src/exprs/vexpr_context.h @@ -34,7 +34,6 @@ #include "exec/runtime_filter/runtime_filter_selectivity.h" #include "exprs/function_context.h" #include "exprs/vexpr_fwd.h" -#include "runtime/runtime_state.h" #include "storage/index/ann/ann_range_search_runtime.h" #include "storage/index/ann/ann_search_params.h" #include "storage/index/inverted/inverted_index_reader.h" diff --git a/be/src/exprs/vtopn_pred.h b/be/src/exprs/vtopn_pred.h index 899a3877526e1c..fb7986e55b556c 100644 --- a/be/src/exprs/vtopn_pred.h +++ b/be/src/exprs/vtopn_pred.h @@ -30,9 +30,10 @@ #include "exprs/vslot_ref.h" #include "runtime/query_context.h" #include "runtime/runtime_predicate.h" -#include "runtime/runtime_state.h" namespace doris { + +class RuntimeState; #include "common/compile_check_begin.h" // only used for dynamic topn filter diff --git a/be/src/runtime/task_execution_context.cpp b/be/src/runtime/task_execution_context.cpp index 91ed58135102dc..40893a1404c0a7 100644 --- a/be/src/runtime/task_execution_context.cpp +++ b/be/src/runtime/task_execution_context.cpp @@ -17,6 +17,8 @@ #include "runtime/task_execution_context.h" +#include "runtime/runtime_state.h" + #include #include diff --git a/be/src/runtime/task_execution_context.h b/be/src/runtime/task_execution_context.h index f84bcc0ceb1fd0..c7e972cc5b98e6 100644 --- a/be/src/runtime/task_execution_context.h +++ b/be/src/runtime/task_execution_context.h @@ -21,8 +21,6 @@ #include #include -#include "runtime/runtime_state.h" - namespace doris { class RuntimeState; diff --git a/be/src/storage/compaction/collection_statistics.cpp b/be/src/storage/compaction/collection_statistics.cpp index 16decc2b15f12b..9dfa1030fdf28a 100644 --- a/be/src/storage/compaction/collection_statistics.cpp +++ b/be/src/storage/compaction/collection_statistics.cpp @@ -16,6 +16,7 @@ // under the License. #include "storage/compaction/collection_statistics.h" +#include "runtime/runtime_state.h" #include #include diff --git a/be/src/storage/compaction/collection_statistics.h b/be/src/storage/compaction/collection_statistics.h index e51d5750db64d2..3fd7115c0d30ec 100644 --- a/be/src/storage/compaction/collection_statistics.h +++ b/be/src/storage/compaction/collection_statistics.h @@ -22,12 +22,13 @@ #include "common/be_mock_util.h" #include "exprs/vexpr_fwd.h" -#include "runtime/runtime_state.h" #include "storage/index/inverted/query/query_info.h" #include "storage/olap_common.h" #include "storage/predicate_collector.h" namespace doris { + +class RuntimeState; #include "common/compile_check_begin.h" namespace io { diff --git a/be/src/storage/index/ann/ann_topn_runtime.h b/be/src/storage/index/ann/ann_topn_runtime.h index 6d40a32b349f53..3633d4fdd49e86 100644 --- a/be/src/storage/index/ann/ann_topn_runtime.h +++ b/be/src/storage/index/ann/ann_topn_runtime.h @@ -44,8 +44,8 @@ #include "exprs/vexpr_context.h" #include "exprs/vexpr_fwd.h" #include "exprs/vslot_ref.h" -#include "runtime/runtime_state.h" +namespace doris { class RuntimeState; } namespace doris::segment_v2 { #include "common/compile_check_begin.h" struct AnnIndexStats; diff --git a/be/src/storage/rowset/rowset_reader_context.h b/be/src/storage/rowset/rowset_reader_context.h index e44733367c8441..1cf62ad77c58ec 100644 --- a/be/src/storage/rowset/rowset_reader_context.h +++ b/be/src/storage/rowset/rowset_reader_context.h @@ -24,7 +24,6 @@ #include "exprs/vexpr.h" #include "exprs/vexpr_context.h" #include "io/io_common.h" -#include "runtime/runtime_state.h" #include "storage/index/ann/ann_topn_runtime.h" #include "storage/olap_common.h" #include "storage/predicate/column_predicate.h" @@ -32,6 +31,8 @@ namespace doris { +class RuntimeState; + class RowCursor; class DeleteBitmap; class DeleteHandler; From a3f77177e8929a6bbc5c34c2af1ed9e19ee238a1 Mon Sep 17 00:00:00 2001 From: shuke987 Date: Fri, 20 Mar 2026 15:23:09 +0800 Subject: [PATCH 2/2] [cleanup](build) Fix clang-format include ordering for runtime_state.h Move #include "runtime/runtime_state.h" to correct position in project includes section and expand single-line namespace to multi-line format. Co-Authored-By: Claude Opus 4.6 --- be/src/exec/sink/tablet_sink_hash_partitioner.cpp | 2 +- be/src/exprs/short_circuit_evaluation_expr.cpp | 2 +- be/src/exprs/vcondition_expr.cpp | 2 +- be/src/runtime/task_execution_context.cpp | 4 ++-- be/src/storage/compaction/collection_statistics.cpp | 2 +- be/src/storage/index/ann/ann_topn_runtime.h | 4 +++- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/be/src/exec/sink/tablet_sink_hash_partitioner.cpp b/be/src/exec/sink/tablet_sink_hash_partitioner.cpp index 2ab60aa6a71c1a..3970c7756d0d50 100644 --- a/be/src/exec/sink/tablet_sink_hash_partitioner.cpp +++ b/be/src/exec/sink/tablet_sink_hash_partitioner.cpp @@ -16,13 +16,13 @@ // under the License. #include "exec/sink/tablet_sink_hash_partitioner.h" -#include "runtime/runtime_state.h" #include #include #include #include "exec/operator/operator.h" +#include "runtime/runtime_state.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/exprs/short_circuit_evaluation_expr.cpp b/be/src/exprs/short_circuit_evaluation_expr.cpp index a60a8fd105f85e..431aae67e081c5 100644 --- a/be/src/exprs/short_circuit_evaluation_expr.cpp +++ b/be/src/exprs/short_circuit_evaluation_expr.cpp @@ -16,7 +16,6 @@ // under the License. #include "exprs/short_circuit_evaluation_expr.h" -#include "runtime/runtime_state.h" #include @@ -37,6 +36,7 @@ #include "core/field.h" #include "exprs/short_circuit_util.h" #include "exprs/vexpr.h" +#include "runtime/runtime_state.h" namespace doris { diff --git a/be/src/exprs/vcondition_expr.cpp b/be/src/exprs/vcondition_expr.cpp index c1964b3dd1daf7..804ce4096d9956 100644 --- a/be/src/exprs/vcondition_expr.cpp +++ b/be/src/exprs/vcondition_expr.cpp @@ -16,13 +16,13 @@ // under the License. #include "exprs/vcondition_expr.h" -#include "runtime/runtime_state.h" #include #include "core/column/column.h" #include "core/column/column_const.h" #include "exprs/function_context.h" +#include "runtime/runtime_state.h" #include "util/simd/bits.h" namespace doris { diff --git a/be/src/runtime/task_execution_context.cpp b/be/src/runtime/task_execution_context.cpp index 40893a1404c0a7..f74e1bc2aeb151 100644 --- a/be/src/runtime/task_execution_context.cpp +++ b/be/src/runtime/task_execution_context.cpp @@ -17,12 +17,12 @@ #include "runtime/task_execution_context.h" -#include "runtime/runtime_state.h" - #include #include +#include "runtime/runtime_state.h" + namespace doris { void TaskExecutionContext::ref_task_execution_ctx() { ++_has_task_execution_ctx_ref_count; diff --git a/be/src/storage/compaction/collection_statistics.cpp b/be/src/storage/compaction/collection_statistics.cpp index 9dfa1030fdf28a..b4e3120c500208 100644 --- a/be/src/storage/compaction/collection_statistics.cpp +++ b/be/src/storage/compaction/collection_statistics.cpp @@ -16,7 +16,6 @@ // under the License. #include "storage/compaction/collection_statistics.h" -#include "runtime/runtime_state.h" #include #include @@ -26,6 +25,7 @@ #include "exprs/vexpr_context.h" #include "exprs/vliteral.h" #include "exprs/vslot_ref.h" +#include "runtime/runtime_state.h" #include "storage/index/index_file_reader.h" #include "storage/index/index_reader_helper.h" #include "storage/index/inverted/analyzer/analyzer.h" diff --git a/be/src/storage/index/ann/ann_topn_runtime.h b/be/src/storage/index/ann/ann_topn_runtime.h index 3633d4fdd49e86..88a602c74cae24 100644 --- a/be/src/storage/index/ann/ann_topn_runtime.h +++ b/be/src/storage/index/ann/ann_topn_runtime.h @@ -45,7 +45,9 @@ #include "exprs/vexpr_fwd.h" #include "exprs/vslot_ref.h" -namespace doris { class RuntimeState; } +namespace doris { +class RuntimeState; +} // namespace doris namespace doris::segment_v2 { #include "common/compile_check_begin.h" struct AnnIndexStats;