diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt index b21424f3ac255f..aa4e22320ccbcd 100644 --- a/be/CMakeLists.txt +++ b/be/CMakeLists.txt @@ -524,20 +524,18 @@ set(DORIS_LINK_LIBS ${WL_START_GROUP} Agent Common + Core Exec Exprs + Format IO - Olap + Storage Runtime - RuntimeFilter Service Util DorisGen - Webserver - Geo - GeoType - Vec - Pipeline + Load + InformationSchema Cloud ${WL_END_GROUP} CommonCPP @@ -868,21 +866,23 @@ endfunction(pch_reuse target) add_subdirectory(${SRC_DIR}/agent) add_subdirectory(${SRC_DIR}/common) +add_subdirectory(${SRC_DIR}/core) add_subdirectory(${SRC_DIR}/exec) add_subdirectory(${SRC_DIR}/exprs) +add_subdirectory(${SRC_DIR}/format) add_subdirectory(${SRC_DIR}/gen_cpp) -add_subdirectory(${SRC_DIR}/geo) -add_subdirectory(${SRC_DIR}/http) add_subdirectory(${SRC_DIR}/io) -add_subdirectory(${SRC_DIR}/olap/rowset/segment_v2/ann_index) -add_subdirectory(${SRC_DIR}/olap) +add_subdirectory(${SRC_DIR}/storage/index/ann) +add_subdirectory(${SRC_DIR}/storage) add_subdirectory(${SRC_DIR}/runtime) -add_subdirectory(${SRC_DIR}/runtime_filter) add_subdirectory(${SRC_DIR}/service) # this include doris_be add_subdirectory(${SRC_DIR}/cloud) +add_subdirectory(${SRC_DIR}/load) +add_subdirectory(${SRC_DIR}/information_schema) option(BUILD_META_TOOL "Build meta tool" OFF) -if (BUILD_META_TOOL) +option(BUILD_INDEX_TOOL "Build index tool" OFF) +if (BUILD_META_TOOL OR BUILD_INDEX_TOOL) add_subdirectory(${SRC_DIR}/tools) endif() @@ -897,14 +897,7 @@ if (BUILD_FILE_CACHE_MICROBENCH_TOOL) DESTINATION ${OUTPUT_DIR}/bin) endif() -option(BUILD_INDEX_TOOL "Build index tool" OFF) -if (BUILD_INDEX_TOOL) - add_subdirectory(${SRC_DIR}/index-tools) -endif() - add_subdirectory(${SRC_DIR}/util) -add_subdirectory(${SRC_DIR}/vec) -add_subdirectory(${SRC_DIR}/pipeline) # this include doris_be_test if (MAKE_TEST) diff --git a/be/benchmark/benchmark_fastunion.hpp b/be/benchmark/benchmark_fastunion.hpp index 1692c6a3300ece..ba469b75fa6ae3 100644 --- a/be/benchmark/benchmark_fastunion.hpp +++ b/be/benchmark/benchmark_fastunion.hpp @@ -23,7 +23,7 @@ using Roaring64Map = doris::detail::Roaring64Map; -namespace doris::vectorized { +namespace doris { const uint32_t num_bitmaps = 100; const uint32_t num_outer_slots = 1000; @@ -79,26 +79,26 @@ static void CustomCounters(benchmark::State& state) { state.counters["TotalValues"] = num_bitmaps * num_outer_slots * num_inner_values; state.counters["Overlap%"] = overlap_percent; } -} // namespace doris::vectorized +} // namespace doris static void BM_FastUnionOptimized(benchmark::State& state) { for (auto _ : state) { - auto result = Roaring64Map::fastunion(doris::vectorized::test_map_ptrs.size(), - doris::vectorized::test_map_ptrs.data()); + auto result = + Roaring64Map::fastunion(doris::test_map_ptrs.size(), doris::test_map_ptrs.data()); benchmark::DoNotOptimize(result); } - doris::vectorized::CustomCounters(state); - state.SetComplexityN(doris::vectorized::num_bitmaps); + doris::CustomCounters(state); + state.SetComplexityN(doris::num_bitmaps); } static void BM_FastUnionLegacy(benchmark::State& state) { for (auto _ : state) { - auto result = doris::vectorized::legacy_fastunion(doris::vectorized::test_map_ptrs.size(), - doris::vectorized::test_map_ptrs.data()); + auto result = + doris::legacy_fastunion(doris::test_map_ptrs.size(), doris::test_map_ptrs.data()); benchmark::DoNotOptimize(result); } - doris::vectorized::CustomCounters(state); - state.SetComplexityN(doris::vectorized::num_bitmaps); + doris::CustomCounters(state); + state.SetComplexityN(doris::num_bitmaps); } BENCHMARK(BM_FastUnionOptimized) diff --git a/be/benchmark/benchmark_main.cpp b/be/benchmark/benchmark_main.cpp index 950c55b5883006..ed77fa6e79e419 100644 --- a/be/benchmark/benchmark_main.cpp +++ b/be/benchmark/benchmark_main.cpp @@ -26,7 +26,7 @@ #include "vec/data_types/data_type.h" #include "vec/data_types/data_type_string.h" -namespace doris::vectorized { // change if need +namespace doris { // change if need static void Example1(benchmark::State& state) { // init. dont time it. @@ -48,6 +48,6 @@ static void Example1(benchmark::State& state) { } // could BENCHMARK many functions to compare them together. BENCHMARK(Example1); -} // namespace doris::vectorized +} // namespace doris BENCHMARK_MAIN(); diff --git a/be/benchmark/benchmark_plain_text_line_reader.hpp b/be/benchmark/benchmark_plain_text_line_reader.hpp index e70778d11f7781..27e7e079948cc5 100644 --- a/be/benchmark/benchmark_plain_text_line_reader.hpp +++ b/be/benchmark/benchmark_plain_text_line_reader.hpp @@ -16,6 +16,7 @@ // under the License. #include + #include #include @@ -23,81 +24,90 @@ namespace doris { -static std::string create_test_data(size_t length, const std::string& delimiter = "", char fill_char = 'a') { +static std::string create_test_data(size_t length, const std::string& delimiter = "", + char fill_char = 'a') { return std::string(length, fill_char) + delimiter; } static void BM_FindLfCrlfLineSep(benchmark::State& state) { size_t data_size = state.range(0); size_t delimiter_type = state.range(1); - + std::string test_data; - switch(delimiter_type) { - case 0: // No delimiter - test_data = create_test_data(data_size); - break; - case 1: // Delimiter is \n - test_data = create_test_data(data_size, "\n"); - break; - case 2: // Delimiter is \r\n - test_data = create_test_data(data_size, "\r\n"); - break; - default: - test_data = create_test_data(data_size); - break; + switch (delimiter_type) { + case 0: // No delimiter + test_data = create_test_data(data_size); + break; + case 1: // Delimiter is \n + test_data = create_test_data(data_size, "\n"); + break; + case 2: // Delimiter is \r\n + test_data = create_test_data(data_size, "\r\n"); + break; + default: + test_data = create_test_data(data_size); + break; } PlainTextLineReaderCtx ctx("\n", 1, false); const auto* data = reinterpret_cast(test_data.c_str()); const size_t size = test_data.size(); - + for (auto _ : state) { const auto* result = ctx.find_lf_crlf_line_sep(data, size); benchmark::DoNotOptimize(result); } - + state.SetBytesProcessed(state.iterations() * test_data.size()); - + std::string label = "size_" + std::to_string(data_size); switch (delimiter_type) { - case 0: label += "_delim_no"; break; - case 1: label += "_delim_lf"; break; - case 2: label += "_delim_crlf"; break; - default: label += "_delim_no"; break; + case 0: + label += "_delim_no"; + break; + case 1: + label += "_delim_lf"; + break; + case 2: + label += "_delim_crlf"; + break; + default: + label += "_delim_no"; + break; } state.SetLabel(label); } BENCHMARK(BM_FindLfCrlfLineSep) - ->Unit(benchmark::kNanosecond) - ->Args({16, 0}) // 16 bytes, no delimiter - ->Args({16, 1}) // 16 bytes, delimiter is \n - ->Args({16, 2}) // 16 bytes, delimiter is \r\n - ->Args({32, 0}) // 32 bytes, no delimiter - ->Args({32, 1}) // 32 bytes, delimiter is \n - ->Args({32, 2}) // 32 bytes, delimiter is \r\n - ->Args({64, 0}) // 64 bytes, no delimiter - ->Args({64, 1}) // 64 bytes, delimiter is \n - ->Args({64, 2}) // 64 bytes, delimiter is \r\n - ->Args({128, 0}) // 128 bytes, no delimiter - ->Args({128, 1}) // 128 bytes, delimiter is \n - ->Args({128, 2}) // 128 bytes, delimiter is \r\n - ->Args({256, 0}) // 256 bytes, no delimiter - ->Args({256, 1}) // 256 bytes, delimiter is \n - ->Args({256, 2}) // 256 bytes, delimiter is \r\n - ->Args({512, 0}) // 512 bytes, no delimiter - ->Args({512, 1}) // 512 bytes, delimiter is \n - ->Args({512, 2}) // 512 bytes, delimiter is \r\n - ->Args({1024, 0}) // 1KB, no delimiter - ->Args({1024, 1}) // 1KB, delimiter is \n - ->Args({1024, 2}) // 1KB, delimiter is \r\n - ->Args({64 * 1024, 0}) // 64KB, no delimiter - ->Args({64 * 1024, 1}) // 64KB, delimiter is \n - ->Args({64 * 1024, 2}) // 64KB, delimiter is \r\n - ->Args({1024 * 1024, 0}) // 1MB, no delimiter - ->Args({1024 * 1024, 1}) // 1MB, delimiter is \n - ->Args({1024 * 1024, 2}) // 1MB, delimiter is \r\n - ->Repetitions(5) - ->DisplayAggregatesOnly(); + ->Unit(benchmark::kNanosecond) + ->Args({16, 0}) // 16 bytes, no delimiter + ->Args({16, 1}) // 16 bytes, delimiter is \n + ->Args({16, 2}) // 16 bytes, delimiter is \r\n + ->Args({32, 0}) // 32 bytes, no delimiter + ->Args({32, 1}) // 32 bytes, delimiter is \n + ->Args({32, 2}) // 32 bytes, delimiter is \r\n + ->Args({64, 0}) // 64 bytes, no delimiter + ->Args({64, 1}) // 64 bytes, delimiter is \n + ->Args({64, 2}) // 64 bytes, delimiter is \r\n + ->Args({128, 0}) // 128 bytes, no delimiter + ->Args({128, 1}) // 128 bytes, delimiter is \n + ->Args({128, 2}) // 128 bytes, delimiter is \r\n + ->Args({256, 0}) // 256 bytes, no delimiter + ->Args({256, 1}) // 256 bytes, delimiter is \n + ->Args({256, 2}) // 256 bytes, delimiter is \r\n + ->Args({512, 0}) // 512 bytes, no delimiter + ->Args({512, 1}) // 512 bytes, delimiter is \n + ->Args({512, 2}) // 512 bytes, delimiter is \r\n + ->Args({1024, 0}) // 1KB, no delimiter + ->Args({1024, 1}) // 1KB, delimiter is \n + ->Args({1024, 2}) // 1KB, delimiter is \r\n + ->Args({64 * 1024, 0}) // 64KB, no delimiter + ->Args({64 * 1024, 1}) // 64KB, delimiter is \n + ->Args({64 * 1024, 2}) // 64KB, delimiter is \r\n + ->Args({1024 * 1024, 0}) // 1MB, no delimiter + ->Args({1024 * 1024, 1}) // 1MB, delimiter is \n + ->Args({1024 * 1024, 2}) // 1MB, delimiter is \r\n + ->Repetitions(5) + ->DisplayAggregatesOnly(); } // namespace doris diff --git a/be/src/agent/agent_server.cpp b/be/src/agent/agent_server.cpp index d703e241ddad86..c54390d16cf46f 100644 --- a/be/src/agent/agent_server.cpp +++ b/be/src/agent/agent_server.cpp @@ -37,11 +37,11 @@ #include "common/config.h" #include "common/logging.h" #include "common/status.h" -#include "olap/olap_define.h" -#include "olap/options.h" -#include "olap/snapshot_manager.h" -#include "olap/storage_engine.h" #include "runtime/exec_env.h" +#include "storage/olap_define.h" +#include "storage/options.h" +#include "storage/snapshot/snapshot_manager.h" +#include "storage/storage_engine.h" #include "util/work_thread_pool.hpp" namespace doris { diff --git a/be/src/agent/heartbeat_server.cpp b/be/src/agent/heartbeat_server.cpp index ec024844d8581a..327b14cf669d02 100644 --- a/be/src/agent/heartbeat_server.cpp +++ b/be/src/agent/heartbeat_server.cpp @@ -32,12 +32,12 @@ #include "cloud/config.h" #include "common/config.h" #include "common/status.h" -#include "olap/storage_engine.h" #include "runtime/cluster_info.h" #include "runtime/exec_env.h" #include "runtime/fragment_mgr.h" #include "runtime/heartbeat_flags.h" #include "service/backend_options.h" +#include "storage/storage_engine.h" #include "util/debug_util.h" #include "util/mem_info.h" #include "util/network_util.h" diff --git a/be/src/agent/task_worker_pool.cpp b/be/src/agent/task_worker_pool.cpp index 2b52ea9ed64842..ffdd110cf81056 100644 --- a/be/src/agent/task_worker_pool.cpp +++ b/be/src/agent/task_worker_pool.cpp @@ -55,6 +55,7 @@ #include "cloud/config.h" #include "common/config.h" #include "common/logging.h" +#include "common/metrics/doris_metrics.h" #include "common/status.h" #include "io/fs/file_system.h" #include "io/fs/hdfs_file_system.h" @@ -63,35 +64,34 @@ #include "io/fs/path.h" #include "io/fs/remote_file_system.h" #include "io/fs/s3_file_system.h" -#include "olap/cumulative_compaction_time_series_policy.h" -#include "olap/data_dir.h" -#include "olap/olap_common.h" -#include "olap/rowset/rowset_meta.h" -#include "olap/snapshot_manager.h" -#include "olap/storage_engine.h" -#include "olap/storage_policy.h" -#include "olap/tablet.h" -#include "olap/tablet_manager.h" -#include "olap/tablet_meta.h" -#include "olap/tablet_schema.h" -#include "olap/task/engine_batch_load_task.h" -#include "olap/task/engine_checksum_task.h" -#include "olap/task/engine_clone_task.h" -#include "olap/task/engine_cloud_index_change_task.h" -#include "olap/task/engine_index_change_task.h" -#include "olap/task/engine_publish_version_task.h" -#include "olap/task/engine_storage_migration_task.h" -#include "olap/txn_manager.h" -#include "olap/utils.h" #include "runtime/exec_env.h" #include "runtime/fragment_mgr.h" #include "runtime/index_policy/index_policy_mgr.h" #include "runtime/memory/global_memory_arbitrator.h" #include "runtime/snapshot_loader.h" #include "service/backend_options.h" +#include "storage/compaction/cumulative_compaction_time_series_policy.h" +#include "storage/data_dir.h" +#include "storage/olap_common.h" +#include "storage/rowset/rowset_meta.h" +#include "storage/snapshot/snapshot_manager.h" +#include "storage/storage_engine.h" +#include "storage/storage_policy.h" +#include "storage/tablet/tablet.h" +#include "storage/tablet/tablet_manager.h" +#include "storage/tablet/tablet_meta.h" +#include "storage/tablet/tablet_schema.h" +#include "storage/task/engine_batch_load_task.h" +#include "storage/task/engine_checksum_task.h" +#include "storage/task/engine_clone_task.h" +#include "storage/task/engine_cloud_index_change_task.h" +#include "storage/task/engine_index_change_task.h" +#include "storage/task/engine_publish_version_task.h" +#include "storage/task/engine_storage_migration_task.h" +#include "storage/txn/txn_manager.h" +#include "storage/utils.h" #include "util/brpc_client_cache.h" #include "util/debug_points.h" -#include "util/doris_metrics.h" #include "util/jni-util.h" #include "util/mem_info.h" #include "util/random.h" diff --git a/be/src/agent/utils.cpp b/be/src/agent/utils.cpp index 740caecb047e99..8064eef7ac72c1 100644 --- a/be/src/agent/utils.cpp +++ b/be/src/agent/utils.cpp @@ -42,8 +42,8 @@ #include "common/config.h" #include "common/status.h" -#include "runtime/client_cache.h" #include "runtime/cluster_info.h" +#include "util/client_cache.h" namespace doris { class TConfirmUnusedRemoteFilesRequest; diff --git a/be/src/agent/utils.h b/be/src/agent/utils.h index 70dfe1a98185b8..42c59718861aaf 100644 --- a/be/src/agent/utils.h +++ b/be/src/agent/utils.h @@ -23,7 +23,7 @@ #include #include "common/status.h" -#include "runtime/client_cache.h" +#include "util/client_cache.h" namespace doris { class TConfirmUnusedRemoteFilesRequest; diff --git a/be/src/cloud/cloud_backend_service.cpp b/be/src/cloud/cloud_backend_service.cpp index 7b3ad247070da1..34fc0bf8473336 100644 --- a/be/src/cloud/cloud_backend_service.cpp +++ b/be/src/cloud/cloud_backend_service.cpp @@ -29,8 +29,8 @@ #include "common/status.h" #include "io/cache/block_file_cache_downloader.h" #include "io/cache/block_file_cache_factory.h" -#include "runtime/stream_load/stream_load_context.h" -#include "runtime/stream_load/stream_load_recorder.h" +#include "load/stream_load/stream_load_context.h" +#include "load/stream_load/stream_load_recorder.h" #include "util/brpc_client_cache.h" // BrpcClientCache #include "util/thrift_server.h" diff --git a/be/src/cloud/cloud_base_compaction.cpp b/be/src/cloud/cloud_base_compaction.cpp index e0d424c413c621..f6e98e8fb316b5 100644 --- a/be/src/cloud/cloud_base_compaction.cpp +++ b/be/src/cloud/cloud_base_compaction.cpp @@ -17,19 +17,20 @@ #include "cloud/cloud_base_compaction.h" +#include + #include #include "cloud/cloud_meta_mgr.h" #include "cloud/config.h" #include "common/config.h" +#include "core/value/vdatetime_value.h" #include "cpp/sync_point.h" -#include "gen_cpp/cloud.pb.h" -#include "olap/compaction.h" -#include "olap/task/engine_checksum_task.h" #include "service/backend_options.h" +#include "storage/compaction/compaction.h" +#include "storage/task/engine_checksum_task.h" #include "util/thread.h" #include "util/uuid_generator.h" -#include "vec/runtime/vdatetime_value.h" namespace doris { using namespace ErrorCode; diff --git a/be/src/cloud/cloud_base_compaction.h b/be/src/cloud/cloud_base_compaction.h index 63bb5c61def9d1..c89047b919beb3 100644 --- a/be/src/cloud/cloud_base_compaction.h +++ b/be/src/cloud/cloud_base_compaction.h @@ -21,7 +21,7 @@ #include "cloud/cloud_storage_engine.h" #include "cloud/cloud_tablet.h" -#include "olap/compaction.h" +#include "storage/compaction/compaction.h" namespace doris { diff --git a/be/src/cloud/cloud_compaction_action.cpp b/be/src/cloud/cloud_compaction_action.cpp index ddc2292b41de6a..d9a7794edca785 100644 --- a/be/src/cloud/cloud_compaction_action.cpp +++ b/be/src/cloud/cloud_compaction_action.cpp @@ -36,20 +36,20 @@ #include "cloud/cloud_tablet.h" #include "cloud/cloud_tablet_mgr.h" #include "common/logging.h" +#include "common/metrics/doris_metrics.h" #include "common/status.h" -#include "http/http_channel.h" -#include "http/http_headers.h" -#include "http/http_request.h" -#include "http/http_status.h" -#include "olap/base_compaction.h" -#include "olap/cumulative_compaction.h" -#include "olap/cumulative_compaction_policy.h" -#include "olap/cumulative_compaction_time_series_policy.h" -#include "olap/full_compaction.h" -#include "olap/olap_define.h" -#include "olap/storage_engine.h" -#include "olap/tablet_manager.h" -#include "util/doris_metrics.h" +#include "service/http/http_channel.h" +#include "service/http/http_headers.h" +#include "service/http/http_request.h" +#include "service/http/http_status.h" +#include "storage/compaction/base_compaction.h" +#include "storage/compaction/cumulative_compaction.h" +#include "storage/compaction/cumulative_compaction_policy.h" +#include "storage/compaction/cumulative_compaction_time_series_policy.h" +#include "storage/compaction/full_compaction.h" +#include "storage/olap_define.h" +#include "storage/storage_engine.h" +#include "storage/tablet/tablet_manager.h" #include "util/stopwatch.hpp" namespace doris { diff --git a/be/src/cloud/cloud_compaction_action.h b/be/src/cloud/cloud_compaction_action.h index 026426826d86d4..f86a89d19602fa 100644 --- a/be/src/cloud/cloud_compaction_action.h +++ b/be/src/cloud/cloud_compaction_action.h @@ -23,9 +23,9 @@ #include "cloud/cloud_storage_engine.h" #include "common/status.h" -#include "http/action/compaction_action.h" -#include "http/http_handler_with_auth.h" -#include "olap/tablet.h" +#include "service/http/action/compaction_action.h" +#include "service/http/http_handler_with_auth.h" +#include "storage/tablet/tablet.h" namespace doris { class HttpRequest; diff --git a/be/src/cloud/cloud_compaction_stop_token.cpp b/be/src/cloud/cloud_compaction_stop_token.cpp index 9d6f1b614a61dc..d65072559ddb0e 100644 --- a/be/src/cloud/cloud_compaction_stop_token.cpp +++ b/be/src/cloud/cloud_compaction_stop_token.cpp @@ -17,10 +17,11 @@ #include "cloud/cloud_compaction_stop_token.h" +#include + #include "cloud/cloud_meta_mgr.h" #include "cloud/config.h" #include "common/logging.h" -#include "gen_cpp/cloud.pb.h" namespace doris { diff --git a/be/src/cloud/cloud_cumulative_compaction.cpp b/be/src/cloud/cloud_cumulative_compaction.cpp index bd2106741d6196..a6ad435ce63ef4 100644 --- a/be/src/cloud/cloud_cumulative_compaction.cpp +++ b/be/src/cloud/cloud_cumulative_compaction.cpp @@ -17,6 +17,8 @@ #include "cloud/cloud_cumulative_compaction.h" +#include + #include "cloud/cloud_meta_mgr.h" #include "cloud/cloud_tablet_mgr.h" #include "cloud/config.h" @@ -24,10 +26,9 @@ #include "common/logging.h" #include "common/status.h" #include "cpp/sync_point.h" -#include "gen_cpp/cloud.pb.h" -#include "olap/compaction.h" -#include "olap/cumulative_compaction_policy.h" #include "service/backend_options.h" +#include "storage/compaction/compaction.h" +#include "storage/compaction/cumulative_compaction_policy.h" #include "util/debug_points.h" #include "util/trace.h" #include "util/uuid_generator.h" diff --git a/be/src/cloud/cloud_cumulative_compaction.h b/be/src/cloud/cloud_cumulative_compaction.h index e139054bbc7ee8..174d0d57a97cc7 100644 --- a/be/src/cloud/cloud_cumulative_compaction.h +++ b/be/src/cloud/cloud_cumulative_compaction.h @@ -21,7 +21,7 @@ #include "cloud/cloud_storage_engine.h" #include "cloud/cloud_tablet.h" -#include "olap/compaction.h" +#include "storage/compaction/compaction.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/cloud/cloud_cumulative_compaction_policy.cpp b/be/src/cloud/cloud_cumulative_compaction_policy.cpp index 5fee34119ac136..53d336e5c70396 100644 --- a/be/src/cloud/cloud_cumulative_compaction_policy.cpp +++ b/be/src/cloud/cloud_cumulative_compaction_policy.cpp @@ -26,10 +26,10 @@ #include "common/config.h" #include "common/logging.h" #include "cpp/sync_point.h" -#include "olap/cumulative_compaction_time_series_policy.h" -#include "olap/olap_common.h" -#include "olap/tablet.h" -#include "olap/tablet_meta.h" +#include "storage/compaction/cumulative_compaction_time_series_policy.h" +#include "storage/olap_common.h" +#include "storage/tablet/tablet.h" +#include "storage/tablet/tablet_meta.h" #include "util/defer_op.h" namespace doris { diff --git a/be/src/cloud/cloud_cumulative_compaction_policy.h b/be/src/cloud/cloud_cumulative_compaction_policy.h index df2cc3a1171fbf..7f0da55d240dc8 100644 --- a/be/src/cloud/cloud_cumulative_compaction_policy.h +++ b/be/src/cloud/cloud_cumulative_compaction_policy.h @@ -26,8 +26,8 @@ #include "cloud/cloud_tablet.h" #include "common/config.h" -#include "olap/rowset/rowset.h" -#include "olap/rowset/rowset_meta.h" +#include "storage/rowset/rowset.h" +#include "storage/rowset/rowset_meta.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/cloud/cloud_delete_task.cpp b/be/src/cloud/cloud_delete_task.cpp index 1670e41170bc13..0b51da4eafdabc 100644 --- a/be/src/cloud/cloud_delete_task.cpp +++ b/be/src/cloud/cloud_delete_task.cpp @@ -25,7 +25,7 @@ #include "cloud/cloud_tablet.h" #include "cloud/cloud_tablet_mgr.h" #include "common/logging.h" -#include "olap/delete_handler.h" +#include "storage/delete/delete_handler.h" namespace doris { using namespace ErrorCode; diff --git a/be/src/cloud/cloud_delta_writer.cpp b/be/src/cloud/cloud_delta_writer.cpp index f499f847a8088d..299182b45cbb82 100644 --- a/be/src/cloud/cloud_delta_writer.cpp +++ b/be/src/cloud/cloud_delta_writer.cpp @@ -21,7 +21,7 @@ #include "cloud/cloud_rowset_builder.h" #include "cloud/cloud_storage_engine.h" #include "cloud/config.h" -#include "olap/delta_writer.h" +#include "load/delta_writer/delta_writer.h" #include "runtime/thread_context.h" namespace doris { @@ -64,8 +64,7 @@ Status CloudDeltaWriter::batch_init(std::vector writers) { return cloud::bthread_fork_join(tasks, 10); } -Status CloudDeltaWriter::write(const vectorized::Block* block, - const DorisVector& row_idxs) { +Status CloudDeltaWriter::write(const Block* block, const DorisVector& row_idxs) { if (row_idxs.empty()) [[unlikely]] { return Status::OK(); } diff --git a/be/src/cloud/cloud_delta_writer.h b/be/src/cloud/cloud_delta_writer.h index b4c9e6eda6f7f6..846149137b12a9 100644 --- a/be/src/cloud/cloud_delta_writer.h +++ b/be/src/cloud/cloud_delta_writer.h @@ -19,7 +19,7 @@ #include -#include "olap/delta_writer.h" +#include "load/delta_writer/delta_writer.h" #include "runtime/workload_management/resource_context.h" namespace doris { @@ -33,7 +33,7 @@ class CloudDeltaWriter final : public BaseDeltaWriter { const UniqueId& load_id); ~CloudDeltaWriter() override; - Status write(const vectorized::Block* block, const DorisVector& row_idxs) override; + Status write(const Block* block, const DorisVector& row_idxs) override; Status close() override; diff --git a/be/src/cloud/cloud_engine_calc_delete_bitmap_task.cpp b/be/src/cloud/cloud_engine_calc_delete_bitmap_task.cpp index 05d94195ec0c32..66510d01d184fb 100644 --- a/be/src/cloud/cloud_engine_calc_delete_bitmap_task.cpp +++ b/be/src/cloud/cloud_engine_calc_delete_bitmap_task.cpp @@ -27,15 +27,15 @@ #include "cloud/cloud_meta_mgr.h" #include "cloud/cloud_tablet.h" #include "common/status.h" -#include "olap/base_tablet.h" -#include "olap/olap_common.h" -#include "olap/rowset/beta_rowset.h" -#include "olap/rowset/rowset.h" -#include "olap/tablet_fwd.h" -#include "olap/tablet_meta.h" -#include "olap/txn_manager.h" -#include "olap/utils.h" #include "runtime/memory/mem_tracker_limiter.h" +#include "storage/olap_common.h" +#include "storage/rowset/beta_rowset.h" +#include "storage/rowset/rowset.h" +#include "storage/tablet/base_tablet.h" +#include "storage/tablet/tablet_fwd.h" +#include "storage/tablet/tablet_meta.h" +#include "storage/txn/txn_manager.h" +#include "storage/utils.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/cloud/cloud_engine_calc_delete_bitmap_task.h b/be/src/cloud/cloud_engine_calc_delete_bitmap_task.h index f5cbfe5a0b0dfa..5ea11e8d4c37f5 100644 --- a/be/src/cloud/cloud_engine_calc_delete_bitmap_task.h +++ b/be/src/cloud/cloud_engine_calc_delete_bitmap_task.h @@ -17,14 +17,15 @@ #pragma once +#include + #include #include #include "cloud/cloud_storage_engine.h" #include "cloud/cloud_tablet.h" -#include "gen_cpp/AgentService_types.h" -#include "olap/tablet_fwd.h" -#include "olap/task/engine_task.h" +#include "storage/tablet/tablet_fwd.h" +#include "storage/task/engine_task.h" namespace doris { diff --git a/be/src/cloud/cloud_full_compaction.cpp b/be/src/cloud/cloud_full_compaction.cpp index 15160cfabd497d..8dfb3da433f94e 100644 --- a/be/src/cloud/cloud_full_compaction.cpp +++ b/be/src/cloud/cloud_full_compaction.cpp @@ -17,6 +17,8 @@ #include "cloud/cloud_full_compaction.h" +#include + #include #include "cloud/cloud_meta_mgr.h" @@ -24,16 +26,15 @@ #include "cloud/config.h" #include "common/config.h" #include "common/status.h" +#include "core/column/column.h" #include "cpp/sync_point.h" -#include "gen_cpp/cloud.pb.h" -#include "olap/compaction.h" -#include "olap/rowset/beta_rowset.h" -#include "olap/tablet_meta.h" #include "service/backend_options.h" +#include "storage/compaction/compaction.h" +#include "storage/rowset/beta_rowset.h" +#include "storage/tablet/tablet_meta.h" #include "util/debug_points.h" #include "util/thread.h" #include "util/uuid_generator.h" -#include "vec/columns/column.h" namespace doris { using namespace ErrorCode; diff --git a/be/src/cloud/cloud_full_compaction.h b/be/src/cloud/cloud_full_compaction.h index 1cdf52472c0d60..e5c440e52b9b8a 100644 --- a/be/src/cloud/cloud_full_compaction.h +++ b/be/src/cloud/cloud_full_compaction.h @@ -21,7 +21,7 @@ #include "cloud/cloud_storage_engine.h" #include "cloud/cloud_tablet.h" -#include "olap/compaction.h" +#include "storage/compaction/compaction.h" namespace doris { diff --git a/be/src/cloud/cloud_index_change_compaction.h b/be/src/cloud/cloud_index_change_compaction.h index aeeabb98ada788..e0bd7952ca7568 100644 --- a/be/src/cloud/cloud_index_change_compaction.h +++ b/be/src/cloud/cloud_index_change_compaction.h @@ -21,7 +21,7 @@ #include "cloud/cloud_storage_engine.h" #include "cloud/cloud_tablet.h" -#include "olap/compaction.h" +#include "storage/compaction/compaction.h" namespace doris { diff --git a/be/src/cloud/cloud_meta_mgr.cpp b/be/src/cloud/cloud_meta_mgr.cpp index a3b2a51ef50cde..1cf71f74632c00 100644 --- a/be/src/cloud/cloud_meta_mgr.cpp +++ b/be/src/cloud/cloud_meta_mgr.cpp @@ -22,7 +22,12 @@ #include #include #include +#include +#include #include +#include +#include +#include #include #include @@ -48,21 +53,16 @@ #include "common/logging.h" #include "common/status.h" #include "cpp/sync_point.h" -#include "gen_cpp/FrontendService.h" -#include "gen_cpp/HeartbeatService_types.h" -#include "gen_cpp/Types_types.h" -#include "gen_cpp/cloud.pb.h" -#include "gen_cpp/olap_file.pb.h" #include "io/fs/obj_storage_client.h" -#include "olap/olap_common.h" -#include "olap/rowset/rowset.h" -#include "olap/rowset/rowset_factory.h" -#include "olap/rowset/rowset_fwd.h" -#include "olap/storage_engine.h" -#include "olap/tablet_meta.h" -#include "runtime/client_cache.h" +#include "load/stream_load/stream_load_context.h" #include "runtime/exec_env.h" -#include "runtime/stream_load/stream_load_context.h" +#include "storage/olap_common.h" +#include "storage/rowset/rowset.h" +#include "storage/rowset/rowset_factory.h" +#include "storage/rowset/rowset_fwd.h" +#include "storage/storage_engine.h" +#include "storage/tablet/tablet_meta.h" +#include "util/client_cache.h" #include "util/network_util.h" #include "util/s3_util.h" #include "util/thrift_rpc_helper.h" diff --git a/be/src/cloud/cloud_meta_mgr.h b/be/src/cloud/cloud_meta_mgr.h index ea13069ef20b0f..e469a90592ebb5 100644 --- a/be/src/cloud/cloud_meta_mgr.h +++ b/be/src/cloud/cloud_meta_mgr.h @@ -27,8 +27,8 @@ #include "cloud/cloud_tablet.h" #include "common/status.h" -#include "olap/rowset/rowset_fwd.h" -#include "olap/rowset/rowset_meta.h" +#include "storage/rowset/rowset_fwd.h" +#include "storage/rowset/rowset_meta.h" #include "util/s3_util.h" namespace doris { diff --git a/be/src/cloud/cloud_rowset_builder.cpp b/be/src/cloud/cloud_rowset_builder.cpp index 8ef15424a3d791..0ce4829d9fe1ba 100644 --- a/be/src/cloud/cloud_rowset_builder.cpp +++ b/be/src/cloud/cloud_rowset_builder.cpp @@ -21,7 +21,7 @@ #include "cloud/cloud_storage_engine.h" #include "cloud/cloud_tablet.h" #include "cloud/cloud_tablet_mgr.h" -#include "olap/storage_policy.h" +#include "storage/storage_policy.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/cloud/cloud_rowset_builder.h b/be/src/cloud/cloud_rowset_builder.h index afa5d7c7574b6d..3384f2351671fa 100644 --- a/be/src/cloud/cloud_rowset_builder.h +++ b/be/src/cloud/cloud_rowset_builder.h @@ -17,7 +17,7 @@ #pragma once -#include "olap/rowset_builder.h" +#include "storage/rowset_builder.h" namespace doris { diff --git a/be/src/cloud/cloud_rowset_writer.cpp b/be/src/cloud/cloud_rowset_writer.cpp index c5b58049ae42b4..47cc3865c1bf65 100644 --- a/be/src/cloud/cloud_rowset_writer.cpp +++ b/be/src/cloud/cloud_rowset_writer.cpp @@ -22,7 +22,7 @@ #include "io/cache/block_file_cache_factory.h" #include "io/fs/packed_file_manager.h" #include "io/fs/packed_file_writer.h" -#include "olap/rowset/rowset_factory.h" +#include "storage/rowset/rowset_factory.h" namespace doris { diff --git a/be/src/cloud/cloud_rowset_writer.h b/be/src/cloud/cloud_rowset_writer.h index 56cbe4df24995f..905435f3cf4342 100644 --- a/be/src/cloud/cloud_rowset_writer.h +++ b/be/src/cloud/cloud_rowset_writer.h @@ -18,7 +18,7 @@ #pragma once #include "cloud/cloud_storage_engine.h" -#include "olap/rowset/beta_rowset_writer.h" +#include "storage/rowset/beta_rowset_writer.h" namespace doris { diff --git a/be/src/cloud/cloud_schema_change_job.cpp b/be/src/cloud/cloud_schema_change_job.cpp index 7bc47c9c117007..807422c1fceaad 100644 --- a/be/src/cloud/cloud_schema_change_job.cpp +++ b/be/src/cloud/cloud_schema_change_job.cpp @@ -29,17 +29,17 @@ #include "cloud/cloud_meta_mgr.h" #include "cloud/cloud_tablet_mgr.h" #include "common/status.h" -#include "olap/delete_handler.h" -#include "olap/olap_define.h" -#include "olap/rowset/beta_rowset.h" -#include "olap/rowset/rowset.h" -#include "olap/rowset/rowset_factory.h" -#include "olap/rowset/segment_v2/inverted_index_desc.h" -#include "olap/storage_engine.h" -#include "olap/tablet.h" -#include "olap/tablet_fwd.h" -#include "olap/tablet_meta.h" #include "service/backend_options.h" +#include "storage/delete/delete_handler.h" +#include "storage/index/inverted/inverted_index_desc.h" +#include "storage/olap_define.h" +#include "storage/rowset/beta_rowset.h" +#include "storage/rowset/rowset.h" +#include "storage/rowset/rowset_factory.h" +#include "storage/storage_engine.h" +#include "storage/tablet/tablet.h" +#include "storage/tablet/tablet_fwd.h" +#include "storage/tablet/tablet_meta.h" #include "util/debug_points.h" namespace doris { diff --git a/be/src/cloud/cloud_schema_change_job.h b/be/src/cloud/cloud_schema_change_job.h index 0132d1f506a53b..8428e17c496ced 100644 --- a/be/src/cloud/cloud_schema_change_job.h +++ b/be/src/cloud/cloud_schema_change_job.h @@ -21,9 +21,9 @@ #include "cloud/cloud_storage_engine.h" #include "cloud/cloud_tablet.h" -#include "olap/rowset/rowset.h" -#include "olap/schema_change.h" -#include "olap/tablet_fwd.h" +#include "storage/rowset/rowset.h" +#include "storage/schema_change/schema_change.h" +#include "storage/tablet/tablet_fwd.h" namespace doris { diff --git a/be/src/cloud/cloud_snapshot_loader.cpp b/be/src/cloud/cloud_snapshot_loader.cpp index b75616adf0c9e7..9be1f90f65c11e 100644 --- a/be/src/cloud/cloud_snapshot_loader.cpp +++ b/be/src/cloud/cloud_snapshot_loader.cpp @@ -30,13 +30,13 @@ #include "io/fs/path.h" #include "io/fs/remote_file_system.h" #include "io/fs/s3_file_system.h" -#include "olap/olap_common.h" -#include "olap/olap_define.h" -#include "olap/rowset/rowset_factory.h" -#include "olap/rowset/rowset_meta.h" -#include "olap/rowset/rowset_writer.h" -#include "olap/rowset/rowset_writer_context.h" -#include "olap/tablet.h" +#include "storage/olap_common.h" +#include "storage/olap_define.h" +#include "storage/rowset/rowset_factory.h" +#include "storage/rowset/rowset_meta.h" +#include "storage/rowset/rowset_writer.h" +#include "storage/rowset/rowset_writer_context.h" +#include "storage/tablet/tablet.h" #include "util/slice.h" namespace doris { diff --git a/be/src/cloud/cloud_snapshot_loader.h b/be/src/cloud/cloud_snapshot_loader.h index c6e690d3e69594..7f6420a00dbcde 100644 --- a/be/src/cloud/cloud_snapshot_loader.h +++ b/be/src/cloud/cloud_snapshot_loader.h @@ -19,8 +19,8 @@ #include "cloud/cloud_tablet.h" #include "common/status.h" -#include "olap/storage_policy.h" #include "runtime/snapshot_loader.h" +#include "storage/storage_policy.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/cloud/cloud_snapshot_mgr.cpp b/be/src/cloud/cloud_snapshot_mgr.cpp index 2d471d8097584a..781680f5b1a37b 100644 --- a/be/src/cloud/cloud_snapshot_mgr.cpp +++ b/be/src/cloud/cloud_snapshot_mgr.cpp @@ -31,22 +31,22 @@ #include "common/logging.h" #include "common/status.h" #include "io/fs/local_file_system.h" -#include "olap/data_dir.h" -#include "olap/olap_common.h" -#include "olap/olap_define.h" -#include "olap/pb_helper.h" -#include "olap/rowset/rowset.h" -#include "olap/rowset/rowset_factory.h" -#include "olap/rowset/rowset_meta.h" -#include "olap/rowset/rowset_writer.h" -#include "olap/rowset/rowset_writer_context.h" -#include "olap/storage_policy.h" -#include "olap/tablet_meta.h" -#include "olap/tablet_schema.h" -#include "olap/tablet_schema_cache.h" -#include "olap/utils.h" #include "runtime/memory/mem_tracker_limiter.h" #include "runtime/thread_context.h" +#include "storage/data_dir.h" +#include "storage/olap_common.h" +#include "storage/olap_define.h" +#include "storage/pb_helper.h" +#include "storage/rowset/rowset.h" +#include "storage/rowset/rowset_factory.h" +#include "storage/rowset/rowset_meta.h" +#include "storage/rowset/rowset_writer.h" +#include "storage/rowset/rowset_writer_context.h" +#include "storage/storage_policy.h" +#include "storage/tablet/tablet_meta.h" +#include "storage/tablet/tablet_schema.h" +#include "storage/tablet/tablet_schema_cache.h" +#include "storage/utils.h" #include "util/slice.h" #include "util/uid_util.h" diff --git a/be/src/cloud/cloud_snapshot_mgr.h b/be/src/cloud/cloud_snapshot_mgr.h index e249e3e4865991..31779905f9fdf9 100644 --- a/be/src/cloud/cloud_snapshot_mgr.h +++ b/be/src/cloud/cloud_snapshot_mgr.h @@ -24,9 +24,9 @@ #include "cloud/cloud_tablet.h" #include "common/status.h" -#include "olap/rowset/rowset_fwd.h" -#include "olap/storage_policy.h" -#include "olap/tablet_fwd.h" +#include "storage/rowset/rowset_fwd.h" +#include "storage/storage_policy.h" +#include "storage/tablet/tablet_fwd.h" namespace doris { class CloudStorageEngine; diff --git a/be/src/cloud/cloud_storage_engine.cpp b/be/src/cloud/cloud_storage_engine.cpp index 126e9701a79af4..432c1fde72fbc5 100644 --- a/be/src/cloud/cloud_storage_engine.cpp +++ b/be/src/cloud/cloud_storage_engine.cpp @@ -46,6 +46,7 @@ #include "common/config.h" #include "common/signal_handler.h" #include "common/status.h" +#include "core/assert_cast.h" #include "io/cache/block_file_cache_downloader.h" #include "io/cache/block_file_cache_factory.h" #include "io/cache/file_cache_common.h" @@ -54,14 +55,13 @@ #include "io/fs/s3_file_system.h" #include "io/hdfs_util.h" #include "io/io_common.h" -#include "olap/cumulative_compaction_policy.h" -#include "olap/cumulative_compaction_time_series_policy.h" -#include "olap/memtable_flush_executor.h" -#include "olap/storage_policy.h" +#include "load/memtable/memtable_flush_executor.h" #include "runtime/memory/cache_manager.h" +#include "storage/compaction/cumulative_compaction_policy.h" +#include "storage/compaction/cumulative_compaction_time_series_policy.h" +#include "storage/storage_policy.h" #include "util/parse_util.h" #include "util/time.h" -#include "vec/common/assert_cast.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/cloud/cloud_storage_engine.h b/be/src/cloud/cloud_storage_engine.h index 9c27e164bba7f8..7d0a3e6129645f 100644 --- a/be/src/cloud/cloud_storage_engine.h +++ b/be/src/cloud/cloud_storage_engine.h @@ -26,12 +26,12 @@ //#include "cloud/cloud_full_compaction.h" #include "cloud/cloud_cumulative_compaction_policy.h" #include "cloud/cloud_tablet.h" +#include "cloud/cloud_txn_delete_bitmap_cache.h" #include "cloud/config.h" -#include "cloud_txn_delete_bitmap_cache.h" #include "io/cache/block_file_cache_factory.h" -#include "olap/compaction.h" -#include "olap/storage_engine.h" -#include "olap/storage_policy.h" +#include "storage/compaction/compaction.h" +#include "storage/storage_engine.h" +#include "storage/storage_policy.h" #include "util/threadpool.h" namespace doris { diff --git a/be/src/cloud/cloud_stream_load_executor.cpp b/be/src/cloud/cloud_stream_load_executor.cpp index e982acea923bc9..f038d7b83a1c3e 100644 --- a/be/src/cloud/cloud_stream_load_executor.cpp +++ b/be/src/cloud/cloud_stream_load_executor.cpp @@ -24,7 +24,7 @@ #include "cloud/config.h" #include "common/logging.h" #include "common/status.h" -#include "runtime/stream_load/stream_load_context.h" +#include "load/stream_load/stream_load_context.h" #include "util/debug_points.h" namespace doris { diff --git a/be/src/cloud/cloud_stream_load_executor.h b/be/src/cloud/cloud_stream_load_executor.h index d04e55feba552e..85965de324996f 100644 --- a/be/src/cloud/cloud_stream_load_executor.h +++ b/be/src/cloud/cloud_stream_load_executor.h @@ -16,7 +16,7 @@ // under the License. #pragma once -#include "runtime/stream_load/stream_load_executor.h" +#include "load/stream_load/stream_load_executor.h" namespace doris { diff --git a/be/src/cloud/cloud_tablet.cpp b/be/src/cloud/cloud_tablet.cpp index 02c2114511aeb1..e968ef745f5043 100644 --- a/be/src/cloud/cloud_tablet.cpp +++ b/be/src/cloud/cloud_tablet.cpp @@ -47,19 +47,19 @@ #include "cpp/sync_point.h" #include "io/cache/block_file_cache_downloader.h" #include "io/cache/block_file_cache_factory.h" -#include "olap/base_tablet.h" -#include "olap/compaction.h" -#include "olap/cumulative_compaction_time_series_policy.h" -#include "olap/olap_define.h" -#include "olap/rowset/beta_rowset.h" -#include "olap/rowset/rowset.h" -#include "olap/rowset/rowset_factory.h" -#include "olap/rowset/rowset_fwd.h" -#include "olap/rowset/rowset_writer.h" -#include "olap/rowset/segment_v2/inverted_index_desc.h" -#include "olap/storage_policy.h" -#include "olap/tablet_schema.h" -#include "olap/txn_manager.h" +#include "storage/compaction/compaction.h" +#include "storage/compaction/cumulative_compaction_time_series_policy.h" +#include "storage/index/inverted/inverted_index_desc.h" +#include "storage/olap_define.h" +#include "storage/rowset/beta_rowset.h" +#include "storage/rowset/rowset.h" +#include "storage/rowset/rowset_factory.h" +#include "storage/rowset/rowset_fwd.h" +#include "storage/rowset/rowset_writer.h" +#include "storage/storage_policy.h" +#include "storage/tablet/base_tablet.h" +#include "storage/tablet/tablet_schema.h" +#include "storage/txn/txn_manager.h" #include "util/debug_points.h" #include "util/stack_util.h" diff --git a/be/src/cloud/cloud_tablet.h b/be/src/cloud/cloud_tablet.h index 49f42efe517465..984df0427a48b5 100644 --- a/be/src/cloud/cloud_tablet.h +++ b/be/src/cloud/cloud_tablet.h @@ -19,9 +19,9 @@ #include -#include "olap/base_tablet.h" -#include "olap/partial_update_info.h" -#include "olap/rowset/rowset.h" +#include "storage/partial_update_info.h" +#include "storage/rowset/rowset.h" +#include "storage/tablet/base_tablet.h" namespace doris { diff --git a/be/src/cloud/cloud_tablet_hotspot.cpp b/be/src/cloud/cloud_tablet_hotspot.cpp index 71a6f4c92fd0e8..e61296696904e0 100644 --- a/be/src/cloud/cloud_tablet_hotspot.cpp +++ b/be/src/cloud/cloud_tablet_hotspot.cpp @@ -21,8 +21,8 @@ #include #include "cloud/config.h" -#include "olap/tablet_fwd.h" #include "runtime/exec_env.h" +#include "storage/tablet/tablet_fwd.h" namespace doris { diff --git a/be/src/cloud/cloud_tablet_hotspot.h b/be/src/cloud/cloud_tablet_hotspot.h index f5470295317eab..05acbcda5c7a66 100644 --- a/be/src/cloud/cloud_tablet_hotspot.h +++ b/be/src/cloud/cloud_tablet_hotspot.h @@ -17,13 +17,14 @@ #pragma once +#include + #include #include #include #include -#include "gen_cpp/BackendService.h" -#include "olap/tablet.h" +#include "storage/tablet/tablet.h" namespace doris { diff --git a/be/src/cloud/cloud_tablet_mgr.cpp b/be/src/cloud/cloud_tablet_mgr.cpp index 5ec365ff9dc80b..c897c9aebf7e4b 100644 --- a/be/src/cloud/cloud_tablet_mgr.cpp +++ b/be/src/cloud/cloud_tablet_mgr.cpp @@ -27,8 +27,11 @@ #include "cloud/cloud_tablet.h" #include "cloud/config.h" #include "common/status.h" -#include "olap/lru_cache.h" +#include "cpp/sync_point.h" #include "runtime/memory/cache_policy.h" +#include "util/debug_points.h" +#include "util/lru_cache.h" +#include "util/stack_util.h" namespace doris { uint64_t g_tablet_report_inactive_duration_ms = 0; diff --git a/be/src/cloud/cloud_tablet_mgr.h b/be/src/cloud/cloud_tablet_mgr.h index debd0c3fc17ae7..9894d97552b872 100644 --- a/be/src/cloud/cloud_tablet_mgr.h +++ b/be/src/cloud/cloud_tablet_mgr.h @@ -25,8 +25,8 @@ #include #include "common/status.h" -#include "olap/olap_common.h" -#include "olap/tablet_fwd.h" +#include "storage/olap_common.h" +#include "storage/tablet/tablet_fwd.h" namespace doris { diff --git a/be/src/cloud/cloud_tablets_channel.cpp b/be/src/cloud/cloud_tablets_channel.cpp index 3d27138d08abbb..173b86546960ee 100644 --- a/be/src/cloud/cloud_tablets_channel.cpp +++ b/be/src/cloud/cloud_tablets_channel.cpp @@ -23,8 +23,8 @@ #include "cloud/cloud_meta_mgr.h" #include "cloud/cloud_storage_engine.h" #include "cloud/config.h" -#include "olap/delta_writer.h" -#include "runtime/tablets_channel.h" +#include "load/channel/tablets_channel.h" +#include "load/delta_writer/delta_writer.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/cloud/cloud_tablets_channel.h b/be/src/cloud/cloud_tablets_channel.h index 4ef10166456ea9..c7b7f9410a75d3 100644 --- a/be/src/cloud/cloud_tablets_channel.h +++ b/be/src/cloud/cloud_tablets_channel.h @@ -19,7 +19,7 @@ #include -#include "runtime/tablets_channel.h" +#include "load/channel/tablets_channel.h" namespace doris { diff --git a/be/src/cloud/cloud_txn_delete_bitmap_cache.cpp b/be/src/cloud/cloud_txn_delete_bitmap_cache.cpp index ab04f4eff16ee3..f5a210feebc682 100644 --- a/be/src/cloud/cloud_txn_delete_bitmap_cache.cpp +++ b/be/src/cloud/cloud_txn_delete_bitmap_cache.cpp @@ -26,9 +26,9 @@ #include "cloud/config.h" #include "common/status.h" #include "cpp/sync_point.h" -#include "olap/olap_common.h" -#include "olap/tablet_meta.h" -#include "olap/txn_manager.h" +#include "storage/olap_common.h" +#include "storage/tablet/tablet_meta.h" +#include "storage/txn/txn_manager.h" namespace doris { diff --git a/be/src/cloud/cloud_txn_delete_bitmap_cache.h b/be/src/cloud/cloud_txn_delete_bitmap_cache.h index 7a24f315fa9ee7..4274cb1b439ab9 100644 --- a/be/src/cloud/cloud_txn_delete_bitmap_cache.h +++ b/be/src/cloud/cloud_txn_delete_bitmap_cache.h @@ -19,13 +19,13 @@ #include -#include "olap/lru_cache.h" -#include "olap/olap_common.h" -#include "olap/partial_update_info.h" -#include "olap/rowset/rowset.h" -#include "olap/tablet_meta.h" -#include "olap/txn_manager.h" +#include "storage/olap_common.h" +#include "storage/partial_update_info.h" +#include "storage/rowset/rowset.h" +#include "storage/tablet/tablet_meta.h" +#include "storage/txn/txn_manager.h" #include "util/countdown_latch.h" +#include "util/lru_cache.h" namespace doris { diff --git a/be/src/cloud/cloud_warm_up_manager.cpp b/be/src/cloud/cloud_warm_up_manager.cpp index 69a1c496a2a65a..e609257f74bfe0 100644 --- a/be/src/cloud/cloud_warm_up_manager.cpp +++ b/be/src/cloud/cloud_warm_up_manager.cpp @@ -35,12 +35,13 @@ #include "common/cast_set.h" #include "common/logging.h" #include "io/cache/block_file_cache_downloader.h" -#include "olap/rowset/beta_rowset.h" -#include "olap/rowset/segment_v2/inverted_index_desc.h" -#include "olap/tablet.h" -#include "runtime/client_cache.h" #include "runtime/exec_env.h" +#include "storage/index/inverted/inverted_index_desc.h" +#include "storage/rowset/beta_rowset.h" +#include "storage/tablet/tablet.h" #include "util/brpc_client_cache.h" // BrpcClientCache +#include "util/client_cache.h" +#include "util/stack_util.h" #include "util/thrift_rpc_helper.h" #include "util/time.h" diff --git a/be/src/cloud/cloud_warm_up_manager.h b/be/src/cloud/cloud_warm_up_manager.h index f5b00394a2768f..47411f657b899a 100644 --- a/be/src/cloud/cloud_warm_up_manager.h +++ b/be/src/cloud/cloud_warm_up_manager.h @@ -18,6 +18,7 @@ #pragma once #include +#include #include #include @@ -29,7 +30,6 @@ #include "cloud/cloud_storage_engine.h" #include "cloud/cloud_tablet.h" #include "common/status.h" -#include "gen_cpp/BackendService.h" #include "util/threadpool.h" namespace doris { diff --git a/be/src/cloud/delete_bitmap_file_reader.h b/be/src/cloud/delete_bitmap_file_reader.h index 2cb90f996e6596..1c6a9d51ce7896 100644 --- a/be/src/cloud/delete_bitmap_file_reader.h +++ b/be/src/cloud/delete_bitmap_file_reader.h @@ -17,9 +17,10 @@ #pragma once +#include + #include "cloud/cloud_storage_engine.h" #include "common/status.h" -#include "gen_cpp/olap_file.pb.h" #include "io/fs/file_reader_writer_fwd.h" namespace doris { diff --git a/be/src/cloud/injection_point_action.cpp b/be/src/cloud/injection_point_action.cpp index 521ff52ffc38c0..cfd97aae35b4da 100644 --- a/be/src/cloud/injection_point_action.cpp +++ b/be/src/cloud/injection_point_action.cpp @@ -25,12 +25,12 @@ #include "common/status.h" #include "cpp/sync_point.h" -#include "http/http_channel.h" -#include "http/http_request.h" -#include "http/http_status.h" #include "io/cache/cached_remote_file_reader.h" -#include "olap/rowset/rowset.h" -#include "olap/rowset/segment_v2/page_io.h" +#include "service/http/http_channel.h" +#include "service/http/http_request.h" +#include "service/http/http_status.h" +#include "storage/rowset/rowset.h" +#include "storage/segment/page_io.h" #include "util/stack_util.h" namespace doris { diff --git a/be/src/cloud/injection_point_action.h b/be/src/cloud/injection_point_action.h index 67a1cd2ace5b3f..42415e0d9067b4 100644 --- a/be/src/cloud/injection_point_action.h +++ b/be/src/cloud/injection_point_action.h @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "http/http_handler.h" +#include "service/http/http_handler.h" namespace doris { diff --git a/be/src/cloud/pb_convert.cpp b/be/src/cloud/pb_convert.cpp index 9869b876ab754f..ed4c55afb049b4 100644 --- a/be/src/cloud/pb_convert.cpp +++ b/be/src/cloud/pb_convert.cpp @@ -17,11 +17,12 @@ #include "cloud/pb_convert.h" -#include #include #include +#include "common/logging.h" + namespace doris::cloud { #include "common/compile_check_begin.h" diff --git a/be/src/common/be_mock_util.cpp b/be/src/common/be_mock_util.cpp index c338e753318c8c..7e98a10c3734d0 100644 --- a/be/src/common/be_mock_util.cpp +++ b/be/src/common/be_mock_util.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "be_mock_util.h" +#include "common/be_mock_util.h" #include #include diff --git a/be/src/common/cast_set.h b/be/src/common/cast_set.h index 035f09e306b46f..0f10eb51b51ba1 100644 --- a/be/src/common/cast_set.h +++ b/be/src/common/cast_set.h @@ -23,7 +23,7 @@ #include "common/exception.h" #include "common/status.h" -#include "vec/core/extended_types.h" +#include "core/extended_types.h" namespace doris { diff --git a/be/src/common/compare.h b/be/src/common/compare.h index 6649700664dd20..a1554c41000ff7 100644 --- a/be/src/common/compare.h +++ b/be/src/common/compare.h @@ -18,7 +18,7 @@ #include #include "common/compiler_util.h" -#include "runtime/type_limit.h" +#include "core/type_limit.h" #pragma once namespace doris { diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp index e071685c059c59..6865b28a4eb485 100644 --- a/be/src/common/config.cpp +++ b/be/src/common/config.cpp @@ -44,6 +44,10 @@ #include "common/status.h" #include "io/fs/file_writer.h" #include "io/fs/local_file_system.h" +#include "load/memtable/memtable_flush_executor.h" +#include "runtime/exec_env.h" +#include "runtime/workload_group/workload_group_manager.h" +#include "storage/storage_engine.h" #include "util/cpu_info.h" namespace doris::config { diff --git a/be/src/common/consts.h b/be/src/common/consts.h index 07e6b63644757f..8e67f0c81fd70f 100644 --- a/be/src/common/consts.h +++ b/be/src/common/consts.h @@ -49,4 +49,27 @@ static constexpr int MAX_DECIMALV3_SCALE = MAX_DECIMALV3_PRECISION; static constexpr int DEFAULT_VARIANT_MAX_SPARSE_COLUMN_STATS_SIZE = 10000; static constexpr int DEFAULT_VARIANT_SPARSE_HASH_SHARD_COUNT = 1; } // namespace BeConsts + +// In our system, we have more complicated situation. +// First, our keys can be nullptr. +// Second, when key columns are not complete we want to distinguish GT and GE. For example, +// there are two key columns a and b, we have only one condition a > 1. We can only encode +// a prefix key 1, which is less than 1|2. This will make our read more data than +// we actually need. So we want to add more marker. +// a > 1: will be encoded into 1|\xFF +// a >= 1: will be encoded into 1|\x00 +// a = 1 and b > 1: will be encoded into 1|\x02|1 +// a = 1 and b is null: will be encoded into 1|\x01 +namespace KeyConsts { +// Used to represent minimal value for that field +constexpr uint8_t KEY_MINIMAL_MARKER = 0x00; +// Used to represent a null field, which value is seemed as minimal than other values +constexpr uint8_t KEY_NULL_FIRST_MARKER = 0x01; +// Used to represent a normal field, which content is encoded after this marker +constexpr uint8_t KEY_NORMAL_MARKER = 0x02; +// Used to represent maximal value for that field +constexpr uint8_t KEY_MAXIMAL_MARKER = 0xFF; +// Used to represent a value greater than the normal marker by 1, using by MoW +constexpr uint8_t KEY_NORMAL_NEXT_MARKER = 0x03; +} // namespace KeyConsts } // namespace doris diff --git a/be/src/common/daemon.cpp b/be/src/common/daemon.cpp index a17380c245fdcf..74c375ffdd2c62 100644 --- a/be/src/common/daemon.cpp +++ b/be/src/common/daemon.cpp @@ -41,10 +41,11 @@ #include "cloud/config.h" #include "common/config.h" #include "common/logging.h" +#include "common/metrics/doris_metrics.h" +#include "common/metrics/metrics.h" +#include "common/metrics/system_metrics.h" #include "common/status.h" -#include "olap/memtable_memory_limiter.h" -#include "olap/storage_engine.h" -#include "olap/tablet_manager.h" +#include "load/memtable/memtable_memory_limiter.h" #include "runtime/be_proc_monitor.h" #include "runtime/exec_env.h" #include "runtime/fragment_mgr.h" @@ -54,12 +55,11 @@ #include "runtime/process_profile.h" #include "runtime/runtime_query_statistics_mgr.h" #include "runtime/workload_group/workload_group_manager.h" +#include "storage/storage_engine.h" +#include "storage/tablet/tablet_manager.h" #include "util/algorithm_util.h" -#include "util/doris_metrics.h" #include "util/mem_info.h" -#include "util/metrics.h" #include "util/perf_counters.h" -#include "util/system_metrics.h" #include "util/time.h" namespace doris { diff --git a/be/src/vec/common/demangle.cpp b/be/src/common/demangle.cpp similarity index 98% rename from be/src/vec/common/demangle.cpp rename to be/src/common/demangle.cpp index 6c91aac525d01c..87e455c4fa90bd 100644 --- a/be/src/vec/common/demangle.cpp +++ b/be/src/common/demangle.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/base/base/demangle.cpp // and modified by Doris -#include "vec/common/demangle.h" +#include "common/demangle.h" #if defined(__has_feature) #if __has_feature(memory_sanitizer) diff --git a/be/src/vec/common/demangle.h b/be/src/common/demangle.h similarity index 100% rename from be/src/vec/common/demangle.h rename to be/src/common/demangle.h diff --git a/be/src/common/elf.cpp b/be/src/common/elf.cpp index 4738bde0cbabb3..73c9127506722e 100644 --- a/be/src/common/elf.cpp +++ b/be/src/common/elf.cpp @@ -20,18 +20,19 @@ #if defined(__ELF__) && !defined(__FreeBSD__) -#include +#include "common/elf.h" + #include #include #include #include -#include #include #include #include "common/logging.h" #include "common/macros.h" +#include "util/unaligned.h" namespace doris { diff --git a/be/src/common/kerberos/kerberos_ticket_mgr.cpp b/be/src/common/kerberos/kerberos_ticket_mgr.cpp index 45dca7eca4b13b..720167ba05f5dd 100644 --- a/be/src/common/kerberos/kerberos_ticket_mgr.cpp +++ b/be/src/common/kerberos/kerberos_ticket_mgr.cpp @@ -22,9 +22,9 @@ #include #include "common/logging.h" -#include "exec/schema_scanner/schema_scanner_helper.h" +#include "core/block/block.h" +#include "information_schema/schema_scanner_helper.h" #include "service/backend_options.h" -#include "vec/core/block.h" namespace doris::kerberos { @@ -155,8 +155,7 @@ std::vector KerberosTicketMgr::get_krb_ticket_cache_info() { return result; } -void KerberosTicketMgr::get_ticket_cache_info_block(vectorized::Block* block, - const cctz::time_zone& ctz) { +void KerberosTicketMgr::get_ticket_cache_info_block(Block* block, const cctz::time_zone& ctz) { TBackend be = BackendOptions::get_local_backend(); int64_t be_id = be.id; std::string be_ip = be.host; diff --git a/be/src/common/kerberos/kerberos_ticket_mgr.h b/be/src/common/kerberos/kerberos_ticket_mgr.h index 67c660d0b46db6..07a73d6181b98d 100644 --- a/be/src/common/kerberos/kerberos_ticket_mgr.h +++ b/be/src/common/kerberos/kerberos_ticket_mgr.h @@ -33,9 +33,7 @@ namespace doris { -namespace vectorized { class Block; -} namespace kerberos { @@ -70,7 +68,7 @@ class KerberosTicketMgr { // Set the cleanup interval for testing purpose void set_cleanup_interval(std::chrono::seconds interval) { _cleanup_interval = interval; } - void get_ticket_cache_info_block(vectorized::Block* block, const cctz::time_zone& ctz); + void get_ticket_cache_info_block(Block* block, const cctz::time_zone& ctz); virtual ~KerberosTicketMgr(); diff --git a/be/src/util/doris_metrics.cpp b/be/src/common/metrics/doris_metrics.cpp similarity index 99% rename from be/src/util/doris_metrics.cpp rename to be/src/common/metrics/doris_metrics.cpp index 7a92b3676f142b..f9e0e8ace47098 100644 --- a/be/src/util/doris_metrics.cpp +++ b/be/src/common/metrics/doris_metrics.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "util/doris_metrics.h" +#include "common/metrics/doris_metrics.h" // IWYU pragma: no_include #include // IWYU pragma: keep @@ -30,10 +30,10 @@ #include #include +#include "common/metrics/metrics.h" +#include "common/metrics/system_metrics.h" #include "common/status.h" #include "io/fs/local_file_system.h" -#include "util/metrics.h" -#include "util/system_metrics.h" namespace doris { namespace io { diff --git a/be/src/util/doris_metrics.h b/be/src/common/metrics/doris_metrics.h similarity index 99% rename from be/src/util/doris_metrics.h rename to be/src/common/metrics/doris_metrics.h index 95ffb833a37edf..75d6f32d4d1d42 100644 --- a/be/src/util/doris_metrics.h +++ b/be/src/common/metrics/doris_metrics.h @@ -24,9 +24,9 @@ #include #include -#include "util/jvm_metrics.h" -#include "util/metrics.h" -#include "util/system_metrics.h" +#include "common/metrics/jvm_metrics.h" +#include "common/metrics/metrics.h" +#include "common/metrics/system_metrics.h" namespace doris { diff --git a/be/src/util/jvm_metrics.cpp b/be/src/common/metrics/jvm_metrics.cpp similarity index 99% rename from be/src/util/jvm_metrics.cpp rename to be/src/common/metrics/jvm_metrics.cpp index d722272bfb7e3f..b2f9dbf03a8d8f 100644 --- a/be/src/util/jvm_metrics.cpp +++ b/be/src/common/metrics/jvm_metrics.cpp @@ -15,15 +15,14 @@ // specific language governing permissions and limitations // under the License. -#include "jvm_metrics.h" - -#include +#include "common/metrics/jvm_metrics.h" #include #include "common/config.h" +#include "common/metrics/metrics.h" #include "util/defer_op.h" -#include "util/metrics.h" +#include "util/jni-util.h" namespace doris { diff --git a/be/src/util/jvm_metrics.h b/be/src/common/metrics/jvm_metrics.h similarity index 99% rename from be/src/util/jvm_metrics.h rename to be/src/common/metrics/jvm_metrics.h index fc9b58fbc10e3b..1840af7b25ac6d 100644 --- a/be/src/util/jvm_metrics.h +++ b/be/src/common/metrics/jvm_metrics.h @@ -17,9 +17,9 @@ #pragma once +#include "common/metrics/metrics.h" #include "jni.h" #include "util/jni-util.h" -#include "util/metrics.h" namespace doris { diff --git a/be/src/util/metrics.cpp b/be/src/common/metrics/metrics.cpp similarity index 99% rename from be/src/util/metrics.cpp rename to be/src/common/metrics/metrics.cpp index 1a3aa51cd2b119..0800d486131564 100644 --- a/be/src/util/metrics.cpp +++ b/be/src/common/metrics/metrics.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "util/metrics.h" +#include "common/metrics/metrics.h" #include #include diff --git a/be/src/util/metrics.h b/be/src/common/metrics/metrics.h similarity index 100% rename from be/src/util/metrics.h rename to be/src/common/metrics/metrics.h diff --git a/be/src/util/system_metrics.cpp b/be/src/common/metrics/system_metrics.cpp similarity index 99% rename from be/src/util/system_metrics.cpp rename to be/src/common/metrics/system_metrics.cpp index 98c9299f6b4c4f..5f28be0d5541fe 100644 --- a/be/src/util/system_metrics.cpp +++ b/be/src/common/metrics/system_metrics.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "util/system_metrics.h" +#include "common/metrics/system_metrics.h" #include #include diff --git a/be/src/util/system_metrics.h b/be/src/common/metrics/system_metrics.h similarity index 99% rename from be/src/util/system_metrics.h rename to be/src/common/metrics/system_metrics.h index 2c5446b81f4f71..c2c7c8fa333443 100644 --- a/be/src/util/system_metrics.h +++ b/be/src/common/metrics/system_metrics.h @@ -26,7 +26,7 @@ #include #include -#include "util/metrics.h" +#include "common/metrics/metrics.h" namespace doris { diff --git a/be/src/common/stack_trace.cpp b/be/src/common/stack_trace.cpp index 022ce90aa91232..440c8d54f5b8e2 100644 --- a/be/src/common/stack_trace.cpp +++ b/be/src/common/stack_trace.cpp @@ -20,10 +20,6 @@ #include "common/stack_trace.h" -#include -#include -#include -#include #include #include @@ -33,10 +29,14 @@ #include #include -#include "config.h" +#include "common/config.h" +#include "common/demangle.h" +#include "common/dwarf.h" +#include "common/elf.h" +#include "common/memory_sanitizer.h" +#include "common/symbol_index.h" +#include "exec/common/hex.h" #include "util/string_util.h" -#include "vec/common/demangle.h" -#include "vec/common/hex.h" #if defined(USE_UNWIND) && USE_UNWIND && defined(__x86_64__) #include @@ -53,7 +53,7 @@ std::atomic show_addresses = true; // void writePointerHex(const void* ptr, std::stringstream& buf) { // buf.write("0x", 2); // char hex_str[2 * sizeof(ptr)]; -// doris::vectorized::write_hex_uint_lowercase(reinterpret_cast(ptr), hex_str); +// doris::write_hex_uint_lowercase(reinterpret_cast(ptr), hex_str); // buf.write(hex_str, 2 * sizeof(ptr)); // } // #endif diff --git a/be/src/common/symbol_index.cpp b/be/src/common/symbol_index.cpp index fc60e2186e9ae3..4fccbd0e696874 100644 --- a/be/src/common/symbol_index.cpp +++ b/be/src/common/symbol_index.cpp @@ -20,7 +20,8 @@ #if defined(__ELF__) && !defined(__FreeBSD__) -#include +#include "common/symbol_index.h" + #include #include @@ -30,7 +31,7 @@ #include #include "common/stack_trace.h" -#include "vec/common/hex.h" +#include "exec/common/hex.h" /** @@ -412,7 +413,7 @@ void collectSymbolsFromELF(dl_phdr_info* info, std::vector& char* pos = build_id_hex.data(); for (auto c : build_id) { - vectorized::write_hex_byte_lowercase(c, pos); + write_hex_byte_lowercase(c, pos); pos += 2; } @@ -532,7 +533,7 @@ std::string SymbolIndex::getBuildIDHex() const { char* pos = build_id_hex.data(); for (auto c : build_id_binary) { - vectorized::write_hex_byte_uppercase(c, pos); + write_hex_byte_uppercase(c, pos); pos += 2; } diff --git a/be/src/common/symbol_index.h b/be/src/common/symbol_index.h index b713599c58d6e2..4ff5e9a14ae1ca 100644 --- a/be/src/common/symbol_index.h +++ b/be/src/common/symbol_index.h @@ -23,14 +23,15 @@ #if defined(__ELF__) && !defined(__FreeBSD__) #include -#include -#include #include #include #include #include +#include "common/elf.h" +#include "common/multi_version.h" + namespace doris { /** Allow to quickly find symbol name from address. diff --git a/be/src/http/CMakeLists.txt b/be/src/core/CMakeLists.txt similarity index 79% rename from be/src/http/CMakeLists.txt rename to be/src/core/CMakeLists.txt index 92b196f8c7a441..84de7cd3a9d631 100644 --- a/be/src/http/CMakeLists.txt +++ b/be/src/core/CMakeLists.txt @@ -16,14 +16,12 @@ # under the License. # where to put generated libraries -set(LIBRARY_OUTPUT_PATH "${BUILD_DIR}/src/http") +set(LIBRARY_OUTPUT_PATH "${BUILD_DIR}/src/core") # where to put generated binaries -set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/src/http") +set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/src/core") -file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS - *.cpp -) -add_library(Webserver STATIC ${SRC_FILES}) +file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS *.cpp) +add_library(Core STATIC ${SRC_FILES}) -pch_reuse(Webserver) +pch_reuse(Core) diff --git a/be/src/vec/core/accurate_comparison.h b/be/src/core/accurate_comparison.h similarity index 98% rename from be/src/vec/core/accurate_comparison.h rename to be/src/core/accurate_comparison.h index 85c40f52ecc3c5..72b3a934dcc950 100644 --- a/be/src/vec/core/accurate_comparison.h +++ b/be/src/core/accurate_comparison.h @@ -21,10 +21,10 @@ #pragma once #include "common/compare.h" -#include "runtime/primitive_type.h" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" -namespace doris::vectorized { +#include "core/data_type/primitive_type.h" +#include "core/string_ref.h" +#include "core/types.h" +namespace doris { template struct CompareType { @@ -393,4 +393,4 @@ struct GreaterOrEqualsOp { static UInt8 apply(const TimestampTzValue& a, const TimestampTzValue& b) { return a >= b; } }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/allocator.cpp b/be/src/core/allocator.cpp similarity index 99% rename from be/src/vec/common/allocator.cpp rename to be/src/core/allocator.cpp index 21db641335b77a..ba80772291bfab 100644 --- a/be/src/vec/common/allocator.cpp +++ b/be/src/core/allocator.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/common/allocator.h" +#include "core/allocator.h" #include diff --git a/be/src/vec/common/allocator.h b/be/src/core/allocator.h similarity index 99% rename from be/src/vec/common/allocator.h rename to be/src/core/allocator.h index 58bc9a6089da89..80eabfcc7b7f5f 100644 --- a/be/src/vec/common/allocator.h +++ b/be/src/core/allocator.h @@ -59,7 +59,7 @@ #define DISABLE_MREMAP 1 #endif #include "common/exception.h" -#include "vec/common/mremap.h" +#include "core/mremap.h" /// Required for older Darwin builds, that lack definition of MAP_ANONYMOUS #ifndef MAP_ANONYMOUS diff --git a/be/src/vec/common/allocator_fwd.h b/be/src/core/allocator_fwd.h similarity index 100% rename from be/src/vec/common/allocator_fwd.h rename to be/src/core/allocator_fwd.h diff --git a/be/src/vec/common/arena.h b/be/src/core/arena.h similarity index 98% rename from be/src/vec/common/arena.h rename to be/src/core/arena.h index 49aa947788bcec..32859b47b406b0 100644 --- a/be/src/vec/common/arena.h +++ b/be/src/core/arena.h @@ -20,7 +20,6 @@ #pragma once -#include #include #include @@ -28,10 +27,11 @@ #include #include -#include "vec/common/allocator.h" -#include "vec/common/allocator_fwd.h" +#include "common/compiler_util.h" +#include "core/allocator.h" +#include "core/allocator_fwd.h" -namespace doris::vectorized { +namespace doris { /** Memory pool to append something. For example, short strings. * Usage scenario: @@ -345,4 +345,4 @@ class Arena : private boost::noncopyable { using ArenaPtr = std::shared_ptr; using Arenas = std::vector; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/arena_with_free_lists.h b/be/src/core/arena_with_free_lists.h similarity index 96% rename from be/src/vec/common/arena_with_free_lists.h rename to be/src/core/arena_with_free_lists.h index 2218f0cf06e125..d778f760a9a4b7 100644 --- a/be/src/vec/common/arena_with_free_lists.h +++ b/be/src/core/arena_with_free_lists.h @@ -22,10 +22,10 @@ #include -#include "vec/common/arena.h" -#include "vec/common/bit_helpers.h" +#include "core/arena.h" +#include "exec/common/bit_helpers.h" -namespace doris::vectorized { +namespace doris { class ArenaWithFreeLists : private Allocator, private boost::noncopyable { private: @@ -100,4 +100,4 @@ class ArenaWithFreeLists : private Allocator, private boost::noncopyable size_t allocated_bytes() const { return pool.size(); } }; -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/common/assert_cast.h b/be/src/core/assert_cast.h similarity index 99% rename from be/src/vec/common/assert_cast.h rename to be/src/core/assert_cast.h index 1905983a58cc29..bdcd64789e3fcb 100644 --- a/be/src/vec/common/assert_cast.h +++ b/be/src/core/assert_cast.h @@ -23,9 +23,9 @@ #include #include +#include "common/demangle.h" #include "common/exception.h" #include "common/logging.h" -#include "vec/common/demangle.h" enum class TypeCheckOnRelease : bool { ENABLE = true, DISABLE = false }; diff --git a/be/src/util/binary_cast.hpp b/be/src/core/binary_cast.hpp similarity index 95% rename from be/src/util/binary_cast.hpp rename to be/src/core/binary_cast.hpp index 1b4577486b8b9b..d39944bd9b6e98 100644 --- a/be/src/util/binary_cast.hpp +++ b/be/src/core/binary_cast.hpp @@ -20,11 +20,11 @@ #include #include -#include "runtime/decimalv2_value.h" -#include "util/types.h" -#include "vec/core/extended_types.h" -#include "vec/runtime/timestamptz_value.h" -#include "vec/runtime/vdatetime_value.h" +#include "core/extended_types.h" +#include "core/packed_int128.h" +#include "core/value/decimalv2_value.h" +#include "core/value/timestamptz_value.h" +#include "core/value/vdatetime_value.h" namespace doris { union TypeConverter { diff --git a/be/src/vec/core/block.cpp b/be/src/core/block/block.cpp similarity index 98% rename from be/src/vec/core/block.cpp rename to be/src/core/block/block.cpp index 93a6cc40f346e8..051338dd29a4b3 100644 --- a/be/src/vec/core/block.cpp +++ b/be/src/core/block/block.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Block.cpp // and modified by Doris -#include "vec/core/block.h" +#include "core/block/block.h" #include #include @@ -39,22 +39,22 @@ #include "common/config.h" #include "common/logging.h" #include "common/status.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_nothing.h" +#include "core/column/column_nullable.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type_factory.hpp" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type_serde/data_type_serde.h" #include "runtime/descriptors.h" +#include "runtime/runtime_profile.h" #include "runtime/thread_context.h" #include "util/block_compression.h" #include "util/faststring.h" -#include "util/runtime_profile.h" #include "util/simd/bits.h" #include "util/slice.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_nothing.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/data_types/data_type_factory.hpp" -#include "vec/data_types/data_type_nullable.h" -#include "vec/data_types/serde/data_type_serde.h" class SipHash; @@ -62,7 +62,7 @@ namespace doris::segment_v2 { enum CompressionTypePB : int; } // namespace doris::segment_v2 #include "common/compile_check_begin.h" -namespace doris::vectorized { +namespace doris { template void clear_blocks(moodycamel::ConcurrentQueue& blocks, RuntimeProfile::Counter* memory_used_counter = nullptr) { @@ -831,7 +831,7 @@ Status Block::filter_block(Block* block, const std::vector& columns_to } } else { const IColumn::Filter& filter = - assert_cast(*filter_column).get_data(); + assert_cast(*filter_column).get_data(); RETURN_IF_CATCH_EXCEPTION(filter_block_internal(block, columns_to_filter, filter)); } @@ -1141,4 +1141,4 @@ std::string MutableBlock::dump_names() const { return out; } #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/core/block.h b/be/src/core/block/block.h similarity index 98% rename from be/src/vec/core/block.h rename to be/src/core/block/block.h index 9c8ca88a71dce1..43d55164750d3c 100644 --- a/be/src/vec/core/block.h +++ b/be/src/core/block/block.h @@ -38,13 +38,13 @@ #include "common/exception.h" #include "common/factory_creator.h" #include "common/status.h" -#include "vec/columns/column.h" -#include "vec/columns/column_nullable.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/core/columns_with_type_and_name.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_nullable.h" +#include "core/block/column_with_type_and_name.h" +#include "core/block/columns_with_type_and_name.h" +#include "core/column/column.h" +#include "core/column/column_nullable.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_nullable.h" +#include "core/types.h" class SipHash; @@ -58,8 +58,6 @@ namespace segment_v2 { enum CompressionTypePB : int; } // namespace segment_v2 -namespace vectorized { - /** Container for set of columns for bunch of rows in memory. * This is unit of data processing. * Also contains metadata - data types of columns and their names @@ -618,5 +616,4 @@ struct IteratorRowRef { using BlockView = std::vector; using BlockUPtr = std::unique_ptr; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/core/column_numbers.h b/be/src/core/block/column_numbers.h similarity index 97% rename from be/src/vec/core/column_numbers.h rename to be/src/core/block/column_numbers.h index 32a0dd5804ab22..1c5a10cb670434 100644 --- a/be/src/vec/core/column_numbers.h +++ b/be/src/core/block/column_numbers.h @@ -23,7 +23,7 @@ #include #include -namespace doris::vectorized { +namespace doris { using ColumnNumbers = std::vector; } diff --git a/be/src/vec/core/column_with_type_and_name.cpp b/be/src/core/block/column_with_type_and_name.cpp similarity index 91% rename from be/src/vec/core/column_with_type_and_name.cpp rename to be/src/core/block/column_with_type_and_name.cpp index 6478ad2bdec629..ec3f4a61386fdd 100644 --- a/be/src/vec/core/column_with_type_and_name.cpp +++ b/be/src/core/block/column_with_type_and_name.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/ColumnWithTypeAndName.cpp // and modified by Doris -#include "vec/core/column_with_type_and_name.h" +#include "core/block/column_with_type_and_name.h" #include #include @@ -27,15 +27,15 @@ #include #include +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_nothing.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_nullable.h" +#include "core/types.h" #include "util/simd/bits.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_nothing.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_nullable.h" -namespace doris::vectorized { +namespace doris { ColumnWithTypeAndName ColumnWithTypeAndName::clone_empty() const { ColumnWithTypeAndName res; @@ -85,14 +85,14 @@ String ColumnWithTypeAndName::dump_structure() const { } std::string ColumnWithTypeAndName::to_string( - size_t row_num, const vectorized::DataTypeSerDe::FormatOptions& format_options) const { + size_t row_num, const DataTypeSerDe::FormatOptions& format_options) const { return type->to_string(*column->convert_to_full_column_if_const().get(), row_num, format_options); } #ifdef BE_TEST std::string ColumnWithTypeAndName::to_string(size_t row_num) const { - auto format_options = vectorized::DataTypeSerDe::get_default_format_options(); + auto format_options = DataTypeSerDe::get_default_format_options(); auto timezone = cctz::utc_time_zone(); format_options.timezone = &timezone; return type->to_string(*column->convert_to_full_column_if_const().get(), row_num, @@ -163,4 +163,4 @@ Status ColumnWithTypeAndName::check_type_and_column_match() const { } return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/core/column_with_type_and_name.h b/be/src/core/block/column_with_type_and_name.h similarity index 88% rename from be/src/vec/core/column_with_type_and_name.h rename to be/src/core/block/column_with_type_and_name.h index cf484e48db171c..9b1c357ac66c98 100644 --- a/be/src/vec/core/column_with_type_and_name.h +++ b/be/src/core/block/column_with_type_and_name.h @@ -27,15 +27,15 @@ #include #include -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_serde.h" +#include "core/data_type/data_type.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/types.h" namespace doris { class PColumnMeta; } // namespace doris -namespace doris::vectorized { +namespace doris { // class WriteBuffer; @@ -62,8 +62,7 @@ struct ColumnWithTypeAndName { void dump_structure(std::ostream& out) const; String dump_structure() const; - std::string to_string(size_t row_num, - const vectorized::DataTypeSerDe::FormatOptions& format_options) const; + std::string to_string(size_t row_num, const DataTypeSerDe::FormatOptions& format_options) const; #ifdef BE_TEST std::string to_string(size_t row_num) const; #endif @@ -75,4 +74,4 @@ struct ColumnWithTypeAndName { Status check_type_and_column_match() const; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/core/columns_with_type_and_name.h b/be/src/core/block/columns_with_type_and_name.h similarity index 92% rename from be/src/vec/core/columns_with_type_and_name.h rename to be/src/core/block/columns_with_type_and_name.h index f3a329150e4a0e..61b377ed82d272 100644 --- a/be/src/vec/core/columns_with_type_and_name.h +++ b/be/src/core/block/columns_with_type_and_name.h @@ -24,10 +24,10 @@ #include #include -#include "vec/core/column_with_type_and_name.h" -#include "vec/data_types/data_type.h" +#include "core/block/column_with_type_and_name.h" +#include "core/data_type/data_type.h" -namespace doris::vectorized { +namespace doris { using ColumnsWithTypeAndName = std::vector; // only used in inverted index @@ -40,4 +40,4 @@ using ColumnsWithTypeAndName = std::vector; // storage_type is the data type in Doris using IndexFieldNameAndTypePair = std::pair; using NameAndTypePairs = std::vector>; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/core/materialize_block.cpp b/be/src/core/block/materialize_block.cpp similarity index 86% rename from be/src/vec/core/materialize_block.cpp rename to be/src/core/block/materialize_block.cpp index cfa3047cbb414f..96384031b71ab1 100644 --- a/be/src/vec/core/materialize_block.cpp +++ b/be/src/core/block/materialize_block.cpp @@ -18,14 +18,14 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataStreams/materializeBlock.cpp // and modified by Doris -#include "vec/core/materialize_block.h" +#include "core/block/materialize_block.h" #include -#include "vec/columns/column.h" -#include "vec/core/column_with_type_and_name.h" +#include "core/block/column_with_type_and_name.h" +#include "core/column/column.h" -namespace doris::vectorized { +namespace doris { void materialize_block_inplace(Block& block) { for (size_t i = 0; i < block.columns(); ++i) { @@ -33,4 +33,4 @@ void materialize_block_inplace(Block& block) { } } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/core/materialize_block.h b/be/src/core/block/materialize_block.h similarity index 93% rename from be/src/vec/core/materialize_block.h rename to be/src/core/block/materialize_block.h index 31126a37c0b288..b6a9842f339c87 100644 --- a/be/src/vec/core/materialize_block.h +++ b/be/src/core/block/materialize_block.h @@ -20,9 +20,9 @@ #pragma once -#include "vec/core/block.h" +#include "core/block/block.h" -namespace doris::vectorized { +namespace doris { /** Converts columns-constants to full columns ("materializes" them). */ @@ -35,4 +35,4 @@ void materialize_block_inplace(Block& block, Iterator start, Iterator end) { ++start; } } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/core/call_on_type_index.h b/be/src/core/call_on_type_index.h similarity index 98% rename from be/src/vec/core/call_on_type_index.h rename to be/src/core/call_on_type_index.h index 701e04e3af44b4..bee8ec9feace66 100644 --- a/be/src/vec/core/call_on_type_index.h +++ b/be/src/core/call_on_type_index.h @@ -22,11 +22,11 @@ #include -#include "vec/core/types.h" -#include "vec/data_types/data_type_time.h" -#include "vec/data_types/data_type_timestamptz.h" +#include "core/data_type/data_type_time.h" +#include "core/data_type/data_type_timestamptz.h" +#include "core/types.h" -namespace doris::vectorized { +namespace doris { template struct TypePair { @@ -428,4 +428,4 @@ bool dispatch_switch_decimalv3(PrimitiveType number, F&& f) { return dispatch_type_base(number, std::forward(f)); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column.cpp b/be/src/core/column/column.cpp similarity index 92% rename from be/src/vec/columns/column.cpp rename to be/src/core/column/column.cpp index 9fd6c1d7ebbb4a..4ee1c1660edb5d 100644 --- a/be/src/vec/columns/column.cpp +++ b/be/src/core/column/column.cpp @@ -18,15 +18,15 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Columns/IColumn.cpp // and modified by Doris -#include "vec/columns/column.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_nullable.h" +#include "core/data_type/data_type.h" +#include "exec/sort/sort_block.h" #include "util/simd/bits.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_nullable.h" -#include "vec/core/sort_block.h" -#include "vec/data_types/data_type.h" -namespace doris::vectorized { +namespace doris { std::string IColumn::dump_structure() const { std::stringstream res; @@ -92,4 +92,4 @@ void IColumn::check_const_only_in_top_level() const { const_cast(this)->for_each_subcolumn(throw_if_const); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column.h b/be/src/core/column/column.h similarity index 98% rename from be/src/vec/columns/column.h rename to be/src/core/column/column.h index cbd3c8df61d9b6..0b493a4f837441 100644 --- a/be/src/vec/columns/column.h +++ b/be/src/core/column/column.h @@ -28,20 +28,21 @@ #include #include "common/status.h" -#include "olap/olap_common.h" -#include "runtime/define_primitive_type.h" -#include "vec/common/cow.h" -#include "vec/common/pod_array_fwd.h" -#include "vec/common/string_ref.h" -#include "vec/common/typeid_cast.h" -#include "vec/core/field.h" -#include "vec/core/types.h" +#include "core/assert_cast.h" +#include "core/cow.h" +#include "core/data_type/define_primitive_type.h" +#include "core/field.h" +#include "core/pod_array_fwd.h" +#include "core/string_ref.h" +#include "core/typeid_cast.h" +#include "core/types.h" +#include "storage/olap_common.h" namespace doris { class SipHash; } -namespace doris::vectorized { +namespace doris { class Arena; class ColumnSorter; @@ -794,13 +795,13 @@ bool is_column_const(const IColumn& column); /// True if column's an ColumnNullable instance. It's just a syntax sugar for type check. bool is_column_nullable(const IColumn& column); -} // namespace doris::vectorized +} // namespace doris // Wrap `ColumnPtr` because `ColumnPtr` can't be used in forward declaration. namespace doris { struct ColumnPtrWrapper { - vectorized::ColumnPtr column_ptr; + ColumnPtr column_ptr; - ColumnPtrWrapper(vectorized::ColumnPtr col) : column_ptr(std::move(col)) {} + ColumnPtrWrapper(ColumnPtr col) : column_ptr(std::move(col)) {} }; } // namespace doris diff --git a/be/src/vec/columns/column_array.cpp b/be/src/core/column/column_array.cpp similarity index 98% rename from be/src/vec/columns/column_array.cpp rename to be/src/core/column/column_array.cpp index 2b2e6ea06dc397..5b7f8887dc2515 100644 --- a/be/src/vec/columns/column_array.cpp +++ b/be/src/core/column/column_array.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Columns/ColumnArray.cpp // and modified by Doris -#include "vec/columns/column_array.h" +#include "core/column/column_array.h" #include #include @@ -26,27 +26,27 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "runtime/primitive_type.h" +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_decimal.h" +#include "core/column/column_nullable.h" +#include "core/column/column_string.h" +#include "core/column/columns_common.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/memcpy_small.h" +#include "core/typeid_cast.h" +#include "exec/sort/sort_block.h" #include "util/simd/bits.h" #include "util/simd/vstring_function.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_decimal.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_string.h" -#include "vec/columns/columns_common.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/common/memcpy_small.h" -#include "vec/common/typeid_cast.h" -#include "vec/common/unaligned.h" -#include "vec/core/sort_block.h" -#include "vec/data_types/data_type.h" +#include "util/unaligned.h" class SipHash; -namespace doris::vectorized { +namespace doris { ColumnArray::ColumnArray(MutableColumnPtr&& nested_column, MutableColumnPtr&& offsets_column) : data(std::move(nested_column)), offsets(std::move(offsets_column)) { @@ -1007,4 +1007,4 @@ void ColumnArray::replace_float_special_values() { get_data().replace_float_special_values(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_array.h b/be/src/core/column/column_array.h similarity index 97% rename from be/src/vec/columns/column_array.h rename to be/src/core/column/column_array.h index 8ba4f37fef0a0b..6ff693b3bb003a 100644 --- a/be/src/vec/columns/column_array.h +++ b/be/src/core/column/column_array.h @@ -30,13 +30,13 @@ #include #include "common/compiler_util.h" // IWYU pragma: keep -#include "vec/columns/column.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/common/cow.h" -#include "vec/common/string_ref.h" -#include "vec/core/field.h" -#include "vec/core/types.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_vector.h" +#include "core/cow.h" +#include "core/field.h" +#include "core/string_ref.h" +#include "core/types.h" class SipHash; @@ -50,7 +50,7 @@ class SipHash; #define ALL_COLUMNS_NUMERIC ALL_COLUMNS_NUMBER, ALL_COLUMNS_TIME #define ALL_COLUMNS_SIMPLE ALL_COLUMNS_NUMERIC, ColumnString, ColumnIPv4, ColumnIPv6 -namespace doris::vectorized { +namespace doris { class Arena; @@ -257,4 +257,4 @@ class ColumnArray final : public COWHelper { WrappedPtr offsets; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_complex.h b/be/src/core/column/column_complex.h similarity index 97% rename from be/src/vec/columns/column_complex.h rename to be/src/core/column/column_complex.h index a574f18e881d7c..18ee38321e0cae 100644 --- a/be/src/vec/columns/column_complex.h +++ b/be/src/core/column/column_complex.h @@ -24,16 +24,16 @@ #include -#include "olap/hll.h" -#include "runtime/primitive_type.h" -#include "vec/columns/column.h" -#include "vec/columns/column_string.h" -#include "vec/columns/column_vector.h" -#include "vec/columns/columns_common.h" -#include "vec/core/field.h" -#include "vec/core/types.h" +#include "core/column/column.h" +#include "core/column/column_string.h" +#include "core/column/column_vector.h" +#include "core/column/columns_common.h" +#include "core/data_type/primitive_type.h" +#include "core/field.h" +#include "core/types.h" +#include "core/value/hll.h" -namespace doris::vectorized { +namespace doris { template class ColumnComplexType final : public COWHelper> { @@ -377,4 +377,4 @@ struct is_complex : std::true_type {}; template constexpr bool is_complex_v = is_complex::value; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_const.cpp b/be/src/core/column/column_const.cpp similarity index 96% rename from be/src/vec/columns/column_const.cpp rename to be/src/core/column/column_const.cpp index 16f80f5baa2c7f..05c27638fee441 100644 --- a/be/src/vec/columns/column_const.cpp +++ b/be/src/core/column/column_const.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Columns/ColumnConst.cpp // and modified by Doris -#include "vec/columns/column_const.h" +#include "core/column/column_const.h" #include @@ -26,12 +26,12 @@ #include #include -#include "vec/columns/columns_common.h" -#include "vec/common/typeid_cast.h" -#include "vec/core/block.h" -#include "vec/core/column_with_type_and_name.h" +#include "core/block/block.h" +#include "core/block/column_with_type_and_name.h" +#include "core/column/columns_common.h" +#include "core/typeid_cast.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" ColumnPtr squash_const(const ColumnPtr& col) { @@ -165,4 +165,4 @@ void default_preprocess_parameter_columns(ColumnPtr* columns, const bool* col_co } } } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_const.h b/be/src/core/column/column_const.h similarity index 96% rename from be/src/vec/columns/column_const.h rename to be/src/core/column/column_const.h index 88bb2db9dc4354..c5675b8feb4029 100644 --- a/be/src/vec/columns/column_const.h +++ b/be/src/core/column/column_const.h @@ -32,21 +32,21 @@ #include #include -#include "vec/columns/column.h" -#include "vec/columns/column_nullable.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/common/cow.h" -#include "vec/common/string_ref.h" -#include "vec/common/typeid_cast.h" -#include "vec/core/column_numbers.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/block/column_numbers.h" +#include "core/column/column.h" +#include "core/column/column_nullable.h" +#include "core/cow.h" +#include "core/data_type/data_type.h" +#include "core/field.h" +#include "core/string_ref.h" +#include "core/typeid_cast.h" +#include "core/types.h" class SipHash; -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class Arena; @@ -339,5 +339,5 @@ const Type* check_and_get_column_with_const(const IColumn& column) { return check_and_get_column(column); } -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/columns/column_decimal.cpp b/be/src/core/column/column_decimal.cpp similarity index 96% rename from be/src/vec/columns/column_decimal.cpp rename to be/src/core/column/column_decimal.cpp index 95ddc29423d734..cfa4a7c1f9d027 100644 --- a/be/src/vec/columns/column_decimal.cpp +++ b/be/src/core/column/column_decimal.cpp @@ -18,31 +18,31 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/AggregateFunctions/ColumnDecimal.cpp // and modified by Doris -#include "vec/columns/column_decimal.h" +#include "core/column/column_decimal.h" #include #include #include -#include "olap/decimal12.h" -#include "runtime/decimalv2_value.h" +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/column/columns_common.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_decimal.h" +#include "core/decimal12.h" +#include "core/value/decimalv2_value.h" +#include "exec/common/int_exp.h" +#include "exec/common/sip_hash.h" +#include "exec/sort/sort_block.h" #include "util/hash_util.hpp" #include "util/simd/bits.h" -#include "vec/columns/columns_common.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/common/int_exp.h" -#include "vec/common/sip_hash.h" -#include "vec/common/unaligned.h" -#include "vec/core/sort_block.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_decimal.h" +#include "util/unaligned.h" template -bool decimal_less(T x, T y, doris::vectorized::UInt32 x_scale, doris::vectorized::UInt32 y_scale); +bool decimal_less(T x, T y, doris::UInt32 x_scale, doris::UInt32 y_scale); -namespace doris::vectorized { +namespace doris { template int ColumnDecimal::compare_at(size_t n, size_t m, const IColumn& rhs_, int) const { @@ -516,4 +516,4 @@ template class ColumnDecimal; template class ColumnDecimal; template class ColumnDecimal; template class ColumnDecimal; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_decimal.h b/be/src/core/column/column_decimal.h similarity index 97% rename from be/src/vec/columns/column_decimal.h rename to be/src/core/column/column_decimal.h index 4a4885790c499f..7896ac020f39d6 100644 --- a/be/src/vec/columns/column_decimal.h +++ b/be/src/core/column/column_decimal.h @@ -30,19 +30,19 @@ #include #include -#include "runtime/primitive_type.h" -#include "vec/columns/column.h" -#include "vec/common/assert_cast.h" -#include "vec/common/cow.h" -#include "vec/common/pod_array_fwd.h" -#include "vec/common/string_ref.h" -#include "vec/common/typeid_cast.h" -#include "vec/core/field.h" -#include "vec/core/types.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/cow.h" +#include "core/data_type/primitive_type.h" +#include "core/field.h" +#include "core/pod_array_fwd.h" +#include "core/string_ref.h" +#include "core/typeid_cast.h" +#include "core/types.h" class SipHash; -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class Arena; class ColumnSorter; @@ -306,5 +306,5 @@ using ColumnDecimal128V2 = ColumnDecimal; using ColumnDecimal128V3 = ColumnDecimal; using ColumnDecimal256 = ColumnDecimal; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/columns/column_dictionary.h b/be/src/core/column/column_dictionary.h similarity index 96% rename from be/src/vec/columns/column_dictionary.h rename to be/src/core/column/column_dictionary.h index 2659ec38a82f0e..f572326b56f754 100644 --- a/be/src/vec/columns/column_dictionary.h +++ b/be/src/core/column/column_dictionary.h @@ -21,14 +21,14 @@ #include -#include "vec/columns/column.h" -#include "vec/columns/column_string.h" -#include "vec/columns/predicate_column.h" -#include "vec/common/pod_array.h" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" - -namespace doris::vectorized { +#include "core/column/column.h" +#include "core/column/column_string.h" +#include "core/column/predicate_column.h" +#include "core/pod_array.h" +#include "core/string_ref.h" +#include "core/types.h" + +namespace doris { #include "common/compile_check_begin.h" /** @@ -155,7 +155,7 @@ class ColumnDictI32 final : public COWHelper { } Status filter_by_selector(const uint16_t* sel, size_t sel_size, IColumn* col_ptr) override { - auto* res_col = assert_cast(col_ptr); + auto* res_col = assert_cast(col_ptr); _strings.resize(sel_size); size_t length = 0; for (size_t i = 0; i != sel_size; ++i) { @@ -235,7 +235,7 @@ class ColumnDictI32 final : public COWHelper { uint32_t get_hash_value(uint32_t idx) const { return _dict.get_hash_value(_codes[idx], _type); } template - void find_codes(const HybridSetType* values, std::vector& selected) const { + void find_codes(const HybridSetType* values, std::vector& selected) const { return _dict.find_codes(values, selected); } @@ -261,9 +261,9 @@ class ColumnDictI32 final : public COWHelper { // because the string length will different from varchar and string which needed to be processed after. auto create_column = [this]() -> MutableColumnPtr { if (_type == FieldType::OLAP_FIELD_TYPE_CHAR) { - return vectorized::PredicateColumnType::create(); + return PredicateColumnType::create(); } - return vectorized::PredicateColumnType::create(); + return PredicateColumnType::create(); }; auto res = create_column(); @@ -382,8 +382,7 @@ class ColumnDictI32 final : public COWHelper { } template - void find_codes(const HybridSetType* values, - std::vector& selected) const { + void find_codes(const HybridSetType* values, std::vector& selected) const { size_t dict_word_num = _dict_data->size(); selected.resize(dict_word_num); selected.assign(dict_word_num, false); @@ -491,5 +490,5 @@ class ColumnDictI32 final : public COWHelper { std::vector _strings; }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/columns/column_dummy.h b/be/src/core/column/column_dummy.h similarity index 97% rename from be/src/vec/columns/column_dummy.h rename to be/src/core/column/column_dummy.h index 700ed09fbf4261..55f3d3e4e2285d 100644 --- a/be/src/vec/columns/column_dummy.h +++ b/be/src/core/column/column_dummy.h @@ -20,12 +20,12 @@ #pragma once -#include "vec/columns/column.h" -#include "vec/columns/columns_common.h" -#include "vec/common/arena.h" -#include "vec/common/pod_array.h" +#include "core/arena.h" +#include "core/column/column.h" +#include "core/column/columns_common.h" +#include "core/pod_array.h" -namespace doris::vectorized { +namespace doris { /** Base class for columns-constants that contain a value that is not in the `Field`. * Not a full-fledged column and is used in a special way. @@ -180,4 +180,4 @@ class IColumnDummy : public IColumn { size_t s; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_execute_util.h b/be/src/core/column/column_execute_util.h similarity index 90% rename from be/src/vec/columns/column_execute_util.h rename to be/src/core/column/column_execute_util.h index b7d2bf1f11cb52..d8f33782c48c1a 100644 --- a/be/src/vec/columns/column_execute_util.h +++ b/be/src/core/column/column_execute_util.h @@ -19,16 +19,16 @@ #include #include -#include "runtime/define_primitive_type.h" -#include "runtime/primitive_type.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_vector.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/core/field.h" +#include "core/block/column_with_type_and_name.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_nullable.h" +#include "core/column/column_vector.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/field.h" -namespace doris::vectorized { +namespace doris { // Utility tools for convenient column execution @@ -98,4 +98,4 @@ struct ColumnView { size_t size() const { return count; } }; -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/columns/column_filter_helper.cpp b/be/src/core/column/column_filter_helper.cpp similarity index 84% rename from be/src/vec/columns/column_filter_helper.cpp rename to be/src/core/column/column_filter_helper.cpp index 8ef6a822640b47..c8b7146524aa9e 100644 --- a/be/src/vec/columns/column_filter_helper.cpp +++ b/be/src/core/column/column_filter_helper.cpp @@ -15,20 +15,20 @@ // specific language governing permissions and limitations // under the License. -#include "vec/columns/column_filter_helper.h" +#include "core/column/column_filter_helper.h" -namespace doris::vectorized { +namespace doris { ColumnFilterHelper::ColumnFilterHelper(IColumn& column_) : _column(assert_cast(column_)), _value_column(assert_cast(_column.get_nested_column())), _null_map_column(_column.get_null_map_column()) {} -void ColumnFilterHelper::resize_fill(size_t size, doris::vectorized::UInt8 value) { +void ColumnFilterHelper::resize_fill(size_t size, doris::UInt8 value) { _value_column.get_data().resize_fill(size, value); _null_map_column.get_data().resize_fill(size, 0); } -void ColumnFilterHelper::insert_value(doris::vectorized::UInt8 value) { +void ColumnFilterHelper::insert_value(doris::UInt8 value) { _value_column.get_data().push_back(value); _null_map_column.get_data().push_back(0); } @@ -38,4 +38,4 @@ void ColumnFilterHelper::reserve(size_t size) { _null_map_column.reserve(size); } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/columns/column_filter_helper.h b/be/src/core/column/column_filter_helper.h similarity index 92% rename from be/src/vec/columns/column_filter_helper.h rename to be/src/core/column/column_filter_helper.h index ff1cb781a241bc..c44b8ba01b91e1 100644 --- a/be/src/vec/columns/column_filter_helper.h +++ b/be/src/core/column/column_filter_helper.h @@ -17,9 +17,9 @@ #pragma once -#include "column_nullable.h" +#include "core/column/column_nullable.h" -namespace doris::vectorized { +namespace doris { class ColumnFilterHelper { public: ColumnFilterHelper(IColumn&); @@ -35,4 +35,4 @@ class ColumnFilterHelper { ColumnUInt8& _value_column; ColumnUInt8& _null_map_column; }; -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/columns/column_fixed_length_object.h b/be/src/core/column/column_fixed_length_object.h similarity index 96% rename from be/src/vec/columns/column_fixed_length_object.h rename to be/src/core/column/column_fixed_length_object.h index 8b207a96a07bbf..6de772984bb7d6 100644 --- a/be/src/vec/columns/column_fixed_length_object.h +++ b/be/src/core/column/column_fixed_length_object.h @@ -21,16 +21,16 @@ #include -#include "runtime/primitive_type.h" -#include "vec/columns/column.h" -#include "vec/columns/columns_common.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/common/memcmp_small.h" -#include "vec/common/pod_array.h" -#include "vec/common/sip_hash.h" +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/columns_common.h" +#include "core/data_type/primitive_type.h" +#include "core/memcmp_small.h" +#include "core/pod_array.h" +#include "exec/common/sip_hash.h" -namespace doris::vectorized { +namespace doris { class ColumnFixedLengthObject final : public COWHelper { private: @@ -301,4 +301,4 @@ class ColumnFixedLengthObject final : public COWHelper #include @@ -26,21 +26,21 @@ #include #include "common/status.h" +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_nullable.h" +#include "core/custom_allocator.h" +#include "core/data_type/primitive_type.h" +#include "core/string_ref.h" +#include "exec/common/hash_table/phmap_fwd_decl.h" +#include "exec/sort/sort_block.h" #include "pdqsort.h" -#include "runtime/primitive_type.h" -#include "vec/columns/column.h" -#include "vec/columns/column_nullable.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/common/custom_allocator.h" -#include "vec/common/hash_table/phmap_fwd_decl.h" -#include "vec/common/string_ref.h" -#include "vec/common/unaligned.h" -#include "vec/core/sort_block.h" +#include "util/unaligned.h" class SipHash; -namespace doris::vectorized { +namespace doris { /** A column of map values. */ @@ -794,4 +794,4 @@ void ColumnMap::replace_float_special_values() { values_column->replace_float_special_values(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_map.h b/be/src/core/column/column_map.h similarity index 95% rename from be/src/vec/columns/column_map.h rename to be/src/core/column/column_map.h index 6dd9abf24919f7..e76c957a27f81a 100644 --- a/be/src/vec/columns/column_map.h +++ b/be/src/core/column/column_map.h @@ -32,21 +32,21 @@ #include "common/compiler_util.h" // IWYU pragma: keep #include "common/status.h" -#include "vec/columns/column.h" -#include "vec/columns/column_array.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_struct.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/common/cow.h" -#include "vec/common/sip_hash.h" -#include "vec/common/string_ref.h" -#include "vec/core/field.h" -#include "vec/core/types.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_array.h" +#include "core/column/column_nullable.h" +#include "core/column/column_struct.h" +#include "core/column/column_vector.h" +#include "core/cow.h" +#include "core/field.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "exec/common/sip_hash.h" class SipHash; -namespace doris::vectorized { +namespace doris { class Arena; /** A column of map values. @@ -249,4 +249,4 @@ class ColumnMap final : public COWHelper { ColumnMap(const ColumnMap&) = default; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_nothing.h b/be/src/core/column/column_nothing.h similarity index 94% rename from be/src/vec/columns/column_nothing.h rename to be/src/core/column/column_nothing.h index 90721da0a0e7d7..da4bfefa45f769 100644 --- a/be/src/vec/columns/column_nothing.h +++ b/be/src/core/column/column_nothing.h @@ -20,9 +20,9 @@ #pragma once -#include "vec/columns/column_dummy.h" +#include "core/column/column_dummy.h" -namespace doris::vectorized { +namespace doris { class ColumnNothing final : public COWHelper { private: @@ -48,4 +48,4 @@ class ColumnNothing final : public COWHelper { } }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_nullable.cpp b/be/src/core/column/column_nullable.cpp similarity index 98% rename from be/src/vec/columns/column_nullable.cpp rename to be/src/core/column/column_nullable.cpp index b634e2b1c6dce7..0b852faf4ce6c4 100644 --- a/be/src/vec/columns/column_nullable.cpp +++ b/be/src/core/column/column_nullable.cpp @@ -18,16 +18,16 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Columns/ColumnNullable.cpp // and modified by Doris -#include "vec/columns/column_nullable.h" +#include "core/column/column_nullable.h" -#include "vec/columns/column_const.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/common/sip_hash.h" -#include "vec/core/sort_block.h" -#include "vec/data_types/data_type.h" +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/column/column_const.h" +#include "core/data_type/data_type.h" +#include "exec/common/sip_hash.h" +#include "exec/sort/sort_block.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" ColumnNullable::ColumnNullable(MutableColumnPtr&& nested_column_, MutableColumnPtr&& null_map_) @@ -307,8 +307,8 @@ void ColumnNullable::deserialize_vec(StringRef* keys, const size_t num_rows) { } } -void ColumnNullable::insert_range_from_ignore_overflow(const doris::vectorized::IColumn& src, - size_t start, size_t length) { +void ColumnNullable::insert_range_from_ignore_overflow(const doris::IColumn& src, size_t start, + size_t length) { const auto& nullable_col = assert_cast(src); get_null_map_column().insert_range_from(nullable_col.get_null_map_column(), start, length); get_nested_column().insert_range_from_ignore_overflow(*nullable_col._nested_column, start, @@ -670,4 +670,4 @@ ColumnPtr remove_nullable(const ColumnPtr& column) { return column; } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_nullable.h b/be/src/core/column/column_nullable.h similarity index 97% rename from be/src/vec/columns/column_nullable.h rename to be/src/core/column/column_nullable.h index f06bcf3151095f..93e16cf74ca33f 100644 --- a/be/src/vec/columns/column_nullable.h +++ b/be/src/core/column/column_nullable.h @@ -22,20 +22,20 @@ #include "common/compiler_util.h" // IWYU pragma: keep #include "common/status.h" -#include "olap/olap_common.h" -#include "runtime/define_primitive_type.h" -#include "vec/columns/column.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/common/cow.h" -#include "vec/common/string_ref.h" -#include "vec/common/typeid_cast.h" -#include "vec/core/field.h" -#include "vec/core/types.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_vector.h" +#include "core/cow.h" +#include "core/data_type/define_primitive_type.h" +#include "core/field.h" +#include "core/string_ref.h" +#include "core/typeid_cast.h" +#include "core/types.h" +#include "storage/olap_common.h" class SipHash; -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class Arena; class ColumnSorter; @@ -406,5 +406,5 @@ class ColumnNullable final : public COWHelper { ColumnPtr make_nullable(const ColumnPtr& column, bool is_nullable = false); ColumnPtr remove_nullable(const ColumnPtr& column); -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/columns/column_string.cpp b/be/src/core/column/column_string.cpp similarity index 98% rename from be/src/vec/columns/column_string.cpp rename to be/src/core/column/column_string.cpp index 5d48c5f39c1739..b36a502d9f5dd0 100644 --- a/be/src/vec/columns/column_string.cpp +++ b/be/src/core/column/column_string.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Columns/ColumnStr.cpp // and modified by Doris -#include "vec/columns/column_string.h" +#include "core/column/column_string.h" #include @@ -26,17 +26,17 @@ #include #include -#include "runtime/primitive_type.h" +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/column/columns_common.h" +#include "core/data_type/primitive_type.h" +#include "core/memcmp_small.h" +#include "exec/sort/sort_block.h" #include "util/memcpy_inlined.h" #include "util/simd/bits.h" #include "util/simd/vstring_function.h" -#include "vec/columns/columns_common.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/common/memcmp_small.h" -#include "vec/common/unaligned.h" -#include "vec/core/sort_block.h" -namespace doris::vectorized { +#include "util/unaligned.h" +namespace doris { #include "common/compile_check_begin.h" template @@ -112,8 +112,8 @@ void ColumnStr::shrink_padding_chars() { // will be converted to ColumnStr if the total string length // exceeds the 4G limit by calling Block::replace_if_overflow. template -void ColumnStr::insert_range_from_ignore_overflow(const doris::vectorized::IColumn& src, - size_t start, size_t length) { +void ColumnStr::insert_range_from_ignore_overflow(const doris::IColumn& src, size_t start, + size_t length) { if (length == 0) { return; } @@ -719,4 +719,4 @@ bool ColumnStr::is_ascii() const { template class ColumnStr; template class ColumnStr; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_string.h b/be/src/core/column/column_string.h similarity index 97% rename from be/src/vec/columns/column_string.h rename to be/src/core/column/column_string.h index 3f012515b01a4a..dde69883344d70 100644 --- a/be/src/vec/columns/column_string.h +++ b/be/src/core/column/column_string.h @@ -33,20 +33,20 @@ #include "common/compiler_util.h" // IWYU pragma: keep #include "common/exception.h" #include "common/status.h" -#include "runtime/define_primitive_type.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/cow.h" +#include "core/data_type/define_primitive_type.h" +#include "core/field.h" +#include "core/memcmp_small.h" +#include "core/memcpy_small.h" +#include "core/pod_array_fwd.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "exec/common/sip_hash.h" #include "util/hash_util.hpp" -#include "vec/columns/column.h" -#include "vec/common/assert_cast.h" -#include "vec/common/cow.h" -#include "vec/common/memcmp_small.h" -#include "vec/common/memcpy_small.h" -#include "vec/common/pod_array_fwd.h" -#include "vec/common/sip_hash.h" -#include "vec/common/string_ref.h" -#include "vec/core/field.h" -#include "vec/core/types.h" - -namespace doris::vectorized { + +namespace doris { #include "common/compile_check_begin.h" class Arena; class ColumnSorter; @@ -548,5 +548,5 @@ class ColumnStr final : public COWHelper> { using ColumnString = ColumnStr; using ColumnString64 = ColumnStr; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/columns/column_struct.cpp b/be/src/core/column/column_struct.cpp similarity index 98% rename from be/src/vec/columns/column_struct.cpp rename to be/src/core/column/column_struct.cpp index e25f93051da140..902a238488f338 100644 --- a/be/src/vec/columns/column_struct.cpp +++ b/be/src/core/column/column_struct.cpp @@ -18,24 +18,22 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Columns/ColumnStruct.cpp // and modified by Doris -#include "vec/columns/column_struct.h" +#include "core/column/column_struct.h" #include +#include "core/assert_cast.h" +#include "core/data_type/primitive_type.h" +#include "core/typeid_cast.h" +#include "exec/sort/sort_block.h" #include "pdqsort.h" -#include "runtime/primitive_type.h" -#include "vec/common/assert_cast.h" -#include "vec/common/typeid_cast.h" -#include "vec/core/sort_block.h" class SipHash; namespace doris { -namespace vectorized { class Arena; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { std::string ColumnStruct::get_name() const { std::stringstream res; @@ -479,4 +477,4 @@ void ColumnStruct::replace_float_special_values() { } } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_struct.h b/be/src/core/column/column_struct.h similarity index 96% rename from be/src/vec/columns/column_struct.h rename to be/src/core/column/column_struct.h index b0817cb1a34954..7d6982dbf65ba6 100644 --- a/be/src/vec/columns/column_struct.h +++ b/be/src/core/column/column_struct.h @@ -32,17 +32,17 @@ #include #include "common/status.h" -#include "vec/columns/column.h" -#include "vec/common/assert_cast.h" -#include "vec/common/cow.h" -#include "vec/common/sip_hash.h" -#include "vec/common/string_ref.h" -#include "vec/core/field.h" -#include "vec/core/types.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/cow.h" +#include "core/field.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "exec/common/sip_hash.h" class SipHash; -namespace doris::vectorized { +namespace doris { class Arena; /** Column, that is just group of few another columns. @@ -205,4 +205,4 @@ class ColumnStruct final : public COWHelper { struct less; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_varbinary.cpp b/be/src/core/column/column_varbinary.cpp similarity index 93% rename from be/src/vec/columns/column_varbinary.cpp rename to be/src/core/column/column_varbinary.cpp index 037f96fd5c6c88..9dc9eb361de191 100644 --- a/be/src/vec/columns/column_varbinary.cpp +++ b/be/src/core/column/column_varbinary.cpp @@ -15,22 +15,22 @@ // specific language governing permissions and limitations // under the License. -#include "vec/columns/column_varbinary.h" +#include "core/column/column_varbinary.h" #include #include #include -#include "runtime/primitive_type.h" -#include "vec/columns/column.h" -#include "vec/columns/column_string.h" -#include "vec/columns/columns_common.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/core/sort_block.h" +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_string.h" +#include "core/column/columns_common.h" +#include "core/data_type/primitive_type.h" +#include "exec/sort/sort_block.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" MutableColumnPtr ColumnVarbinary::clone_resized(size_t size) const { auto res = create(); @@ -84,9 +84,9 @@ ColumnPtr ColumnVarbinary::filter(const IColumn::Filter& filt, ssize_t result_si column_match_filter_size(size, filt.size()); if (_data.size() == 0) { - return doris::vectorized::ColumnVarbinary::create(); + return doris::ColumnVarbinary::create(); } - auto res = doris::vectorized::ColumnVarbinary::create(); + auto res = doris::ColumnVarbinary::create(); Container& res_data = res->get_data(); if (result_size_hint) { @@ -137,7 +137,7 @@ MutableColumnPtr ColumnVarbinary::permute(const IColumn::Permutation& perm, size __builtin_unreachable(); } - auto res = doris::vectorized::ColumnVarbinary::create(limit); + auto res = doris::ColumnVarbinary::create(limit); typename Self::Container& res_data = res->get_data(); for (size_t i = 0; i < limit; ++i) { auto val = _data[perm[i]]; @@ -231,4 +231,4 @@ void ColumnVarbinary::sort_column(const ColumnSorter* sorter, EqualFlags& flags, } #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_varbinary.h b/be/src/core/column/column_varbinary.h similarity index 96% rename from be/src/vec/columns/column_varbinary.h rename to be/src/core/column/column_varbinary.h index 48c5fcf2563428..3877b7b56106c8 100644 --- a/be/src/vec/columns/column_varbinary.h +++ b/be/src/core/column/column_varbinary.h @@ -22,14 +22,14 @@ #include -#include "runtime/define_primitive_type.h" -#include "runtime/primitive_type.h" -#include "vec/columns/column.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_view.h" - -namespace doris::vectorized { +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/string_view.h" + +namespace doris { #include "common/compile_check_begin.h" class ColumnVarbinary final : public COWHelper { private: @@ -193,4 +193,4 @@ class ColumnVarbinary final : public COWHelper { Arena _arena; }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_variant.cpp b/be/src/core/column/column_variant.cpp similarity index 98% rename from be/src/vec/columns/column_variant.cpp rename to be/src/core/column/column_variant.cpp index 5591c49c37f117..9dafa0c5230473 100644 --- a/be/src/vec/columns/column_variant.cpp +++ b/be/src/core/column/column_variant.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Columns/ColumnVariant.cpp // and modified by Doris -#include "vec/columns/column_variant.h" +#include "core/column/column_variant.h" #include #include @@ -44,38 +44,38 @@ #include "common/exception.h" #include "common/logging.h" #include "common/status.h" +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/block/column_with_type_and_name.h" +#include "core/column/column.h" +#include "core/column/column_array.h" +#include "core/column/column_string.h" +#include "core/column/column_vector.h" +#include "core/data_type/convert_field_to_type.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_decimal.h" +#include "core/data_type/data_type_factory.hpp" +#include "core/data_type/data_type_nothing.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/get_least_supertype.h" +#include "core/data_type/primitive_type.h" +#include "core/field.h" +#include "core/string_buffer.hpp" +#include "core/types.h" +#include "core/value/jsonb_value.h" +#include "exec/common/field_visitors.h" +#include "exec/common/variant_util.h" +#include "exprs/aggregate/aggregate_function.h" #include "exprs/json_functions.h" -#include "olap/olap_common.h" -#include "runtime/define_primitive_type.h" -#include "runtime/jsonb_value.h" -#include "runtime/primitive_type.h" +#include "storage/olap_common.h" #include "util/defer_op.h" +#include "util/json/path_in_data.h" #include "util/jsonb_parser_simd.h" #include "util/jsonb_utils.h" #include "util/simd/bits.h" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/columns/column.h" -#include "vec/columns/column_array.h" -#include "vec/columns/column_string.h" -#include "vec/columns/column_vector.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/common/field_visitors.h" -#include "vec/common/string_buffer.hpp" -#include "vec/common/unaligned.h" -#include "vec/common/variant_util.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/convert_field_to_type.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/data_types/data_type_factory.hpp" -#include "vec/data_types/data_type_nothing.h" -#include "vec/data_types/get_least_supertype.h" -#include "vec/json/path_in_data.h" - -namespace doris::vectorized { +#include "util/unaligned.h" + +namespace doris { namespace { #include "common/compile_check_begin.h" @@ -657,7 +657,7 @@ void ColumnVariant::Subcolumn::remove_nullable() { if (!is_finalized()) { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "Subcolumn is not finalized"); } - data[0] = doris::vectorized::remove_nullable(data[0]); + data[0] = doris::remove_nullable(data[0]); least_common_type.remove_nullable(); } @@ -1481,7 +1481,7 @@ bool ColumnVariant::is_finalized() const { void ColumnVariant::Subcolumn::wrapp_array_nullable() { // Wrap array with nullable, treat empty array as null to elimate conflict at present auto& result_column = get_finalized_column_ptr(); - if (is_column(result_column.get()) && !result_column->is_nullable()) { + if (is_column(result_column.get()) && !result_column->is_nullable()) { auto new_null_map = ColumnUInt8::create(); new_null_map->reserve(result_column->size()); auto& null_map_data = new_null_map->get_data(); @@ -1945,13 +1945,13 @@ Status ColumnVariant::convert_typed_path_to_storage_type( for (auto&& entry : subcolumns) { if (auto it = typed_paths.find(entry->path.get_path()); it != typed_paths.end()) { CHECK(entry->data.is_finalized()); - vectorized::DataTypePtr storage_type = - vectorized::DataTypeFactory::instance().create_data_type(it->second.column); - vectorized::DataTypePtr finalized_type = entry->data.get_least_common_type(); + DataTypePtr storage_type = + DataTypeFactory::instance().create_data_type(it->second.column); + DataTypePtr finalized_type = entry->data.get_least_common_type(); auto current_column = entry->data.get_finalized_column_ptr()->get_ptr(); if (!storage_type->equals(*finalized_type)) { - RETURN_IF_ERROR(vectorized::variant_util::cast_column( - {current_column, finalized_type, ""}, storage_type, ¤t_column)); + RETURN_IF_ERROR(variant_util::cast_column({current_column, finalized_type, ""}, + storage_type, ¤t_column)); } VLOG_DEBUG << "convert " << entry->path.get_path() << " from type" << entry->data.get_least_common_type()->get_name() << " to " @@ -2252,13 +2252,12 @@ bool NO_SANITIZE_UNDEFINED ColumnVariant::is_scalar_variant() const { doc_value_offsets[num_rows - 1] == 0; // no sparse data } -const DataTypePtr ColumnVariant::NESTED_TYPE = std::make_shared( - std::make_shared(std::make_shared( - std::make_shared(0)))); +const DataTypePtr ColumnVariant::NESTED_TYPE = + std::make_shared(std::make_shared( + std::make_shared(std::make_shared(0)))); -const DataTypePtr ColumnVariant::NESTED_TYPE_AS_ARRAY_OF_JSONB = - std::make_shared(std::make_shared( - std::make_shared())); +const DataTypePtr ColumnVariant::NESTED_TYPE_AS_ARRAY_OF_JSONB = std::make_shared( + std::make_shared(std::make_shared())); DataTypePtr ColumnVariant::get_root_type() const { return subcolumns.get_root()->data.get_least_common_type(); @@ -2670,4 +2669,4 @@ bool ColumnVariant::is_doc_mode() const { #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_variant.h b/be/src/core/column/column_variant.h similarity index 95% rename from be/src/vec/columns/column_variant.h rename to be/src/core/column/column_variant.h index 7d8c5719418b66..2c3c427454e6c4 100644 --- a/be/src/vec/columns/column_variant.h +++ b/be/src/core/column/column_variant.h @@ -35,34 +35,32 @@ #include #include "common/status.h" -#include "olap/tablet_schema.h" -#include "vec/columns/column.h" -#include "vec/columns/column_map.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_vector.h" -#include "vec/columns/subcolumn_tree.h" -#include "vec/common/cow.h" -#include "vec/common/string_ref.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_array.h" -#include "vec/data_types/data_type_jsonb.h" -#include "vec/data_types/data_type_map.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/data_types/data_type_variant.h" -#include "vec/data_types/serde/data_type_serde.h" -#include "vec/json/path_in_data.h" +#include "core/column/column.h" +#include "core/column/column_map.h" +#include "core/column/column_nullable.h" +#include "core/column/column_vector.h" +#include "core/column/subcolumn_tree.h" +#include "core/cow.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type/data_type_jsonb.h" +#include "core/data_type/data_type_map.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/data_type_variant.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/field.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "storage/tablet/tablet_schema.h" +#include "util/json/path_in_data.h" class SipHash; namespace doris { -namespace vectorized { class Arena; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { #ifdef NDEBUG #define ENABLE_CHECK_CONSISTENCY (void)/* Nothing */ @@ -228,7 +226,7 @@ class ColumnVariant final : public COWHelper { size_t get_dimensions() const { return num_dimensions; } - void remove_nullable() { type = doris::vectorized::remove_nullable(type); } + void remove_nullable() { type = doris::remove_nullable(type); } const DataTypeSerDeSPtr& get_serde() const { return least_common_type_serder; } @@ -406,9 +404,8 @@ class ColumnVariant final : public COWHelper { // use sparse_subcolumns_schema to record sparse column's path info and type static MutableColumnPtr create_binary_column_fn() { - return vectorized::ColumnMap::create(vectorized::ColumnString::create(), - vectorized::ColumnString::create(), - vectorized::ColumnArray::ColumnOffsets::create()); + return ColumnMap::create(ColumnString::create(), ColumnString::create(), + ColumnArray::ColumnOffsets::create()); } static const DataTypePtr& get_binary_column_type() { @@ -673,4 +670,4 @@ class ColumnVariant final : public COWHelper { bool is_visible_root_value(size_t nrow) const; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_vector.cpp b/be/src/core/column/column_vector.cpp similarity index 97% rename from be/src/vec/columns/column_vector.cpp rename to be/src/core/column/column_vector.cpp index 8316aa4c7907da..b1b87f7883f81b 100644 --- a/be/src/vec/columns/column_vector.cpp +++ b/be/src/core/column/column_vector.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Columns/ColumnVector.cpp // and modified by Doris -#include "vec/columns/column_vector.h" +#include "core/column/column_vector.h" #include #include @@ -28,21 +28,21 @@ #include #include -#include "runtime/define_primitive_type.h" +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/column/columns_common.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/memcpy_small.h" +#include "core/types.h" +#include "exec/common/nan_utils.h" +#include "exec/common/sip_hash.h" +#include "exec/sort/sort_block.h" #include "util/hash_util.hpp" #include "util/simd/bits.h" -#include "vec/columns/columns_common.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/common/memcpy_small.h" -#include "vec/common/nan_utils.h" -#include "vec/common/sip_hash.h" -#include "vec/common/unaligned.h" -#include "vec/core/sort_block.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" - -namespace doris::vectorized { +#include "util/unaligned.h" + +namespace doris { #include "common/compile_check_begin.h" template @@ -504,4 +504,4 @@ template class ColumnVector; template class ColumnVector; template class ColumnVector; template class ColumnVector; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/column_vector.h b/be/src/core/column/column_vector.h similarity index 96% rename from be/src/vec/columns/column_vector.h rename to be/src/core/column/column_vector.h index 707c8327875d45..a8013652fed2f5 100644 --- a/be/src/vec/columns/column_vector.h +++ b/be/src/core/column/column_vector.h @@ -37,32 +37,32 @@ #include "common/compare.h" #include "common/compiler_util.h" // IWYU pragma: keep #include "common/status.h" -#include "olap/uint24.h" -#include "runtime/define_primitive_type.h" -#include "runtime/primitive_type.h" -#include "vec/columns/column.h" -#include "vec/common/assert_cast.h" -#include "vec/common/cow.h" -#include "vec/common/pod_array_fwd.h" -#include "vec/common/string_ref.h" -#include "vec/common/unaligned.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/runtime/vdatetime_value.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/cow.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/field.h" +#include "core/pod_array_fwd.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "core/uint24.h" +#include "core/value/vdatetime_value.h" +#include "util/unaligned.h" class SipHash; -namespace doris::pipeline { +namespace doris { template struct ProcessHashTableProbe; } -namespace doris::vectorized { +namespace doris { class Arena; class ColumnSorter; -} // namespace doris::vectorized +} // namespace doris -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" /** A template for columns that use a simple array to store. @@ -78,7 +78,7 @@ class ColumnVector final : public COWHelper> { friend class COWHelper; template - friend struct doris::pipeline::ProcessHashTableProbe; + friend struct doris::ProcessHashTableProbe; struct less; struct greater; @@ -427,5 +427,5 @@ using ColumnTimeStampTz = ColumnVector; using ColumnOffset32 = ColumnVector; using ColumnOffset64 = ColumnVector; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/columns/columns_common.cpp b/be/src/core/column/columns_common.cpp similarity index 98% rename from be/src/vec/columns/columns_common.cpp rename to be/src/core/column/columns_common.cpp index 3bdfd8ac4e7b1c..bfaee36a8e0058 100644 --- a/be/src/vec/columns/columns_common.cpp +++ b/be/src/core/column/columns_common.cpp @@ -18,18 +18,18 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Columns/ColumnsCommon.cpp // and modified by Doris -#include "vec/columns/columns_common.h" +#include "core/column/columns_common.h" #include #include +#include "core/column/column.h" +#include "core/column/column_array.h" // IWYU pragma: keep #include "util/simd/bits.h" #include "util/sse_util.hpp" -#include "vec/columns/column.h" -#include "vec/columns/column_array.h" // IWYU pragma: keep -namespace doris::vectorized { +namespace doris { template class ColumnVector; @@ -396,4 +396,4 @@ INSTANTIATE(Decimal256, ColumnArray::Offset64) #undef INSTANTIATE -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/columns_common.h b/be/src/core/column/columns_common.h similarity index 94% rename from be/src/vec/columns/columns_common.h rename to be/src/core/column/columns_common.h index bbf7de19903d4b..6966d411daece2 100644 --- a/be/src/vec/columns/columns_common.h +++ b/be/src/core/column/columns_common.h @@ -30,14 +30,14 @@ #include "common/exception.h" #include "common/status.h" -#include "vec/columns/column.h" -#include "vec/common/pod_array_fwd.h" -#include "vec/common/typeid_cast.h" -#include "vec/core/types.h" +#include "core/column/column.h" +#include "core/pod_array_fwd.h" +#include "core/typeid_cast.h" +#include "core/types.h" /// Common helper methods for implementation of different columns. -namespace doris::vectorized { +namespace doris { /// Counts how many bytes of `filt` are greater than zero. size_t count_bytes_in_filter(const IColumn::Filter& filt); @@ -77,4 +77,4 @@ inline void column_match_filter_size(size_t size, size_t filter_size) { } } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/columns/predicate_column.h b/be/src/core/column/predicate_column.h similarity index 97% rename from be/src/vec/columns/predicate_column.h rename to be/src/core/column/predicate_column.h index 106e8fa9b2d577..fc46a830345256 100644 --- a/be/src/vec/columns/predicate_column.h +++ b/be/src/core/column/predicate_column.h @@ -19,19 +19,19 @@ #include -#include "olap/decimal12.h" -#include "olap/uint24.h" -#include "runtime/define_primitive_type.h" -#include "runtime/primitive_type.h" -#include "vec/columns/column.h" -#include "vec/columns/column_decimal.h" -#include "vec/columns/column_string.h" -#include "vec/columns/column_vector.h" -#include "vec/common/arena.h" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" - -namespace doris::vectorized { +#include "core/arena.h" +#include "core/column/column.h" +#include "core/column/column_decimal.h" +#include "core/column/column_string.h" +#include "core/column/column_vector.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/decimal12.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "core/uint24.h" + +namespace doris { #include "common/compile_check_begin.h" /** @@ -435,4 +435,4 @@ class PredicateColumnType final : public COWHelper +#include "core/arena.h" +#include "core/column/column.h" +#include "core/string_ref.h" #include "runtime/exec_env.h" #include "runtime/thread_context.h" -#include "vec/columns/column.h" -#include "vec/common/arena.h" -#include "vec/common/string_ref.h" -#include "vec/json/path_in_data.h" -namespace doris::vectorized { +#include "util/json/path_in_data.h" +namespace doris { // Tree that represents paths in document with additional data in nodes. // IsShared mean this object shared above multiple tasks, need swtich to subcolumns_tree_tracker template @@ -300,7 +300,7 @@ class SubcolumnsTree { Node* get_mutable_root() const { return root.get(); } static void get_leaves_of_node(const Node* node, std::vector& nodes, - vectorized::PathsInData& paths) { + PathsInData& paths) { if (node->is_scalar()) { nodes.push_back(node); paths.push_back(node->path); @@ -368,4 +368,4 @@ class SubcolumnsTree { Nodes leaves; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/cow.h b/be/src/core/cow.h similarity index 97% rename from be/src/vec/common/cow.h rename to be/src/core/cow.h index 9cfbc6c4799f37..620544774b15d4 100644 --- a/be/src/vec/common/cow.h +++ b/be/src/core/cow.h @@ -394,15 +394,12 @@ class COW { * * See example in "cow_columns.cpp". */ -namespace vectorized { class IColumn; class Field; -} // namespace vectorized template class COWHelper : public Base { public: - static_assert(std::is_base_of_v, - "COWHelper only use in IColumn"); + static_assert(std::is_base_of_v, "COWHelper only use in IColumn"); using Ptr = typename Base::template immutable_ptr; using MutablePtr = typename Base::template mutable_ptr; @@ -426,7 +423,7 @@ class COWHelper : public Base { const typename Base::Selector& selector) const override { this->template append_data_by_selector_impl(res, selector); } - void insert_duplicate_fields(const vectorized::Field& x, const size_t n) override { + void insert_duplicate_fields(const Field& x, const size_t n) override { this->template insert_impl(x, n); } @@ -436,7 +433,7 @@ class COWHelper : public Base { this->template append_data_by_selector_impl(res, selector, begin, end); } - void insert_from_multi_column(const std::vector& srcs, + void insert_from_multi_column(const std::vector& srcs, const std::vector& positions) override { this->template insert_from_multi_column_impl(srcs, positions); } diff --git a/be/src/vec/common/custom_allocator.h b/be/src/core/custom_allocator.h similarity index 98% rename from be/src/vec/common/custom_allocator.h rename to be/src/core/custom_allocator.h index b37af3e53c5cbe..bd3d8bda57e9fb 100644 --- a/be/src/vec/common/custom_allocator.h +++ b/be/src/core/custom_allocator.h @@ -20,8 +20,8 @@ #include #include -#include "vec/common/allocator.h" -#include "vec/common/allocator_fwd.h" +#include "core/allocator.h" +#include "core/allocator_fwd.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/vec/data_types/convert_field_to_type.cpp b/be/src/core/data_type/convert_field_to_type.cpp similarity index 98% rename from be/src/vec/data_types/convert_field_to_type.cpp rename to be/src/core/data_type/convert_field_to_type.cpp index fdbbb746610de8..bd1dd2ab2ef800 100644 --- a/be/src/vec/data_types/convert_field_to_type.cpp +++ b/be/src/core/data_type/convert_field_to_type.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Interpreters/convert_field_to_type.cpp // and modified by Doris -#include "vec/data_types/convert_field_to_type.h" +#include "core/data_type/convert_field_to_type.h" #include #include @@ -33,21 +33,21 @@ #include "common/cast_set.h" #include "common/exception.h" #include "common/status.h" -#include "util/bitmap_value.h" +#include "core/accurate_comparison.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type/data_type_nullable.h" +#include "core/field.h" +#include "core/typeid_cast.h" +#include "core/types.h" +#include "core/value/bitmap_value.h" +#include "exec/common/field_visitors.h" +#include "exprs/function/cast/cast_to_basic_number_common.h" +#include "exprs/function/cast/cast_to_boolean.h" #include "util/jsonb_document.h" #include "util/jsonb_writer.h" -#include "vec/common/field_visitors.h" -#include "vec/common/typeid_cast.h" -#include "vec/core/accurate_comparison.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_array.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/functions/cast/cast_to_basic_number_common.h" -#include "vec/functions/cast/cast_to_boolean.h" - -namespace doris::vectorized { + +namespace doris { #include "common/compile_check_begin.h" template /// Field template parameter may be const or non-const Field. @@ -830,4 +830,4 @@ void convert_field_to_type(const Field& from_value, const IDataType& to_type, Fi } } #include "common/compile_check_end.h" -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/data_types/convert_field_to_type.h b/be/src/core/data_type/convert_field_to_type.h similarity index 94% rename from be/src/vec/data_types/convert_field_to_type.h rename to be/src/core/data_type/convert_field_to_type.h index 07d48452a494b6..cd8c5469b1c0ff 100644 --- a/be/src/vec/data_types/convert_field_to_type.h +++ b/be/src/core/data_type/convert_field_to_type.h @@ -20,9 +20,9 @@ #pragma once #include "common/status.h" -#include "vec/core/field.h" +#include "core/field.h" -namespace doris::vectorized { +namespace doris { class IDataType; /** Used to interpret expressions in a set in IN, @@ -36,4 +36,4 @@ class IDataType; void convert_field_to_type(const Field& from_value, const IDataType& to_type, Field* field, const IDataType* from_type_hint = nullptr); -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type.cpp b/be/src/core/data_type/data_type.cpp similarity index 93% rename from be/src/vec/data_types/data_type.cpp rename to be/src/core/data_type/data_type.cpp index 0d39502407f31d..e4c93e38dbb231 100644 --- a/be/src/vec/data_types/data_type.cpp +++ b/be/src/core/data_type/data_type.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/IDataType.cpp // and modified by Doris -#include "vec/data_types/data_type.h" +#include "core/data_type/data_type.h" #include #include @@ -29,19 +29,17 @@ #include "common/logging.h" #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/core/field.h" -#include "vec/data_types/serde/data_type_serde.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/field.h" namespace doris { -namespace vectorized { class BufferWritable; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" IDataType::IDataType() = default; @@ -176,7 +174,7 @@ char* serialize_const_flag_and_row_num(const IColumn** column, char* buf, buf += sizeof(size_t); if (is_const_column) { - const auto& const_column = assert_cast(*col); + const auto& const_column = assert_cast(*col); *column = &(const_column.get_data_column()); } return buf; @@ -221,11 +219,11 @@ std::string IDataType::to_string(const IColumn& column, size_t row_num, #ifdef BE_TEST std::string IDataType::to_string(const IColumn& column, size_t row_num) const { - auto format_options = vectorized::DataTypeSerDe::get_default_format_options(); + auto format_options = DataTypeSerDe::get_default_format_options(); auto timezone = cctz::utc_time_zone(); format_options.timezone = &timezone; return to_string(column, row_num, format_options); } #endif -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type.h b/be/src/core/data_type/data_type.h similarity index 95% rename from be/src/vec/data_types/data_type.h rename to be/src/core/data_type/data_type.h index 70d181f4f26a4d..e013fa206c9906 100644 --- a/be/src/vec/data_types/data_type.h +++ b/be/src/core/data_type/data_type.h @@ -31,21 +31,20 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "runtime/primitive_type.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_nothing.h" -#include "vec/columns/column_string.h" -#include "vec/common/cow.h" -#include "vec/core/types.h" -#include "vec/data_types/serde/data_type_serde.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_nothing.h" +#include "core/column/column_string.h" +#include "core/cow.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/types.h" namespace doris { class PColumnMeta; enum PGenericType_TypeId : int; -namespace vectorized { #include "common/compile_check_begin.h" class IDataType; class IColumn; @@ -236,7 +235,6 @@ char* serialize_const_flag_and_row_num(const IColumn** column, char* buf, size_t* real_need_copy_num); const char* deserialize_const_flag_and_row_num(const char* buf, MutableColumnPtr* column, size_t* real_have_saved_num); -} // namespace vectorized #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/vec/data_types/data_type_agg_state.h b/be/src/core/data_type/data_type_agg_state.h similarity index 91% rename from be/src/vec/data_types/data_type_agg_state.h rename to be/src/core/data_type/data_type_agg_state.h index 9831c2599ce0b4..f1513c97c76a54 100644 --- a/be/src/vec/data_types/data_type_agg_state.h +++ b/be/src/core/data_type/data_type_agg_state.h @@ -22,18 +22,17 @@ #include "common/consts.h" #include "common/exception.h" #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "runtime/types.h" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/columns/column_fixed_length_object.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_factory.hpp" -#include "vec/data_types/data_type_fixed_length_object.h" -#include "vec/data_types/data_type_string.h" -#include "vec/data_types/serde/data_type_string_serde.h" - -namespace doris::vectorized { +#include "core/column/column_fixed_length_object.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_factory.hpp" +#include "core/data_type/data_type_fixed_length_object.h" +#include "core/data_type/data_type_string.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_string_serde.h" +#include "exprs/aggregate/aggregate_function.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" + +namespace doris { class DataTypeAggState : public DataTypeString { public: @@ -165,4 +164,4 @@ inline DataTypePtr get_serialized_type(const DataTypePtr& type) { } return type; } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_array.cpp b/be/src/core/data_type/data_type_array.cpp similarity index 94% rename from be/src/vec/data_types/data_type_array.cpp rename to be/src/core/data_type/data_type_array.cpp index b44b0f6f885968..851a98695b599a 100644 --- a/be/src/vec/data_types/data_type_array.cpp +++ b/be/src/core/data_type/data_type_array.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/DataTypeArray.h // and modified by Doris -#include "vec/data_types/data_type_array.h" +#include "core/data_type/data_type_array.h" #include #include @@ -29,20 +29,20 @@ #include #include "agent/be_exec_version_manager.h" -#include "runtime/decimalv2_value.h" -#include "runtime/define_primitive_type.h" -#include "util/types.h" -#include "vec/columns/column.h" -#include "vec/columns/column_array.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_nullable.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/common/string_ref.h" -#include "vec/common/typeid_cast.h" -#include "vec/data_types/data_type_nullable.h" - -namespace doris::vectorized { +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_array.h" +#include "core/column/column_const.h" +#include "core/column/column_nullable.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/define_primitive_type.h" +#include "core/packed_int128.h" +#include "core/string_buffer.hpp" +#include "core/string_ref.h" +#include "core/typeid_cast.h" +#include "core/value/decimalv2_value.h" + +namespace doris { namespace ErrorCodes { extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH; @@ -225,4 +225,4 @@ FieldWithDataType DataTypeArray::get_field_with_data_type(const IColumn& column, }; } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_array.h b/be/src/core/data_type/data_type_array.h similarity index 91% rename from be/src/vec/data_types/data_type_array.h rename to be/src/core/data_type/data_type_array.h index 40a2c07ba4439d..d17743cd958489 100644 --- a/be/src/vec/data_types/data_type_array.h +++ b/be/src/core/data_type/data_type_array.h @@ -28,24 +28,21 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "runtime/types.h" -#include "serde/data_type_array_serde.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_serde.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_array_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/field.h" +#include "core/types.h" namespace doris { class PColumnMeta; -namespace vectorized { class BufferWritable; class IColumn; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { class DataTypeArray final : public IDataType { private: @@ -115,4 +112,4 @@ class DataTypeArray final : public IDataType { #endif }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_bitmap.cpp b/be/src/core/data_type/data_type_bitmap.cpp similarity index 94% rename from be/src/vec/data_types/data_type_bitmap.cpp rename to be/src/core/data_type/data_type_bitmap.cpp index 496f8bedd99842..3831e22dda214c 100644 --- a/be/src/vec/data_types/data_type_bitmap.cpp +++ b/be/src/core/data_type/data_type_bitmap.cpp @@ -15,21 +15,21 @@ // specific language governing permissions and limitations // under the License. -#include "vec/data_types/data_type_bitmap.h" +#include "core/data_type/data_type_bitmap.h" #include #include "agent/be_exec_version_manager.h" -#include "util/bitmap_value.h" -#include "vec/columns/column.h" -#include "vec/columns/column_complex.h" -#include "vec/columns/column_const.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/common/string_ref.h" -#include "vec/io/io_helper.h" - -namespace doris::vectorized { +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_complex.h" +#include "core/column/column_const.h" +#include "core/string_buffer.hpp" +#include "core/string_ref.h" +#include "core/value/bitmap_value.h" +#include "util/io_helper.h" + +namespace doris { #include "common/compile_check_begin.h" // binary: const flag| row num | real saved num | size array | bitmap array // : bitmap1 size | bitmap2 size | ... @@ -173,4 +173,4 @@ void DataTypeBitMap::deserialize_as_stream(BitmapValue& value, BufferReadable& b buf.read_binary(ref); value.deserialize(ref.data); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_bitmap.h b/be/src/core/data_type/data_type_bitmap.h similarity index 89% rename from be/src/vec/data_types/data_type_bitmap.h rename to be/src/core/data_type/data_type_bitmap.h index a2811cef2e399b..66fd0a8a114fec 100644 --- a/be/src/vec/data_types/data_type_bitmap.h +++ b/be/src/core/data_type/data_type_bitmap.h @@ -26,17 +26,17 @@ #include #include -#include "runtime/define_primitive_type.h" -#include "serde/data_type_bitmap_serde.h" -#include "util/bitmap_value.h" -#include "vec/columns/column_complex.h" -#include "vec/columns/column_const.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_serde.h" - -namespace doris::vectorized { +#include "core/column/column_complex.h" +#include "core/column/column_const.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_bitmap_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/field.h" +#include "core/types.h" +#include "core/value/bitmap_value.h" + +namespace doris { class BufferReadable; class BufferWritable; class IColumn; @@ -93,4 +93,4 @@ class DataTypeBitMap : public IDataType { }; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_date.cpp b/be/src/core/data_type/data_type_date.cpp similarity index 73% rename from be/src/vec/data_types/data_type_date.cpp rename to be/src/core/data_type/data_type_date.cpp index 16fc2f601c3e8e..5feb16612c6274 100644 --- a/be/src/vec/data_types/data_type_date.cpp +++ b/be/src/core/data_type/data_type_date.cpp @@ -18,23 +18,23 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/DataTypeDate.cpp // and modified by Doris -#include "vec/data_types/data_type_date.h" +#include "core/data_type/data_type_date.h" #include #include -#include "util/binary_cast.hpp" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/io/io_helper.h" -#include "vec/runtime/vdatetime_value.h" +#include "core/assert_cast.h" +#include "core/binary_cast.hpp" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type.h" +#include "core/string_buffer.hpp" +#include "core/types.h" +#include "core/value/vdatetime_value.h" +#include "util/io_helper.h" -namespace doris::vectorized { +namespace doris { bool DataTypeDate::equals(const IDataType& rhs) const { return typeid(rhs) == typeid(*this); } @@ -47,4 +47,4 @@ MutableColumnPtr DataTypeDate::create_column() const { return DataTypeNumberBase::create_column(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_date.h b/be/src/core/data_type/data_type_date.h similarity index 90% rename from be/src/vec/data_types/data_type_date.h rename to be/src/core/data_type/data_type_date.h index d190a9c7bb0b53..74bb6ee72cea7d 100644 --- a/be/src/vec/data_types/data_type_date.h +++ b/be/src/core/data_type/data_type_date.h @@ -27,13 +27,13 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_number_base.h" -#include "vec/data_types/serde/data_type_date_or_datetime_serde.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_number_base.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_date_or_datetime_serde.h" +#include "core/types.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class BufferWritable; class IColumn; @@ -79,4 +79,4 @@ class DataTypeDate final : public DataTypeNumberBase { } }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_date_or_datetime_v2.cpp b/be/src/core/data_type/data_type_date_or_datetime_v2.cpp similarity index 93% rename from be/src/vec/data_types/data_type_date_or_datetime_v2.cpp rename to be/src/core/data_type/data_type_date_or_datetime_v2.cpp index b3465b8576226b..4650d2d57e55a5 100644 --- a/be/src/vec/data_types/data_type_date_or_datetime_v2.cpp +++ b/be/src/core/data_type/data_type_date_or_datetime_v2.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/data_types/data_type_date_or_datetime_v2.h" +#include "core/data_type/data_type_date_or_datetime_v2.h" #include @@ -25,21 +25,19 @@ #include #include -#include "util/binary_cast.hpp" -#include "vec/columns/column_const.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/core/types.h" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/io/io_helper.h" -#include "vec/runtime/vdatetime_value.h" +#include "core/assert_cast.h" +#include "core/binary_cast.hpp" +#include "core/column/column_const.h" +#include "core/column/column_vector.h" +#include "core/string_buffer.hpp" +#include "core/types.h" +#include "core/value/vdatetime_value.h" +#include "exprs/function/cast/cast_to_string.h" +#include "util/io_helper.h" namespace doris { #include "common/compile_check_begin.h" -namespace vectorized { class IColumn; -} // namespace vectorized } // namespace doris // FIXME: This file contains widespread UB due to unsafe type-punning casts. @@ -51,7 +49,7 @@ class IColumn; #pragma GCC diagnostic ignored "-Wcast-user-defined" #endif -namespace doris::vectorized { +namespace doris { bool DataTypeDateV2::equals(const IDataType& rhs) const { return typeid(rhs) == typeid(*this); } @@ -164,7 +162,7 @@ DataTypePtr create_datetimev2(UInt64 scale_value) { return std::make_shared(scale_value); } -} // namespace doris::vectorized +} // namespace doris #if defined(__GNUC__) && (__GNUC__ >= 15) #pragma GCC diagnostic pop diff --git a/be/src/vec/data_types/data_type_date_or_datetime_v2.h b/be/src/core/data_type/data_type_date_or_datetime_v2.h similarity index 94% rename from be/src/vec/data_types/data_type_date_or_datetime_v2.h rename to be/src/core/data_type/data_type_date_or_datetime_v2.h index a2e652f9243329..9029dd318000b9 100644 --- a/be/src/vec/data_types/data_type_date_or_datetime_v2.h +++ b/be/src/core/data_type/data_type_date_or_datetime_v2.h @@ -29,24 +29,22 @@ #include "common/compiler_util.h" // IWYU pragma: keep #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_number_base.h" -#include "vec/data_types/serde/data_type_datetimev2_serde.h" -#include "vec/data_types/serde/data_type_datev2_serde.h" -#include "vec/data_types/serde/data_type_serde.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_number_base.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_datetimev2_serde.h" +#include "core/data_type_serde/data_type_datev2_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/types.h" namespace doris { class PColumnMeta; -namespace vectorized { class BufferWritable; class IColumn; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" /** * Use UInt32 as underlying type to represent DateV2 type. @@ -191,4 +189,4 @@ constexpr bool IsDataTypeDateTimeV2 = false; template <> inline constexpr bool IsDataTypeDateTimeV2 = true; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_date_time.cpp b/be/src/core/data_type/data_type_date_time.cpp similarity index 72% rename from be/src/vec/data_types/data_type_date_time.cpp rename to be/src/core/data_type/data_type_date_time.cpp index f23cf0ae80750c..df7aab459dc8db 100644 --- a/be/src/vec/data_types/data_type_date_time.cpp +++ b/be/src/core/data_type/data_type_date_time.cpp @@ -18,24 +18,24 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/DataTypeDateTime.cpp // and modified by Doris -#include "vec/data_types/data_type_date_time.h" +#include "core/data_type/data_type_date_time.h" #include #include -#include "util/binary_cast.hpp" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/io/io_helper.h" -#include "vec/runtime/vdatetime_value.h" +#include "core/assert_cast.h" +#include "core/binary_cast.hpp" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type.h" +#include "core/string_buffer.hpp" +#include "core/types.h" +#include "core/value/vdatetime_value.h" +#include "exprs/function/cast/cast_to_string.h" +#include "util/io_helper.h" -namespace doris::vectorized { +namespace doris { bool DataTypeDateTime::equals(const IDataType& rhs) const { return typeid(rhs) == typeid(*this); @@ -49,4 +49,4 @@ MutableColumnPtr DataTypeDateTime::create_column() const { return DataTypeNumberBase::create_column(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_date_time.h b/be/src/core/data_type/data_type_date_time.h similarity index 94% rename from be/src/vec/data_types/data_type_date_time.h rename to be/src/core/data_type/data_type_date_time.h index 30dd32b7b1123e..cca241f0cbf456 100644 --- a/be/src/vec/data_types/data_type_date_time.h +++ b/be/src/core/data_type/data_type_date_time.h @@ -27,14 +27,14 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "runtime/primitive_type.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_number_base.h" -#include "vec/data_types/serde/data_type_date_or_datetime_serde.h" - -namespace doris::vectorized { +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_number_base.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/data_type_serde/data_type_date_or_datetime_serde.h" +#include "core/types.h" + +namespace doris { class BufferWritable; class IColumn; class DataTypeDate; @@ -146,4 +146,4 @@ constexpr bool IsDatelikeTypes = IsDatelikeV1Types || IsDatelikeV2Types || IsTimeV2Type; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_decimal.cpp b/be/src/core/data_type/data_type_decimal.cpp similarity index 95% rename from be/src/vec/data_types/data_type_decimal.cpp rename to be/src/core/data_type/data_type_decimal.cpp index 2f240b01a34955..a9eb2a9148dcea 100644 --- a/be/src/vec/data_types/data_type_decimal.cpp +++ b/be/src/core/data_type/data_type_decimal.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/DataTypesDecimal.cpp // and modified by Doris -#include "vec/data_types/data_type_decimal.h" +#include "core/data_type/data_type_decimal.h" #include #include @@ -31,25 +31,25 @@ #include "agent/be_exec_version_manager.h" #include "common/cast_set.h" -#include "runtime/decimalv2_value.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type/data_type_factory.hpp" +#include "core/data_type/data_type_map.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/data_type_struct.h" +#include "core/string_buffer.hpp" +#include "core/typeid_cast.h" +#include "core/types.h" +#include "core/value/decimalv2_value.h" +#include "exec/common/int_exp.h" +#include "exprs/function/cast/cast_to_string.h" +#include "util/io_helper.h" #include "util/string_parser.hpp" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/common/assert_cast.h" -#include "vec/common/int_exp.h" -#include "vec/common/string_buffer.hpp" -#include "vec/common/typeid_cast.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_array.h" -#include "vec/data_types/data_type_factory.hpp" -#include "vec/data_types/data_type_map.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/data_types/data_type_struct.h" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/io/io_helper.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" DataTypePtr get_data_type_with_default_argument(DataTypePtr type) { @@ -340,4 +340,4 @@ template class DataTypeDecimal; template class DataTypeDecimal; template class DataTypeDecimal; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_decimal.h b/be/src/core/data_type/data_type_decimal.h similarity index 96% rename from be/src/vec/data_types/data_type_decimal.h rename to be/src/core/data_type/data_type_decimal.h index da34beb754e669..5d75d4e26721ed 100644 --- a/be/src/vec/data_types/data_type_decimal.h +++ b/be/src/core/data_type/data_type_decimal.h @@ -34,32 +34,29 @@ #include "common/consts.h" #include "common/logging.h" #include "common/status.h" -#include "olap/olap_common.h" -#include "runtime/primitive_type.h" -#include "runtime/type_limit.h" -#include "runtime/types.h" -#include "serde/data_type_decimal_serde.h" -#include "util/binary_cast.hpp" -#include "vec/columns/column_decimal.h" -#include "vec/common/arithmetic_overflow.h" -#include "vec/common/typeid_cast.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_number.h" // IWYU pragma: keep -#include "vec/data_types/serde/data_type_serde.h" +#include "core/binary_cast.hpp" +#include "core/column/column_decimal.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_number.h" // IWYU pragma: keep +#include "core/data_type/primitive_type.h" +#include "core/data_type_serde/data_type_decimal_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/field.h" +#include "core/type_limit.h" +#include "core/typeid_cast.h" +#include "core/types.h" +#include "exec/common/arithmetic_overflow.h" +#include "storage/olap_common.h" namespace doris { class DecimalV2Value; class PColumnMeta; -namespace vectorized { class BufferWritable; class IColumn; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" template @@ -485,4 +482,4 @@ typename PrimitiveTypeTraits::CppType min_decimal_value(UInt32 precision) { (UInt32)(max_decimal_precision() - precision))); } #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_factory.cpp b/be/src/core/data_type/data_type_factory.cpp similarity index 76% rename from be/src/vec/data_types/data_type_factory.cpp rename to be/src/core/data_type/data_type_factory.cpp index 5849781a2e5846..6cbec46ae30a1b 100644 --- a/be/src/vec/data_types/data_type_factory.cpp +++ b/be/src/core/data_type/data_type_factory.cpp @@ -18,11 +18,12 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/DataTypeFactory.cpp // and modified by Doris -#include "vec/data_types/data_type_factory.hpp" +#include "core/data_type/data_type_factory.hpp" #include #include #include +#include #include #include #include @@ -36,41 +37,40 @@ #include "common/consts.h" #include "common/exception.h" #include "common/status.h" -#include "data_type_time.h" -#include "gen_cpp/segment_v2.pb.h" -#include "olap/field.h" -#include "olap/olap_common.h" -#include "runtime/define_primitive_type.h" -#include "vec/common/assert_cast.h" -#include "vec/common/uint128.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_agg_state.h" -#include "vec/data_types/data_type_array.h" -#include "vec/data_types/data_type_bitmap.h" -#include "vec/data_types/data_type_date.h" -#include "vec/data_types/data_type_date_or_datetime_v2.h" -#include "vec/data_types/data_type_date_time.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/data_types/data_type_fixed_length_object.h" -#include "vec/data_types/data_type_hll.h" -#include "vec/data_types/data_type_ipv4.h" -#include "vec/data_types/data_type_ipv6.h" -#include "vec/data_types/data_type_jsonb.h" -#include "vec/data_types/data_type_map.h" -#include "vec/data_types/data_type_nothing.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/data_types/data_type_number.h" -#include "vec/data_types/data_type_quantilestate.h" -#include "vec/data_types/data_type_string.h" -#include "vec/data_types/data_type_struct.h" -#include "vec/data_types/data_type_timestamptz.h" -#include "vec/data_types/data_type_varbinary.h" -#include "vec/data_types/data_type_variant.h" +#include "core/assert_cast.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_agg_state.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type/data_type_bitmap.h" +#include "core/data_type/data_type_date.h" +#include "core/data_type/data_type_date_or_datetime_v2.h" +#include "core/data_type/data_type_date_time.h" +#include "core/data_type/data_type_decimal.h" +#include "core/data_type/data_type_fixed_length_object.h" +#include "core/data_type/data_type_hll.h" +#include "core/data_type/data_type_ipv4.h" +#include "core/data_type/data_type_ipv6.h" +#include "core/data_type/data_type_jsonb.h" +#include "core/data_type/data_type_map.h" +#include "core/data_type/data_type_nothing.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/data_type_number.h" +#include "core/data_type/data_type_quantilestate.h" +#include "core/data_type/data_type_string.h" +#include "core/data_type/data_type_struct.h" +#include "core/data_type/data_type_time.h" +#include "core/data_type/data_type_timestamptz.h" +#include "core/data_type/data_type_varbinary.h" +#include "core/data_type/data_type_variant.h" +#include "core/data_type/define_primitive_type.h" +#include "core/types.h" +#include "core/uint128.h" +#include "storage/field.h" +#include "storage/olap_common.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" -DataTypePtr DataTypeFactory::create_data_type(const doris::Field& col_desc) { +DataTypePtr DataTypeFactory::create_data_type(const doris::StorageField& col_desc) { return create_data_type(col_desc.get_desc(), col_desc.is_nullable()); } @@ -81,17 +81,16 @@ DataTypePtr DataTypeFactory::create_data_type(const TabletColumn& col_desc, bool for (UInt32 i = 0; i < col_desc.get_subtype_count(); i++) { dataTypes.push_back(create_data_type(col_desc.get_sub_column(i))); } - nested = std::make_shared( - dataTypes, col_desc.get_result_is_nullable(), col_desc.get_aggregation_name(), - col_desc.get_be_exec_version()); + nested = std::make_shared(dataTypes, col_desc.get_result_is_nullable(), + col_desc.get_aggregation_name(), + col_desc.get_be_exec_version()); } else if (col_desc.type() == FieldType::OLAP_FIELD_TYPE_ARRAY) { DCHECK(col_desc.get_subtype_count() == 1); nested = std::make_shared(create_data_type(col_desc.get_sub_column(0))); } else if (col_desc.type() == FieldType::OLAP_FIELD_TYPE_MAP) { DCHECK(col_desc.get_subtype_count() == 2); - nested = std::make_shared( - create_data_type(col_desc.get_sub_column(0)), - create_data_type(col_desc.get_sub_column(1))); + nested = std::make_shared(create_data_type(col_desc.get_sub_column(0)), + create_data_type(col_desc.get_sub_column(1))); } else if (col_desc.type() == FieldType::OLAP_FIELD_TYPE_STRUCT) { DCHECK(col_desc.get_subtype_count() >= 1); size_t col_size = col_desc.get_subtype_count(); @@ -122,82 +121,82 @@ DataTypePtr DataTypeFactory::_create_primitive_data_type(const FieldType& type, DataTypePtr result = nullptr; switch (type) { case FieldType::OLAP_FIELD_TYPE_BOOL: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_TINYINT: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_SMALLINT: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_INT: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_FLOAT: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_BIGINT: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_LARGEINT: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_IPV4: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_IPV6: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_DATE: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_DATEV2: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_DATETIMEV2: - result = vectorized::create_datetimev2(scale); + result = create_datetimev2(scale); break; case FieldType::OLAP_FIELD_TYPE_TIMESTAMPTZ: result = std::make_shared(scale); break; case FieldType::OLAP_FIELD_TYPE_DATETIME: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_DOUBLE: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_CHAR: - result = std::make_shared(length, TYPE_CHAR); + result = std::make_shared(length, TYPE_CHAR); break; case FieldType::OLAP_FIELD_TYPE_VARCHAR: - result = std::make_shared(-1, TYPE_VARCHAR); + result = std::make_shared(-1, TYPE_VARCHAR); break; case FieldType::OLAP_FIELD_TYPE_STRING: - result = std::make_shared(-1, TYPE_STRING); + result = std::make_shared(-1, TYPE_STRING); break; case FieldType::OLAP_FIELD_TYPE_VARIANT: - result = std::make_shared(0); + result = std::make_shared(0); break; case FieldType::OLAP_FIELD_TYPE_JSONB: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_HLL: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_BITMAP: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_DECIMAL: - result = std::make_shared(27, 9, precision, scale); + result = std::make_shared(27, 9, precision, scale); break; case FieldType::OLAP_FIELD_TYPE_QUANTILE_STATE: - result = std::make_shared(); + result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_DECIMAL32: case FieldType::OLAP_FIELD_TYPE_DECIMAL64: case FieldType::OLAP_FIELD_TYPE_DECIMAL128I: case FieldType::OLAP_FIELD_TYPE_DECIMAL256: - result = vectorized::create_decimal(precision, scale, false); + result = create_decimal(precision, scale, false); break; default: result = nullptr; @@ -303,8 +302,8 @@ DataTypePtr DataTypeFactory::create_data_type(const PColumnMeta& pcolumn) { case PGenericType::MAP: DCHECK(pcolumn.children_size() == 2); // here to check pcolumn is list? - nested = std::make_shared(create_data_type(pcolumn.children(0)), - create_data_type(pcolumn.children(1))); + nested = std::make_shared(create_data_type(pcolumn.children(0)), + create_data_type(pcolumn.children(1))); break; case PGenericType::STRUCT: { int col_size = pcolumn.children_size(); @@ -362,18 +361,17 @@ DataTypePtr DataTypeFactory::create_data_type(const segment_v2::ColumnMetaPB& pc data_types.push_back(type); } } - nested = std::make_shared( - data_types, pcolumn.result_is_nullable(), pcolumn.function_name(), - pcolumn.be_exec_version()); + nested = std::make_shared(data_types, pcolumn.result_is_nullable(), + pcolumn.function_name(), + pcolumn.be_exec_version()); } else if (pcolumn.type() == static_cast(FieldType::OLAP_FIELD_TYPE_ARRAY)) { // Item subcolumn and length subcolumn, for sparse columns only subcolumn DCHECK_GE(pcolumn.children_columns().size(), 1) << pcolumn.DebugString(); nested = std::make_shared(create_data_type(pcolumn.children_columns(0))); } else if (pcolumn.type() == static_cast(FieldType::OLAP_FIELD_TYPE_MAP)) { DCHECK_GE(pcolumn.children_columns().size(), 2) << pcolumn.DebugString(); - nested = std::make_shared( - create_data_type(pcolumn.children_columns(0)), - create_data_type(pcolumn.children_columns(1))); + nested = std::make_shared(create_data_type(pcolumn.children_columns(0)), + create_data_type(pcolumn.children_columns(1))); } else if (pcolumn.type() == static_cast(FieldType::OLAP_FIELD_TYPE_STRUCT)) { DCHECK_GE(pcolumn.children_columns().size(), 1); Int32 col_size = pcolumn.children_columns().size(); @@ -401,95 +399,94 @@ DataTypePtr DataTypeFactory::create_data_type(const PrimitiveType primitive_type DataTypes subTypes; switch (primitive_type) { case TYPE_BOOLEAN: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_TINYINT: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_SMALLINT: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_INT: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_FLOAT: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_BIGINT: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_LARGEINT: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_IPV4: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_IPV6: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_DATE: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_DATEV2: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_DATETIMEV2: - nested = vectorized::create_datetimev2(scale); + nested = create_datetimev2(scale); break; case TYPE_DATETIME: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_TIMEV2: - nested = std::make_shared(scale); + nested = std::make_shared(scale); break; case TYPE_TIMESTAMPTZ: - nested = std::make_shared(scale); + nested = std::make_shared(scale); break; case TYPE_DOUBLE: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_VARIANT: - nested = std::make_shared(0); + nested = std::make_shared(0); break; case TYPE_STRING: case TYPE_CHAR: case TYPE_VARCHAR: - nested = std::make_shared(len, primitive_type); + nested = std::make_shared(len, primitive_type); break; case TYPE_BINARY: case TYPE_LAMBDA_FUNCTION: - nested = std::make_shared(len, TYPE_STRING); + nested = std::make_shared(len, TYPE_STRING); break; case TYPE_JSONB: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_HLL: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_BITMAP: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_DECIMALV2: - nested = std::make_shared(27, 9, precision, scale); + nested = std::make_shared(27, 9, precision, scale); break; case TYPE_QUANTILE_STATE: - nested = std::make_shared(); + nested = std::make_shared(); break; case TYPE_DECIMAL32: case TYPE_DECIMAL64: case TYPE_DECIMAL128I: case TYPE_DECIMAL256: - nested = vectorized::create_decimal(precision, scale, false); + nested = create_decimal(precision, scale, false); break; // Just Mock A NULL Type in Vec Exec Engine case TYPE_NULL: - nested = std::make_shared(); - const_cast( - reinterpret_cast(*nested)) + nested = std::make_shared(); + const_cast(reinterpret_cast(*nested)) .set_null_literal(true); break; case TYPE_VARBINARY: - nested = std::make_shared(len, TYPE_VARBINARY); + nested = std::make_shared(len, TYPE_VARBINARY); break; case TYPE_AGG_STATE: case TYPE_ARRAY: @@ -524,9 +521,9 @@ DataTypePtr DataTypeFactory::create_data_type(const std::vector& type if (scalar_type.type == TPrimitiveType::VARIANT) { DCHECK(scalar_type.variant_max_subcolumns_count >= 0) << "count is: " << scalar_type.variant_max_subcolumns_count; - return is_nullable ? make_nullable(std::make_shared( + return is_nullable ? make_nullable(std::make_shared( scalar_type.variant_max_subcolumns_count)) - : std::make_shared( + : std::make_shared( scalar_type.variant_max_subcolumns_count); } return create_data_type(thrift_to_type(scalar_type.type), is_nullable, @@ -541,7 +538,7 @@ DataTypePtr DataTypeFactory::create_data_type(const std::vector& type << node.__isset.contains_nulls << " size: " << (node.__isset.contains_nulls ? node.contains_nulls.size() : 0); ++(*idx); - nested = std::make_shared( + nested = std::make_shared( create_data_type(types, idx, node.contains_nulls[0])); break; } @@ -573,7 +570,7 @@ DataTypePtr DataTypeFactory::create_data_type(const std::vector& type ++(*idx); data_types.push_back(create_data_type(types, idx, node.contains_nulls[i])); } - nested = std::make_shared(data_types[0], data_types[1]); + nested = std::make_shared(data_types[0], data_types[1]); break; } default: @@ -601,7 +598,7 @@ DataTypePtr DataTypeFactory::create_data_type( auto primitive_type = thrift_to_type((TPrimitiveType::type)scalar_type.type()); if (primitive_type == TYPE_ARRAY) { ++(*idx); - nested = std::make_shared(create_data_type( + nested = std::make_shared(create_data_type( types, idx, node.has_contains_null() ? node.contains_null() : true)); } else if (primitive_type == TYPE_MAP) { DataTypes data_types; @@ -613,7 +610,7 @@ DataTypePtr DataTypeFactory::create_data_type( ? node.contains_nulls(cast_set(i)) : true); } - nested = std::make_shared(data_types[0], data_types[1]); + nested = std::make_shared(data_types[0], data_types[1]); } else if (primitive_type == TYPE_STRUCT) { DataTypes data_types; Strings names; @@ -640,7 +637,7 @@ DataTypePtr DataTypeFactory::create_data_type( } case TTypeNodeType::ARRAY: { ++(*idx); - nested = std::make_shared(create_data_type( + nested = std::make_shared(create_data_type( types, idx, node.has_contains_null() ? node.contains_null() : true)); break; } @@ -653,7 +650,7 @@ DataTypePtr DataTypeFactory::create_data_type( types, idx, node.contains_nulls_size() > 1 ? node.contains_nulls(cast_set(i)) : true)); } - nested = std::make_shared(data_types[0], data_types[1]); + nested = std::make_shared(data_types[0], data_types[1]); break; } case TTypeNodeType::STRUCT: { @@ -700,8 +697,8 @@ DataTypePtr DataTypeFactory::create_data_type(const TTypeDesc& t) { } DCHECK(t.__isset.result_is_nullable); DCHECK(t.__isset.function_name); - nested = std::make_shared(subTypes, t.result_is_nullable, - t.function_name, t.be_exec_version); + nested = std::make_shared(subTypes, t.result_is_nullable, t.function_name, + t.be_exec_version); return t.is_nullable ? make_nullable(nested) : nested; } else { int idx = 0; @@ -728,8 +725,8 @@ DataTypePtr DataTypeFactory::create_data_type(const TTypeDesc& t, bool is_nullab } DCHECK(t.__isset.result_is_nullable); DCHECK(t.__isset.function_name); - nested = std::make_shared(subTypes, t.result_is_nullable, - t.function_name, t.be_exec_version); + nested = std::make_shared(subTypes, t.result_is_nullable, t.function_name, + t.be_exec_version); return is_nullable ? make_nullable(nested) : nested; } else { int idx = 0; @@ -739,4 +736,4 @@ DataTypePtr DataTypeFactory::create_data_type(const TTypeDesc& t, bool is_nullab } } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_factory.hpp b/be/src/core/data_type/data_type_factory.hpp similarity index 88% rename from be/src/vec/data_types/data_type_factory.hpp rename to be/src/core/data_type/data_type_factory.hpp index e636d216a7382f..15c55a99450063 100644 --- a/be/src/vec/data_types/data_type_factory.hpp +++ b/be/src/core/data_type/data_type_factory.hpp @@ -26,15 +26,14 @@ #include #include -#include "olap/tablet_schema.h" -#include "runtime/types.h" -#include "vec/aggregate_functions/aggregate_function.h" +#include "exprs/aggregate/aggregate_function.h" +#include "storage/tablet/tablet_schema.h" namespace arrow { class DataType; } // namespace arrow namespace doris { -class Field; +class StorageField; class PColumnMeta; enum class FieldType; @@ -44,19 +43,16 @@ class ColumnMetaPB; } // namespace doris -namespace doris::vectorized { +namespace doris { class DataTypeFactory { - using DataTypeMap = std::unordered_map; - using InvertedDataTypeMap = std::vector>; - public: static DataTypeFactory& instance() { static DataTypeFactory instance; return instance; } - DataTypePtr create_data_type(const doris::Field& col_desc); + DataTypePtr create_data_type(const doris::StorageField& col_desc); DataTypePtr create_data_type(const TabletColumn& col_desc, bool is_nullable = false); DataTypePtr create_data_type(const PColumnMeta& pcolumn); @@ -91,4 +87,4 @@ class DataTypeFactory { std::string _empty_string; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_fixed_length_object.cpp b/be/src/core/data_type/data_type_fixed_length_object.cpp similarity index 97% rename from be/src/vec/data_types/data_type_fixed_length_object.cpp rename to be/src/core/data_type/data_type_fixed_length_object.cpp index a238c6681b0d5f..51e1702c7f308b 100644 --- a/be/src/vec/data_types/data_type_fixed_length_object.cpp +++ b/be/src/core/data_type/data_type_fixed_length_object.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/data_types/data_type_fixed_length_object.h" +#include "core/data_type/data_type_fixed_length_object.h" #include #include @@ -25,11 +25,11 @@ #include "agent/be_exec_version_manager.h" #include "common/cast_set.h" -#include "vec/columns/column.h" -#include "vec/common/assert_cast.h" -#include "vec/core/types.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/types.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" char* DataTypeFixedLengthObject::serialize(const IColumn& column, char* buf, @@ -228,4 +228,4 @@ Status DataTypeFixedLengthObject::check_column(const IColumn& column) const { return check_column_non_nested_type(column); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_fixed_length_object.h b/be/src/core/data_type/data_type_fixed_length_object.h similarity index 88% rename from be/src/vec/data_types/data_type_fixed_length_object.h rename to be/src/core/data_type/data_type_fixed_length_object.h index 1cc7e8f21a6998..fae94895ee02d4 100644 --- a/be/src/vec/data_types/data_type_fixed_length_object.h +++ b/be/src/core/data_type/data_type_fixed_length_object.h @@ -24,15 +24,15 @@ #include #include -#include "runtime/define_primitive_type.h" -#include "serde/data_type_string_serde.h" -#include "vec/columns/column_fixed_length_object.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_serde.h" +#include "core/column/column_fixed_length_object.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/data_type_serde/data_type_string_serde.h" +#include "core/field.h" +#include "core/types.h" -namespace doris::vectorized { +namespace doris { class IColumn; class DataTypeFixedLengthObject final : public IDataType { @@ -76,4 +76,4 @@ class DataTypeFixedLengthObject final : public IDataType { }; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_hll.cpp b/be/src/core/data_type/data_type_hll.cpp similarity index 96% rename from be/src/vec/data_types/data_type_hll.cpp rename to be/src/core/data_type/data_type_hll.cpp index 89903301ae6739..8e18b765402477 100644 --- a/be/src/vec/data_types/data_type_hll.cpp +++ b/be/src/core/data_type/data_type_hll.cpp @@ -15,22 +15,22 @@ // specific language governing permissions and limitations // under the License. -#include "vec/data_types/data_type_hll.h" +#include "core/data_type/data_type_hll.h" #include #include #include "agent/be_exec_version_manager.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_complex.h" +#include "core/column/column_const.h" +#include "core/string_buffer.hpp" +#include "util/io_helper.h" #include "util/slice.h" -#include "vec/columns/column.h" -#include "vec/columns/column_complex.h" -#include "vec/columns/column_const.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/io/io_helper.h" -namespace doris::vectorized { +namespace doris { // Two part of binary: | // first: const flag| row num | real_saved_num | hll1 size | hll2 size | ... @@ -192,4 +192,4 @@ void DataTypeHLL::deserialize_as_stream(HyperLogLog& value, BufferReadable& buf) buf.read_binary(str); value.deserialize(Slice(str)); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_hll.h b/be/src/core/data_type/data_type_hll.h similarity index 89% rename from be/src/vec/data_types/data_type_hll.h rename to be/src/core/data_type/data_type_hll.h index a4bdfe823be1c0..0b111b2ff3f9d7 100644 --- a/be/src/vec/data_types/data_type_hll.h +++ b/be/src/core/data_type/data_type_hll.h @@ -26,16 +26,16 @@ #include #include -#include "olap/hll.h" -#include "runtime/define_primitive_type.h" -#include "serde/data_type_hll_serde.h" -#include "vec/columns/column_complex.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_serde.h" - -namespace doris::vectorized { +#include "core/column/column_complex.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_hll_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/field.h" +#include "core/types.h" +#include "core/value/hll.h" + +namespace doris { class BufferReadable; class BufferWritable; class IColumn; @@ -86,4 +86,4 @@ class DataTypeHLL : public IDataType { }; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_ipv4.cpp b/be/src/core/data_type/data_type_ipv4.cpp similarity index 73% rename from be/src/vec/data_types/data_type_ipv4.cpp rename to be/src/core/data_type/data_type_ipv4.cpp index 18a8cfef72a57a..e3ed7a91e56603 100644 --- a/be/src/vec/data_types/data_type_ipv4.cpp +++ b/be/src/core/data_type/data_type_ipv4.cpp @@ -15,19 +15,19 @@ // specific language governing permissions and limitations // under the License. -#include "vec/data_types/data_type_ipv4.h" +#include "core/data_type/data_type_ipv4.h" -#include "util/binary_cast.hpp" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/data_types/data_type.h" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/io/io_helper.h" +#include "core/assert_cast.h" +#include "core/binary_cast.hpp" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type.h" +#include "core/string_buffer.hpp" +#include "exprs/function/cast/cast_to_string.h" +#include "util/io_helper.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" @@ -45,4 +45,4 @@ Field DataTypeIPv4::get_field(const TExprNode& node) const { #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_ipv4.h b/be/src/core/data_type/data_type_ipv4.h similarity index 83% rename from be/src/vec/data_types/data_type_ipv4.h rename to be/src/core/data_type/data_type_ipv4.h index ac4402fcb1c1f5..488e297736fe75 100644 --- a/be/src/vec/data_types/data_type_ipv4.h +++ b/be/src/core/data_type/data_type_ipv4.h @@ -24,22 +24,20 @@ #include #include "common/status.h" -#include "olap/olap_common.h" -#include "runtime/define_primitive_type.h" -#include "vec/common/pod_array.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_number_base.h" -#include "vec/data_types/serde/data_type_ipv4_serde.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_number_base.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_ipv4_serde.h" +#include "core/pod_array.h" +#include "core/types.h" +#include "storage/olap_common.h" namespace doris { -namespace vectorized { class BufferWritable; class IColumn; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { class DataTypeIPv4 final : public DataTypeNumberBase { public: @@ -68,4 +66,4 @@ constexpr bool IsIPv4Type = false; template <> inline constexpr bool IsIPv4Type = true; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_ipv6.cpp b/be/src/core/data_type/data_type_ipv6.cpp old mode 100755 new mode 100644 similarity index 67% rename from be/src/vec/data_types/data_type_ipv6.cpp rename to be/src/core/data_type/data_type_ipv6.cpp index 07402ddbcdb155..a29d787879816a --- a/be/src/vec/data_types/data_type_ipv6.cpp +++ b/be/src/core/data_type/data_type_ipv6.cpp @@ -15,20 +15,20 @@ // specific language governing permissions and limitations // under the License. -#include "vec/data_types/data_type_ipv6.h" +#include "core/data_type/data_type_ipv6.h" -#include "util/binary_cast.hpp" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/data_types/data_type.h" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/io/io_helper.h" -#include "vec/runtime/ipv6_value.h" +#include "core/assert_cast.h" +#include "core/binary_cast.hpp" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type.h" +#include "core/string_buffer.hpp" +#include "core/value/ipv6_value.h" +#include "exprs/function/cast/cast_to_string.h" +#include "util/io_helper.h" -namespace doris::vectorized { +namespace doris { bool DataTypeIPv6::equals(const IDataType& rhs) const { return typeid(rhs) == typeid(*this); } @@ -37,4 +37,4 @@ MutableColumnPtr DataTypeIPv6::create_column() const { return ColumnIPv6::create(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_ipv6.h b/be/src/core/data_type/data_type_ipv6.h old mode 100755 new mode 100644 similarity index 86% rename from be/src/vec/data_types/data_type_ipv6.h rename to be/src/core/data_type/data_type_ipv6.h index 319e99a08174f7..cc48d3c7284c99 --- a/be/src/vec/data_types/data_type_ipv6.h +++ b/be/src/core/data_type/data_type_ipv6.h @@ -25,21 +25,19 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_ipv4.h" -#include "vec/data_types/data_type_number_base.h" -#include "vec/data_types/serde/data_type_ipv6_serde.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_ipv4.h" +#include "core/data_type/data_type_number_base.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_ipv6_serde.h" +#include "core/types.h" namespace doris { -namespace vectorized { class BufferWritable; class IColumn; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { class DataTypeIPv6 final : public DataTypeNumberBase { public: @@ -76,4 +74,4 @@ inline constexpr bool IsIPv6Type = true; template constexpr bool IsIPType = IsIPv4Type || IsIPv6Type; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_jsonb.cpp b/be/src/core/data_type/data_type_jsonb.cpp similarity index 90% rename from be/src/vec/data_types/data_type_jsonb.cpp rename to be/src/core/data_type/data_type_jsonb.cpp index 3f2645cc4c1248..416a4af11e0101 100644 --- a/be/src/vec/data_types/data_type_jsonb.cpp +++ b/be/src/core/data_type/data_type_jsonb.cpp @@ -15,27 +15,25 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_jsonb.h" +#include "core/data_type/data_type_jsonb.h" #include #include #include "common/cast_set.h" -#include "runtime/jsonb_value.h" +#include "core/assert_cast.h" +#include "core/column/column_const.h" +#include "core/string_buffer.hpp" +#include "core/string_ref.h" +#include "core/types.h" +#include "core/value/jsonb_value.h" #include "util/jsonb_utils.h" -#include "vec/columns/column_const.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" namespace doris { -namespace vectorized { class IColumn; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" Field DataTypeJsonb::get_default() const { std::string default_json = "null"; @@ -92,4 +90,4 @@ FieldWithDataType DataTypeJsonb::get_field_with_data_type(const IColumn& column, .base_scalar_type_id = get_primitive_type()}; } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_jsonb.h b/be/src/core/data_type/data_type_jsonb.h similarity index 85% rename from be/src/vec/data_types/data_type_jsonb.h rename to be/src/core/data_type/data_type_jsonb.h index d887879d117187..c11b5e077a9cdc 100644 --- a/be/src/vec/data_types/data_type_jsonb.h +++ b/be/src/core/data_type/data_type_jsonb.h @@ -26,17 +26,17 @@ #include "common/cast_set.h" #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "vec/columns/column_string.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_string.h" -#include "vec/data_types/serde/data_type_jsonb_serde.h" -#include "vec/data_types/serde/data_type_serde.h" -#include "vec/data_types/serde/data_type_string_serde.h" - -namespace doris::vectorized { +#include "core/column/column_string.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_string.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_jsonb_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/data_type_serde/data_type_string_serde.h" +#include "core/field.h" +#include "core/types.h" + +namespace doris { #include "common/compile_check_begin.h" class BufferWritable; @@ -82,4 +82,4 @@ class DataTypeJsonb final : public IDataType { }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_map.cpp b/be/src/core/data_type/data_type_map.cpp similarity index 94% rename from be/src/vec/data_types/data_type_map.cpp rename to be/src/core/data_type/data_type_map.cpp index 76fdfbc3f71e75..9705811e85b242 100644 --- a/be/src/vec/data_types/data_type_map.cpp +++ b/be/src/core/data_type/data_type_map.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_map.h" +#include "core/data_type/data_type_map.h" #include #include @@ -27,17 +27,17 @@ #include "agent/be_exec_version_manager.h" #include "common/status.h" -#include "vec/columns/column.h" -#include "vec/columns/column_array.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_map.h" -#include "vec/columns/column_nullable.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/common/string_ref.h" -#include "vec/data_types/data_type_nullable.h" - -namespace doris::vectorized { +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_array.h" +#include "core/column/column_const.h" +#include "core/column/column_map.h" +#include "core/column/column_nullable.h" +#include "core/data_type/data_type_nullable.h" +#include "core/string_buffer.hpp" +#include "core/string_ref.h" + +namespace doris { DataTypeMap::DataTypeMap(const DataTypePtr& key_type_, const DataTypePtr& value_type_) { key_type = key_type_; @@ -192,4 +192,4 @@ const char* DataTypeMap::deserialize(const char* buf, MutableColumnPtr* column, return get_value_type()->deserialize(buf, &nested_values_column, be_exec_version); } } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/data_types/data_type_map.h b/be/src/core/data_type/data_type_map.h similarity index 91% rename from be/src/vec/data_types/data_type_map.h rename to be/src/core/data_type/data_type_map.h index f03d740ab7f427..2224eb0adcb5e9 100644 --- a/be/src/vec/data_types/data_type_map.h +++ b/be/src/core/data_type/data_type_map.h @@ -28,23 +28,21 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_map_serde.h" -#include "vec/data_types/serde/data_type_serde.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_map_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/field.h" +#include "core/types.h" namespace doris { class PColumnMeta; -namespace vectorized { class BufferWritable; class IColumn; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { /** Map data type. */ class DataTypeMap final : public IDataType { @@ -109,4 +107,4 @@ class DataTypeMap final : public IDataType { #endif }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_nothing.cpp b/be/src/core/data_type/data_type_nothing.cpp similarity index 92% rename from be/src/vec/data_types/data_type_nothing.cpp rename to be/src/core/data_type/data_type_nothing.cpp index a5897038e16379..c47222e2853ff5 100644 --- a/be/src/vec/data_types/data_type_nothing.cpp +++ b/be/src/core/data_type/data_type_nothing.cpp @@ -18,13 +18,13 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/DataTypeNothing.cpp // and modified by Doris -#include "vec/data_types/data_type_nothing.h" +#include "core/data_type/data_type_nothing.h" #include -#include "vec/columns/column_nothing.h" +#include "core/column/column_nothing.h" -namespace doris::vectorized { +namespace doris { MutableColumnPtr DataTypeNothing::create_column() const { return ColumnNothing::create(0); @@ -49,4 +49,4 @@ bool DataTypeNothing::equals(const IDataType& rhs) const { return typeid(rhs) == typeid(*this); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_nothing.h b/be/src/core/data_type/data_type_nothing.h similarity index 91% rename from be/src/vec/data_types/data_type_nothing.h rename to be/src/core/data_type/data_type_nothing.h index b053960029e00e..e50c9c87a946b9 100644 --- a/be/src/vec/data_types/data_type_nothing.h +++ b/be/src/core/data_type/data_type_nothing.h @@ -29,14 +29,14 @@ #include #include -#include "runtime/define_primitive_type.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_nothing_serde.h" -#include "vec/data_types/serde/data_type_serde.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_nothing_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/field.h" +#include "core/types.h" -namespace doris::vectorized { +namespace doris { class IColumn; @@ -91,4 +91,4 @@ class DataTypeNothing final : public IDataType { } }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_nullable.cpp b/be/src/core/data_type/data_type_nullable.cpp similarity index 96% rename from be/src/vec/data_types/data_type_nullable.cpp rename to be/src/core/data_type/data_type_nullable.cpp index 7a9235ffe72023..dcf67afd2cf134 100644 --- a/be/src/vec/data_types/data_type_nullable.cpp +++ b/be/src/core/data_type/data_type_nullable.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/DataTypeNullable.cpp // and modified by Doris -#include "vec/data_types/data_type_nullable.h" +#include "core/data_type/data_type_nullable.h" #include #include @@ -31,17 +31,17 @@ #include "agent/be_exec_version_manager.h" #include "common/cast_set.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_nullable.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_nothing.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_nullable.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_nothing.h" +#include "core/field.h" +#include "core/string_buffer.hpp" +#include "core/types.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" DataTypeNullable::DataTypeNullable(const DataTypePtr& nested_data_type_) : nested_data_type {nested_data_type_} { @@ -260,4 +260,4 @@ bool have_nullable(const DataTypes& types) { return std::ranges::any_of(types, [](const DataTypePtr& type) { return type->is_nullable(); }); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_nullable.h b/be/src/core/data_type/data_type_nullable.h similarity index 92% rename from be/src/vec/data_types/data_type_nullable.h rename to be/src/core/data_type/data_type_nullable.h index cc8dcabc19112e..fbb653ba1a1d73 100644 --- a/be/src/vec/data_types/data_type_nullable.h +++ b/be/src/core/data_type/data_type_nullable.h @@ -28,24 +28,21 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "runtime/types.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_nullable_serde.h" -#include "vec/data_types/serde/data_type_serde.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_nullable_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/field.h" +#include "core/types.h" namespace doris { class PColumnMeta; -namespace vectorized { class BufferWritable; class IColumn; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { /// A nullable data type is an ordinary data type provided with a tag /// indicating that it also contains the NULL value. The following class @@ -126,4 +123,4 @@ DataTypePtr remove_nullable(const DataTypePtr& type); DataTypes remove_nullable(const DataTypes& types); bool have_nullable(const DataTypes& types); -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_number.h b/be/src/core/data_type/data_type_number.h similarity index 93% rename from be/src/vec/data_types/data_type_number.h rename to be/src/core/data_type/data_type_number.h index 54af59f8a0ecdf..99b8bb42880402 100644 --- a/be/src/vec/data_types/data_type_number.h +++ b/be/src/core/data_type/data_type_number.h @@ -20,11 +20,11 @@ #pragma once -#include "runtime/define_primitive_type.h" -#include "vec/columns/column_string.h" -#include "vec/data_types/data_type_number_base.h" +#include "core/column/column_string.h" +#include "core/data_type/data_type_number_base.h" +#include "core/data_type/define_primitive_type.h" -namespace doris::vectorized { +namespace doris { template class DataTypeNumber final : public DataTypeNumberBase { @@ -77,4 +77,4 @@ inline constexpr bool IsDataTypeFloat = true; template <> inline constexpr bool IsDataTypeFloat = true; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_number_base.cpp b/be/src/core/data_type/data_type_number_base.cpp similarity index 96% rename from be/src/vec/data_types/data_type_number_base.cpp rename to be/src/core/data_type/data_type_number_base.cpp index 07c33794362a55..cff73964a165c0 100644 --- a/be/src/vec/data_types/data_type_number_base.cpp +++ b/be/src/core/data_type/data_type_number_base.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/DataTypeNumberBase.cpp // and modified by Doris -#include "vec/data_types/data_type_number_base.h" +#include "core/data_type/data_type_number_base.h" #include #include @@ -32,21 +32,21 @@ #include "agent/be_exec_version_manager.h" #include "common/cast_set.h" #include "common/status.h" -#include "runtime/large_int_value.h" -#include "runtime/primitive_type.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_vector.h" +#include "core/data_type/primitive_type.h" +#include "core/string_buffer.hpp" +#include "core/types.h" +#include "core/value/large_int_value.h" +#include "exprs/function/cast/cast_to_string.h" +#include "util/io_helper.h" #include "util/mysql_global.h" #include "util/string_parser.hpp" #include "util/to_string.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/core/types.h" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/io/io_helper.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" #ifdef BE_TEST template @@ -268,4 +268,4 @@ template class DataTypeNumberBase; template class DataTypeNumberBase; template class DataTypeNumberBase; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_number_base.h b/be/src/core/data_type/data_type_number_base.h similarity index 94% rename from be/src/vec/data_types/data_type_number_base.h rename to be/src/core/data_type/data_type_number_base.h index a7b360ab92a57e..6614f25930bd15 100644 --- a/be/src/vec/data_types/data_type_number_base.h +++ b/be/src/core/data_type/data_type_number_base.h @@ -30,15 +30,15 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "serde/data_type_number_serde.h" -#include "vec/columns/column_vector.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_serde.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_number_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/field.h" +#include "core/types.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class BufferWritable; @@ -151,4 +151,4 @@ class DataTypeNumberBase : public IDataType { bool _is_null_literal = false; }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_quantilestate.cpp b/be/src/core/data_type/data_type_quantilestate.cpp similarity index 95% rename from be/src/vec/data_types/data_type_quantilestate.cpp rename to be/src/core/data_type/data_type_quantilestate.cpp index 85f22c689ade0b..5926fb5f942ddb 100644 --- a/be/src/vec/data_types/data_type_quantilestate.cpp +++ b/be/src/core/data_type/data_type_quantilestate.cpp @@ -15,18 +15,18 @@ // specific language governing permissions and limitations // under the License. -#include "vec/data_types/data_type_quantilestate.h" +#include "core/data_type/data_type_quantilestate.h" #include "agent/be_exec_version_manager.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_complex.h" +#include "core/string_buffer.hpp" +#include "core/string_ref.h" +#include "util/io_helper.h" #include "util/slice.h" -#include "vec/columns/column.h" -#include "vec/columns/column_complex.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/common/string_ref.h" -#include "vec/io/io_helper.h" - -namespace doris::vectorized { + +namespace doris { #include "common/compile_check_begin.h" // binary: const flag | row num | read saved num | | // : quantilestate1 size | quantilestate2 size | ... @@ -176,4 +176,4 @@ void DataTypeQuantileState::deserialize_as_stream(QuantileState& value, BufferRe value.deserialize(ref.to_slice()); } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/data_types/data_type_quantilestate.h b/be/src/core/data_type/data_type_quantilestate.h similarity index 88% rename from be/src/vec/data_types/data_type_quantilestate.h rename to be/src/core/data_type/data_type_quantilestate.h index fe17427f7ba8d4..210873642c8737 100644 --- a/be/src/vec/data_types/data_type_quantilestate.h +++ b/be/src/core/data_type/data_type_quantilestate.h @@ -25,16 +25,16 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "serde/data_type_quantilestate_serde.h" -#include "util/quantile_state.h" -#include "vec/columns/column_complex.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_serde.h" +#include "core/column/column_complex.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_quantilestate_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/field.h" +#include "core/types.h" +#include "core/value/quantile_state.h" -namespace doris::vectorized { +namespace doris { class BufferReadable; class BufferWritable; class IColumn; @@ -81,4 +81,4 @@ class DataTypeQuantileState : public IDataType { return std::make_shared(nesting_level); }; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_string.cpp b/be/src/core/data_type/data_type_string.cpp similarity index 96% rename from be/src/vec/data_types/data_type_string.cpp rename to be/src/core/data_type/data_type_string.cpp index d114bd37832301..27866dd80f5223 100644 --- a/be/src/vec/data_types/data_type_string.cpp +++ b/be/src/core/data_type/data_type_string.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/DataTypeString.cpp // and modified by Doris -#include "vec/data_types/data_type_string.h" +#include "core/data_type/data_type_string.h" #include #include @@ -31,17 +31,17 @@ #include "common/cast_set.h" #include "common/exception.h" #include "common/status.h" -#include "runtime/primitive_type.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_string.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/common/string_ref.h" -#include "vec/core/field.h" -#include "vec/core/types.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_string.h" +#include "core/data_type/primitive_type.h" +#include "core/field.h" +#include "core/string_buffer.hpp" +#include "core/string_ref.h" +#include "core/types.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" Field DataTypeString::get_default() const { @@ -292,4 +292,4 @@ FieldWithDataType DataTypeString::get_field_with_data_type(const IColumn& column .base_scalar_type_id = get_primitive_type()}; } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_string.h b/be/src/core/data_type/data_type_string.h similarity index 92% rename from be/src/vec/data_types/data_type_string.h rename to be/src/core/data_type/data_type_string.h index b01501dd03b49d..083c153dfb3283 100644 --- a/be/src/vec/data_types/data_type_string.h +++ b/be/src/core/data_type/data_type_string.h @@ -28,15 +28,15 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "serde/data_type_string_serde.h" -#include "vec/columns/column_string.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_serde.h" - -namespace doris::vectorized { +#include "core/column/column_string.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/data_type_serde/data_type_string_serde.h" +#include "core/field.h" +#include "core/types.h" + +namespace doris { class BufferWritable; class IColumn; @@ -109,4 +109,4 @@ constexpr static bool IsStringType = false; template <> inline constexpr bool IsStringType = true; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_struct.cpp b/be/src/core/data_type/data_type_struct.cpp similarity index 96% rename from be/src/vec/data_types/data_type_struct.cpp rename to be/src/core/data_type/data_type_struct.cpp index 650ff23e58d304..0c981481c69db4 100644 --- a/be/src/vec/data_types/data_type_struct.cpp +++ b/be/src/core/data_type/data_type_struct.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/DataTypeTuple.cpp // and modified by Doris -#include "vec/data_types/data_type_struct.h" +#include "core/data_type/data_type_struct.h" #include #include @@ -37,15 +37,15 @@ #include "agent/be_exec_version_manager.h" #include "common/status.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_struct.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/common/string_ref.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_nullable.h" +#include "core/column/column_struct.h" +#include "core/string_buffer.hpp" +#include "core/string_ref.h" -namespace doris::vectorized { +namespace doris { DataTypeStruct::DataTypeStruct(const DataTypes& elems_) : elems(elems_), have_explicit_names(false) { @@ -286,4 +286,4 @@ size_t DataTypeStruct::get_size_of_value_in_memory() const { return res; } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_struct.h b/be/src/core/data_type/data_type_struct.h similarity index 93% rename from be/src/vec/data_types/data_type_struct.h rename to be/src/core/data_type/data_type_struct.h index e9aea925fec479..9f7d90667a786f 100644 --- a/be/src/vec/data_types/data_type_struct.h +++ b/be/src/core/data_type/data_type_struct.h @@ -30,23 +30,21 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_serde.h" -#include "vec/data_types/serde/data_type_struct_serde.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/data_type_serde/data_type_struct_serde.h" +#include "core/field.h" +#include "core/types.h" namespace doris { class PColumnMeta; -namespace vectorized { class BufferWritable; class IColumn; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { /** Struct data type. * Used as an intermediate result when evaluating expressions. @@ -146,4 +144,4 @@ class DataTypeStruct final : public IDataType { #endif }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_time.cpp b/be/src/core/data_type/data_type_time.cpp similarity index 85% rename from be/src/vec/data_types/data_type_time.cpp rename to be/src/core/data_type/data_type_time.cpp index 6720b7cc7e4f98..a9dec7084f3826 100644 --- a/be/src/vec/data_types/data_type_time.cpp +++ b/be/src/core/data_type/data_type_time.cpp @@ -18,21 +18,21 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/DataTypeDateTime.cpp // and modified by Doris -#include "vec/data_types/data_type_time.h" +#include "core/data_type/data_type_time.h" #include #include #include +#include "core/assert_cast.h" +#include "core/column/column_const.h" +#include "core/column/column_vector.h" +#include "core/string_buffer.hpp" +#include "exprs/function/cast/cast_to_string.h" #include "util/date_func.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/functions/cast/cast_to_string.h" -namespace doris::vectorized { +namespace doris { class IColumn; void DataTypeTimeV2::to_pb_column_meta(PColumnMeta* col_meta) const { @@ -55,4 +55,4 @@ Field DataTypeTimeV2::get_field(const TExprNode& node) const { return Field::create_field(node.timev2_literal.value); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_time.h b/be/src/core/data_type/data_type_time.h similarity index 88% rename from be/src/vec/data_types/data_type_time.h rename to be/src/core/data_type/data_type_time.h index 6049436156682f..afcc97fe8e1853 100644 --- a/be/src/vec/data_types/data_type_time.h +++ b/be/src/core/data_type/data_type_time.h @@ -27,14 +27,14 @@ #include #include -#include "runtime/define_primitive_type.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_number_base.h" -#include "vec/data_types/serde/data_type_serde.h" -#include "vec/data_types/serde/data_type_time_serde.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_number_base.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/data_type_serde/data_type_time_serde.h" +#include "core/types.h" -namespace doris::vectorized { +namespace doris { class BufferWritable; class IColumn; @@ -73,4 +73,4 @@ class DataTypeTimeV2 final : public DataTypeNumberBase #include -#include "runtime/define_primitive_type.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_number_base.h" -#include "vec/data_types/serde/data_type_serde.h" -#include "vec/data_types/serde/data_type_timestamptz_serde.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_number_base.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/data_type_serde/data_type_timestamptz_serde.h" -namespace doris::vectorized { +namespace doris { class DataTypeTimeStampTz final : public DataTypeNumberBase { public: @@ -69,4 +69,4 @@ class DataTypeTimeStampTz final : public DataTypeNumberBase #include @@ -27,19 +27,19 @@ #include "agent/be_exec_version_manager.h" #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "runtime/primitive_type.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_varbinary.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/common/string_ref.h" -#include "vec/common/string_view.h" -#include "vec/core/field.h" -#include "vec/core/types.h" - -namespace doris::vectorized { +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_varbinary.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/field.h" +#include "core/string_buffer.hpp" +#include "core/string_ref.h" +#include "core/string_view.h" +#include "core/types.h" + +namespace doris { #include "common/compile_check_begin.h" Field DataTypeVarbinary::get_default() const { @@ -136,4 +136,4 @@ FieldWithDataType DataTypeVarbinary::get_field_with_data_type(const IColumn& col .base_scalar_type_id = get_primitive_type()}; } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_varbinary.h b/be/src/core/data_type/data_type_varbinary.h similarity index 89% rename from be/src/vec/data_types/data_type_varbinary.h rename to be/src/core/data_type/data_type_varbinary.h index 45cba9bac429c1..c987cb946c2779 100644 --- a/be/src/vec/data_types/data_type_varbinary.h +++ b/be/src/core/data_type/data_type_varbinary.h @@ -24,16 +24,16 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "runtime/primitive_type.h" -#include "serde/data_type_string_serde.h" -#include "vec/common/string_view.h" -#include "vec/core/field.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_serde.h" -#include "vec/data_types/serde/data_type_varbinary_serde.h" - -namespace doris::vectorized { +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/data_type_serde/data_type_string_serde.h" +#include "core/data_type_serde/data_type_varbinary_serde.h" +#include "core/field.h" +#include "core/string_view.h" + +namespace doris { class BufferWritable; class IColumn; @@ -99,4 +99,4 @@ constexpr static bool IsVarBinaryType = false; template <> inline constexpr bool IsVarBinaryType = true; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/data_type_variant.cpp b/be/src/core/data_type/data_type_variant.cpp similarity index 95% rename from be/src/vec/data_types/data_type_variant.cpp rename to be/src/core/data_type/data_type_variant.cpp index e97d8a4467122e..f3b896fea64754 100644 --- a/be/src/vec/data_types/data_type_variant.cpp +++ b/be/src/core/data_type/data_type_variant.cpp @@ -18,11 +18,10 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/DataTypeObject.cpp // and modified by Doris -#include "vec/data_types/data_type_variant.h" +#include "core/data_type/data_type_variant.h" #include #include -#include #include #include @@ -30,22 +29,21 @@ #include #include "agent/be_exec_version_manager.h" -#include "vec/columns/column.h" -#include "vec/columns/column_variant.h" -#include "vec/common/assert_cast.h" -#include "vec/common/typeid_cast.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_factory.hpp" -#include "vec/json/path_in_data.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_variant.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_factory.hpp" +#include "core/typeid_cast.h" +#include "core/types.h" +#include "util/json/path_in_data.h" +#include "util/string_util.h" namespace doris { -namespace vectorized { class IColumn; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" DataTypeVariant::DataTypeVariant(int32_t max_subcolumns_count) @@ -244,4 +242,4 @@ MutableColumnPtr DataTypeVariant::create_column() const { return ColumnVariant::create(_max_subcolumns_count); } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/data_types/data_type_variant.h b/be/src/core/data_type/data_type_variant.h similarity index 87% rename from be/src/vec/data_types/data_type_variant.h rename to be/src/core/data_type/data_type_variant.h index decb0b65962a12..fd59733f452b33 100644 --- a/be/src/vec/data_types/data_type_variant.h +++ b/be/src/core/data_type/data_type_variant.h @@ -31,23 +31,20 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "runtime/types.h" -#include "serde/data_type_variant_serde.h" -#include "vec/columns/column_variant.h" -#include "vec/common/assert_cast.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_serde.h" +#include "core/assert_cast.h" +#include "core/column/column_variant.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/data_type_serde/data_type_variant_serde.h" +#include "core/field.h" +#include "core/types.h" namespace doris { -namespace vectorized { class IColumn; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { class DataTypeVariant : public IDataType { private: int32_t _max_subcolumns_count = 0; @@ -88,4 +85,4 @@ class DataTypeVariant : public IDataType { void to_pb_column_meta(PColumnMeta* col_meta) const override; int32_t variant_max_subcolumns_count() const { return _max_subcolumns_count; } }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/runtime/define_primitive_type.h b/be/src/core/data_type/define_primitive_type.h similarity index 100% rename from be/src/runtime/define_primitive_type.h rename to be/src/core/data_type/define_primitive_type.h diff --git a/be/src/vec/data_types/get_least_supertype.cpp b/be/src/core/data_type/get_least_supertype.cpp similarity index 93% rename from be/src/vec/data_types/get_least_supertype.cpp rename to be/src/core/data_type/get_least_supertype.cpp index 5b3ead23e1b662..1aee7c34ae2f7b 100644 --- a/be/src/vec/data_types/get_least_supertype.cpp +++ b/be/src/core/data_type/get_least_supertype.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/getLeastSupertype.cpp // and modified by Doris -#include "vec/data_types/get_least_supertype.h" +#include "core/data_type/get_least_supertype.h" #include #include @@ -27,24 +27,24 @@ #include #include "common/status.h" -#include "vec/aggregate_functions/helpers.h" -#include "vec/columns/column_variant.h" -#include "vec/common/typeid_cast.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_array.h" -#include "vec/data_types/data_type_date_or_datetime_v2.h" -#include "vec/data_types/data_type_date_time.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/data_types/data_type_factory.hpp" -#include "vec/data_types/data_type_jsonb.h" -#include "vec/data_types/data_type_nothing.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/data_types/data_type_number.h" -#include "vec/data_types/data_type_string.h" -#include "vec/data_types/data_type_variant.h" +#include "core/column/column_variant.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type/data_type_date_or_datetime_v2.h" +#include "core/data_type/data_type_date_time.h" +#include "core/data_type/data_type_decimal.h" +#include "core/data_type/data_type_factory.hpp" +#include "core/data_type/data_type_jsonb.h" +#include "core/data_type/data_type_nothing.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/data_type_number.h" +#include "core/data_type/data_type_string.h" +#include "core/data_type/data_type_variant.h" +#include "core/typeid_cast.h" +#include "core/types.h" +#include "exprs/aggregate/helpers.h" -namespace doris::vectorized { +namespace doris { void get_numeric_type(const PrimitiveTypeSet& types, DataTypePtr* type) { bool all_numbers = true; @@ -321,4 +321,4 @@ void get_least_supertype_jsonb(const PrimitiveTypeSet& types, DataTypePtr* type) *type = std::make_shared(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/get_least_supertype.h b/be/src/core/data_type/get_least_supertype.h similarity index 92% rename from be/src/vec/data_types/get_least_supertype.h rename to be/src/core/data_type/get_least_supertype.h index 5600ebdd68cae8..f9693ed23db473 100644 --- a/be/src/vec/data_types/get_least_supertype.h +++ b/be/src/core/data_type/get_least_supertype.h @@ -23,13 +23,13 @@ #include #include "common/status.h" -#include "vec/data_types/data_type.h" +#include "core/data_type/data_type.h" -namespace doris::vectorized { +namespace doris { using PrimitiveTypeSet = phmap::flat_hash_set; void get_least_supertype_jsonb(const DataTypes& types, DataTypePtr* type); void get_least_supertype_jsonb(const PrimitiveTypeSet& types, DataTypePtr* type); -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/nested_utils.cpp b/be/src/core/data_type/nested_utils.cpp similarity index 93% rename from be/src/vec/data_types/nested_utils.cpp rename to be/src/core/data_type/nested_utils.cpp index 22c9dfc6df48a9..ba48234931a4d3 100644 --- a/be/src/vec/data_types/nested_utils.cpp +++ b/be/src/core/data_type/nested_utils.cpp @@ -18,11 +18,11 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/DataTypes/NestedUtils.cpp // and modified by Doris -#include "vec/data_types/nested_utils.h" +#include "core/data_type/nested_utils.h" -#include "vec/common/string_utils/string_utils.h" +#include "exec/common/string_utils/string_utils.h" -namespace doris::vectorized { +namespace doris { namespace Nested { @@ -68,4 +68,4 @@ std::string extract_table_name(const std::string& nested_name) { } // namespace Nested -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/nested_utils.h b/be/src/core/data_type/nested_utils.h similarity index 94% rename from be/src/vec/data_types/nested_utils.h rename to be/src/core/data_type/nested_utils.h index 081e31d272d32b..8a7d166e8c8968 100644 --- a/be/src/vec/data_types/nested_utils.h +++ b/be/src/core/data_type/nested_utils.h @@ -23,9 +23,9 @@ #include #include -#include "vec/core/block.h" +#include "core/block/block.h" -namespace doris::vectorized { +namespace doris { namespace Nested { std::string concatenate_name(const std::string& nested_table_name, @@ -43,4 +43,4 @@ Block flatten(const Block& block); void validate_array_sizes(const Block& block); } // namespace Nested -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/number_traits.h b/be/src/core/data_type/number_traits.h similarity index 96% rename from be/src/vec/data_types/number_traits.h rename to be/src/core/data_type/number_traits.h index a5d0672bbde794..0039bb920766ab 100644 --- a/be/src/vec/data_types/number_traits.h +++ b/be/src/core/data_type/number_traits.h @@ -23,13 +23,13 @@ #include #include -#include "vec/columns/column_decimal.h" -#include "vec/columns/column_vector.h" -#include "vec/common/uint128.h" -#include "vec/core/extended_types.h" -#include "vec/core/types.h" +#include "core/column/column_decimal.h" +#include "core/column/column_vector.h" +#include "core/extended_types.h" +#include "core/types.h" +#include "core/uint128.h" -namespace doris::vectorized { +namespace doris { /** Allows get the result type of the functions +, -, *, /, %, intDiv (integer division). * The rules are different from those used in C++. @@ -229,6 +229,10 @@ struct ResultOfAbs { static constexpr PrimitiveType Type = TYPE_DECIMALV2; }; template <> +struct ResultOfAbs { + static constexpr PrimitiveType Type = TYPE_DECIMALV2; +}; +template <> struct ResultOfAbs { static constexpr PrimitiveType Type = TYPE_DECIMAL128I; }; @@ -326,4 +330,4 @@ inline constexpr int max_ascii_len() { } } // namespace NumberTraits -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/runtime/primitive_type.cpp b/be/src/core/data_type/primitive_type.cpp similarity index 98% rename from be/src/runtime/primitive_type.cpp rename to be/src/core/data_type/primitive_type.cpp index 9e665f6bbe79ce..44527e33893f1a 100644 --- a/be/src/runtime/primitive_type.cpp +++ b/be/src/core/data_type/primitive_type.cpp @@ -15,13 +15,13 @@ // specific language governing permissions and limitations // under the License. -#include "runtime/primitive_type.h" +#include "core/data_type/primitive_type.h" #include #include -#include "runtime/define_primitive_type.h" +#include "core/data_type/define_primitive_type.h" namespace doris { diff --git a/be/src/runtime/primitive_type.h b/be/src/core/data_type/primitive_type.h similarity index 74% rename from be/src/runtime/primitive_type.h rename to be/src/core/data_type/primitive_type.h index e3358f82b79912..e3cbd05d1e67d3 100644 --- a/be/src/runtime/primitive_type.h +++ b/be/src/core/data_type/primitive_type.h @@ -26,19 +26,18 @@ #include #include "common/cast_set.h" -#include "olap/decimal12.h" -#include "olap/uint24.h" -#include "runtime/define_primitive_type.h" -#include "vec/common/string_view.h" -#include "vec/core/types.h" -#include "vec/json/path_in_data.h" -#include "vec/runtime/timestamptz_value.h" -#include "vec/runtime/vdatetime_value.h" -#include "vec/utils/template_helpers.hpp" +#include "core/data_type/define_primitive_type.h" +#include "core/decimal12.h" +#include "core/string_view.h" +#include "core/types.h" +#include "core/uint24.h" +#include "core/value/timestamptz_value.h" +#include "core/value/vdatetime_value.h" +#include "exec/common/template_helpers.hpp" +#include "util/json/path_in_data.h" namespace doris { #include "common/compile_check_begin.h" -namespace vectorized { template class ColumnStr; class IColumnDummy; @@ -128,7 +127,6 @@ using ColumnDecimal128V2 = ColumnDecimal; using ColumnDecimal128V3 = ColumnDecimal; using ColumnDecimal256 = ColumnDecimal; class ColumnArray; -} // namespace vectorized class DecimalV2Value; @@ -277,117 +275,117 @@ struct PrimitiveTypeTraits; */ template <> struct PrimitiveTypeTraits { - using CppType = vectorized::UInt8; + using CppType = UInt8; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeBool; - using ColumnType = vectorized::ColumnUInt8; + using DataType = DataTypeBool; + using ColumnType = ColumnUInt8; }; template <> struct PrimitiveTypeTraits { using CppType = int8_t; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeInt8; - using ColumnType = vectorized::ColumnInt8; + using DataType = DataTypeInt8; + using ColumnType = ColumnInt8; }; template <> struct PrimitiveTypeTraits { using CppType = int16_t; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeInt16; - using ColumnType = vectorized::ColumnInt16; + using DataType = DataTypeInt16; + using ColumnType = ColumnInt16; }; template <> struct PrimitiveTypeTraits { using CppType = int32_t; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeInt32; - using ColumnType = vectorized::ColumnInt32; + using DataType = DataTypeInt32; + using ColumnType = ColumnInt32; }; template <> struct PrimitiveTypeTraits { using CppType = int64_t; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeInt64; - using ColumnType = vectorized::ColumnInt64; + using DataType = DataTypeInt64; + using ColumnType = ColumnInt64; }; template <> struct PrimitiveTypeTraits { using CppType = __int128_t; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeInt128; - using ColumnType = vectorized::ColumnInt128; + using DataType = DataTypeInt128; + using ColumnType = ColumnInt128; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::Null; + using CppType = Null; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeNothing; - using ColumnType = vectorized::IColumnDummy; + using DataType = DataTypeNothing; + using ColumnType = IColumnDummy; }; template <> struct PrimitiveTypeTraits { using CppType = float; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeFloat32; - using ColumnType = vectorized::ColumnFloat32; + using DataType = DataTypeFloat32; + using ColumnType = ColumnFloat32; }; template <> struct PrimitiveTypeTraits { using CppType = double; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeFloat64; - using ColumnType = vectorized::ColumnFloat64; + using DataType = DataTypeFloat64; + using ColumnType = ColumnFloat64; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::Float64; + using CppType = Float64; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeTimeV2; - using ColumnType = vectorized::ColumnTimeV2; + using DataType = DataTypeTimeV2; + using ColumnType = ColumnTimeV2; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::Float64; + using CppType = Float64; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeTimeV2; - using ColumnType = vectorized::ColumnTime; + using DataType = DataTypeTimeV2; + using ColumnType = ColumnTime; }; template <> struct PrimitiveTypeTraits { using CppType = doris::VecDateTimeValue; /// Different with compute layer, the DateV1 was stored as uint24_t(3 bytes). using StorageFieldType = uint24_t; - using DataType = vectorized::DataTypeDate; - using ColumnType = vectorized::ColumnDate; + using DataType = DataTypeDate; + using ColumnType = ColumnDate; }; template <> struct PrimitiveTypeTraits { using CppType = doris::VecDateTimeValue; using StorageFieldType = uint64_t; - using DataType = vectorized::DataTypeDateTime; - using ColumnType = vectorized::ColumnDateTime; + using DataType = DataTypeDateTime; + using ColumnType = ColumnDateTime; }; template <> struct PrimitiveTypeTraits { using CppType = DateV2Value; using StorageFieldType = uint64_t; - using DataType = vectorized::DataTypeDateTimeV2; - using ColumnType = vectorized::ColumnDateTimeV2; + using DataType = DataTypeDateTimeV2; + using ColumnType = ColumnDateTimeV2; }; template <> struct PrimitiveTypeTraits { using CppType = DateV2Value; using StorageFieldType = uint32_t; - using DataType = vectorized::DataTypeDateV2; - using ColumnType = vectorized::ColumnDateV2; + using DataType = DataTypeDateV2; + using ColumnType = ColumnDateV2; }; template <> struct PrimitiveTypeTraits { using CppType = TimestampTzValue; using StorageFieldType = uint64_t; - using DataType = vectorized::DataTypeTimeStampTz; - using ColumnType = vectorized::ColumnTimeStampTz; + using DataType = DataTypeTimeStampTz; + using ColumnType = ColumnTimeStampTz; }; template <> @@ -395,148 +393,148 @@ struct PrimitiveTypeTraits { using CppType = DecimalV2Value; /// Different with compute layer, the DecimalV1 was stored as decimal12_t(12 bytes). using StorageFieldType = decimal12_t; - using DataType = vectorized::DataTypeDecimalV2; - using ColumnType = vectorized::ColumnDecimal128V2; + using DataType = DataTypeDecimalV2; + using ColumnType = ColumnDecimal128V2; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::Decimal32; - using StorageFieldType = vectorized::Int32; - using DataType = vectorized::DataTypeDecimal32; - using ColumnType = vectorized::ColumnDecimal32; + using CppType = Decimal32; + using StorageFieldType = Int32; + using DataType = DataTypeDecimal32; + using ColumnType = ColumnDecimal32; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::Decimal64; - using StorageFieldType = vectorized::Int64; - using DataType = vectorized::DataTypeDecimal64; - using ColumnType = vectorized::ColumnDecimal64; + using CppType = Decimal64; + using StorageFieldType = Int64; + using DataType = DataTypeDecimal64; + using ColumnType = ColumnDecimal64; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::Decimal128V3; - using StorageFieldType = vectorized::Int128; - using DataType = vectorized::DataTypeDecimal128; - using ColumnType = vectorized::ColumnDecimal128V3; + using CppType = Decimal128V3; + using StorageFieldType = Int128; + using DataType = DataTypeDecimal128; + using ColumnType = ColumnDecimal128V3; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::Decimal256; + using CppType = Decimal256; using StorageFieldType = wide::Int256; - using DataType = vectorized::DataTypeDecimal256; - using ColumnType = vectorized::ColumnDecimal256; + using DataType = DataTypeDecimal256; + using ColumnType = ColumnDecimal256; }; template <> struct PrimitiveTypeTraits { using CppType = IPv4; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeIPv4; - using ColumnType = vectorized::ColumnIPv4; + using DataType = DataTypeIPv4; + using ColumnType = ColumnIPv4; }; template <> struct PrimitiveTypeTraits { using CppType = IPv6; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeIPv6; - using ColumnType = vectorized::ColumnIPv6; + using DataType = DataTypeIPv6; + using ColumnType = ColumnIPv6; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::String; + using CppType = String; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeString; - using ColumnType = vectorized::ColumnString; + using DataType = DataTypeString; + using ColumnType = ColumnString; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::String; + using CppType = String; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeString; - using ColumnType = vectorized::ColumnString; + using DataType = DataTypeString; + using ColumnType = ColumnString; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::String; + using CppType = String; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeString; - using ColumnType = vectorized::ColumnString; + using DataType = DataTypeString; + using ColumnType = ColumnString; }; template <> struct PrimitiveTypeTraits { using CppType = doris::StringView; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeVarbinary; - using ColumnType = vectorized::ColumnVarbinary; + using DataType = DataTypeVarbinary; + using ColumnType = ColumnVarbinary; }; template <> struct PrimitiveTypeTraits { using CppType = HyperLogLog; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeHLL; - using ColumnType = vectorized::ColumnHLL; + using DataType = DataTypeHLL; + using ColumnType = ColumnHLL; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::JsonbField; + using CppType = JsonbField; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeJsonb; - using ColumnType = vectorized::ColumnString; + using DataType = DataTypeJsonb; + using ColumnType = ColumnString; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::Array; + using CppType = Array; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeArray; - using ColumnType = vectorized::ColumnArray; + using DataType = DataTypeArray; + using ColumnType = ColumnArray; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::Map; + using CppType = Map; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeMap; - using ColumnType = vectorized::ColumnMap; + using DataType = DataTypeMap; + using ColumnType = ColumnMap; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::Tuple; + using CppType = Tuple; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeStruct; - using ColumnType = vectorized::ColumnStruct; + using DataType = DataTypeStruct; + using ColumnType = ColumnStruct; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::VariantMap; + using CppType = VariantMap; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeVariant; - using ColumnType = vectorized::ColumnVariant; + using DataType = DataTypeVariant; + using ColumnType = ColumnVariant; }; template <> struct PrimitiveTypeTraits { using CppType = BitmapValue; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeBitMap; - using ColumnType = vectorized::ColumnBitmap; + using DataType = DataTypeBitMap; + using ColumnType = ColumnBitmap; }; template <> struct PrimitiveTypeTraits { using CppType = QuantileState; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeQuantileState; - using ColumnType = vectorized::ColumnQuantileState; + using DataType = DataTypeQuantileState; + using ColumnType = ColumnQuantileState; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::UInt32; + using CppType = UInt32; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeNothing; - using ColumnType = vectorized::ColumnOffset32; + using DataType = DataTypeNothing; + using ColumnType = ColumnOffset32; }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::UInt64; + using CppType = UInt64; using StorageFieldType = CppType; - using DataType = vectorized::DataTypeNothing; - using ColumnType = vectorized::ColumnOffset64; + using DataType = DataTypeNothing; + using ColumnType = ColumnOffset64; }; template @@ -583,5 +581,19 @@ struct PrimitiveTypeConvertor { } }; +inline TTypeDesc create_type_desc(PrimitiveType type, int precision = 0, int scale = 0) { + TTypeDesc type_desc; + std::vector node_type; + node_type.emplace_back(); + TScalarType scalarType; + scalarType.__set_type(to_thrift(type)); + scalarType.__set_len(-1); + scalarType.__set_precision(precision); + scalarType.__set_scale(scale); + node_type.back().__set_scalar_type(scalarType); + type_desc.__set_types(node_type); + return type_desc; +} + #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/vec/data_types/serde/complex_type_deserialize_util.h b/be/src/core/data_type_serde/complex_type_deserialize_util.h similarity index 96% rename from be/src/vec/data_types/serde/complex_type_deserialize_util.h rename to be/src/core/data_type_serde/complex_type_deserialize_util.h index c1e0e01716ebc7..20f49636c769b1 100644 --- a/be/src/vec/data_types/serde/complex_type_deserialize_util.h +++ b/be/src/core/data_type_serde/complex_type_deserialize_util.h @@ -15,10 +15,10 @@ // specific language governing permissions and limitations // under the License. -#include "vec/common/string_ref.h" -#include "vec/data_types/serde/data_type_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/string_ref.h" -namespace doris::vectorized { +namespace doris { struct ComplexTypeDeserializeUtil { // SplitResult is used to store the result of splitting a string by a delimiter. @@ -103,4 +103,4 @@ struct ComplexTypeDeserializeUtil { } }; -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/data_types/serde/data_type_array_serde.cpp b/be/src/core/data_type_serde/data_type_array_serde.cpp similarity index 97% rename from be/src/vec/data_types/serde/data_type_array_serde.cpp rename to be/src/core/data_type_serde/data_type_array_serde.cpp index 12bb264705bf18..14a88813a56a6b 100644 --- a/be/src/vec/data_types/serde/data_type_array_serde.cpp +++ b/be/src/core/data_type_serde/data_type_array_serde.cpp @@ -15,24 +15,24 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_array_serde.h" +#include "core/data_type_serde/data_type_array_serde.h" #include #include "common/status.h" -#include "complex_type_deserialize_util.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_array.h" +#include "core/column/column_const.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type_serde/complex_type_deserialize_util.h" +#include "core/string_ref.h" +#include "exprs/function/function_helpers.h" #include "util/jsonb_document.h" #include "util/jsonb_writer.h" -#include "vec/columns/column.h" -#include "vec/columns/column_array.h" -#include "vec/columns/column_const.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_ref.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_array.h" -#include "vec/functions/function_helpers.h" - -namespace doris::vectorized { + +namespace doris { class Arena; #include "common/compile_check_begin.h" @@ -357,7 +357,7 @@ Status DataTypeArraySerDe::write_column_to_mysql_binary(const IColumn& column, Status DataTypeArraySerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, int64_t start, - int64_t end, vectorized::Arena& arena, + int64_t end, Arena& arena, const FormatOptions& options) const { auto* cur_batch = dynamic_cast(orc_col_batch); cur_batch->offsets[0] = 0; @@ -582,4 +582,4 @@ bool DataTypeArraySerDe::write_column_to_hive_text(const IColumn& column, Buffer return true; } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_array_serde.h b/be/src/core/data_type_serde/data_type_array_serde.h similarity index 97% rename from be/src/vec/data_types/serde/data_type_array_serde.h rename to be/src/core/data_type_serde/data_type_array_serde.h index 91d00577839d07..2fcb7f3c9c4a7e 100644 --- a/be/src/vec/data_types/serde/data_type_array_serde.h +++ b/be/src/core/data_type_serde/data_type_array_serde.h @@ -25,14 +25,13 @@ #include #include "common/status.h" -#include "data_type_serde.h" +#include "core/data_type_serde/data_type_serde.h" namespace doris { class PValues; struct JsonbValue; class JsonWriter; -namespace vectorized { class IColumn; class Arena; class IDataType; @@ -103,7 +102,7 @@ class DataTypeArraySerDe : public DataTypeSerDe { Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override; Status serialize_column_to_jsonb(const IColumn& from_column, int64_t row_num, @@ -136,5 +135,4 @@ class DataTypeArraySerDe : public DataTypeSerDe { DataTypeSerDeSPtr nested_serde; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_bitmap_serde.cpp b/be/src/core/data_type_serde/data_type_bitmap_serde.cpp similarity index 96% rename from be/src/vec/data_types/serde/data_type_bitmap_serde.cpp rename to be/src/core/data_type_serde/data_type_bitmap_serde.cpp index 646652bfe31928..fbd1b470398ae1 100644 --- a/be/src/vec/data_types/serde/data_type_bitmap_serde.cpp +++ b/be/src/core/data_type_serde/data_type_bitmap_serde.cpp @@ -15,25 +15,24 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_bitmap_serde.h" +#include "core/data_type_serde/data_type_bitmap_serde.h" #include #include #include -#include "util/bitmap_value.h" +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/column/column_complex.h" +#include "core/column/column_const.h" +#include "core/data_type_serde/data_type_nullable_serde.h" +#include "core/value/bitmap_value.h" #include "util/jsonb_document.h" #include "util/jsonb_writer.h" -#include "vec/columns/column_complex.h" -#include "vec/columns/column_const.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/data_types/serde/data_type_nullable_serde.h" namespace doris { -namespace vectorized { class IColumn; #include "common/compile_check_begin.h" @@ -176,8 +175,7 @@ bool DataTypeBitMapSerDe::write_column_to_mysql_text(const IColumn& column, Buff Status DataTypeBitMapSerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, - vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const { auto& col_data = assert_cast(column); orc::StringVectorBatch* cur_batch = dynamic_cast(orc_col_batch); @@ -244,5 +242,4 @@ void DataTypeBitMapSerDe::to_string(const IColumn& column, size_t row_num, Buffe bw.write(buffer.c_str(), buffer.size()); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_bitmap_serde.h b/be/src/core/data_type_serde/data_type_bitmap_serde.h similarity index 96% rename from be/src/vec/data_types/serde/data_type_bitmap_serde.h rename to be/src/core/data_type_serde/data_type_bitmap_serde.h index a8b388b1ac6b64..49ed3cd875e9d2 100644 --- a/be/src/vec/data_types/serde/data_type_bitmap_serde.h +++ b/be/src/core/data_type_serde/data_type_bitmap_serde.h @@ -20,13 +20,12 @@ #include #include "common/status.h" -#include "data_type_serde.h" +#include "core/data_type_serde/data_type_serde.h" namespace doris { class PValues; struct JsonbValue; -namespace vectorized { class IColumn; class Arena; @@ -83,11 +82,10 @@ class DataTypeBitMapSerDe : public DataTypeSerDe { Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override; void to_string(const IColumn& column, size_t row_num, BufferWritable& bw, const FormatOptions& options) const override; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_date_or_datetime_serde.cpp b/be/src/core/data_type_serde/data_type_date_or_datetime_serde.cpp similarity index 98% rename from be/src/vec/data_types/serde/data_type_date_or_datetime_serde.cpp rename to be/src/core/data_type_serde/data_type_date_or_datetime_serde.cpp index bb7dc212b18aba..8c055c22626a31 100644 --- a/be/src/vec/data_types/serde/data_type_date_or_datetime_serde.cpp +++ b/be/src/core/data_type_serde/data_type_date_or_datetime_serde.cpp @@ -15,21 +15,21 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_date_or_datetime_serde.h" +#include "core/data_type_serde/data_type_date_or_datetime_serde.h" #include #include #include "common/status.h" -#include "vec/columns/column_const.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/data_types/data_type_number.h" -#include "vec/functions/cast/cast_base.h" -#include "vec/functions/cast/cast_to_date_or_datetime_impl.hpp" -#include "vec/io/io_helper.h" -#include "vec/runtime/vdatetime_value.h" - -namespace doris::vectorized { +#include "core/column/column_const.h" +#include "core/data_type/data_type_decimal.h" +#include "core/data_type/data_type_number.h" +#include "core/value/vdatetime_value.h" +#include "exprs/function/cast/cast_base.h" +#include "exprs/function/cast/cast_to_date_or_datetime_impl.hpp" +#include "util/io_helper.h" + +namespace doris { #include "common/compile_check_begin.h" template @@ -266,8 +266,7 @@ template Status DataTypeDateSerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, - vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const { const auto& col_data = assert_cast&>(column).get_data(); auto* cur_batch = dynamic_cast(orc_col_batch); @@ -578,7 +577,7 @@ Status DataTypeDateSerDe::from_decimal_strict_mode_batch( } template -std::string DataTypeDateSerDe::to_olap_string(const vectorized::Field& field) const { +std::string DataTypeDateSerDe::to_olap_string(const Field& field) const { char buf[64]; char* pos = field.get().to_string(buf); return std::string(buf, pos - buf - 1); @@ -689,4 +688,4 @@ DataTypeDateSerDe::from_decimal_strict_mode_batch::from_decimal_strict_mode_batch( const DataTypeDecimal256::ColumnType& decimal_col, IColumn& target_col) const; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_date_or_datetime_serde.h b/be/src/core/data_type_serde/data_type_date_or_datetime_serde.h similarity index 94% rename from be/src/vec/data_types/serde/data_type_date_or_datetime_serde.h rename to be/src/core/data_type_serde/data_type_date_or_datetime_serde.h index b68146e71551af..c28677b117f699 100644 --- a/be/src/vec/data_types/serde/data_type_date_or_datetime_serde.h +++ b/be/src/core/data_type_serde/data_type_date_or_datetime_serde.h @@ -25,14 +25,14 @@ #include #include "common/status.h" -#include "data_type_number_serde.h" -#include "runtime/primitive_type.h" -#include "vec/columns/column.h" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" -#include "vec/data_types/serde/data_type_serde.h" - -namespace doris::vectorized { +#include "core/column/column.h" +#include "core/data_type/primitive_type.h" +#include "core/data_type_serde/data_type_number_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/string_ref.h" +#include "core/types.h" + +namespace doris { class Arena; template @@ -113,10 +113,10 @@ class DataTypeDateSerDe : public DataTypeNumberSerDe { Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override; - std::string to_olap_string(const vectorized::Field& field) const override; + std::string to_olap_string(const Field& field) const override; protected: template @@ -145,4 +145,4 @@ class DataTypeDateTimeSerDe : public DataTypeDateSerDe #include @@ -24,15 +24,15 @@ #include #include "common/status.h" -#include "runtime/primitive_type.h" -#include "vec/columns/column_const.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/data_types/data_type_number.h" -#include "vec/functions/cast/cast_to_datetimev2_impl.hpp" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/io/io_helper.h" -#include "vec/runtime/vdatetime_value.h" +#include "core/column/column_const.h" +#include "core/data_type/data_type_decimal.h" +#include "core/data_type/data_type_number.h" +#include "core/data_type/primitive_type.h" +#include "core/types.h" +#include "core/value/vdatetime_value.h" +#include "exprs/function/cast/cast_to_datetimev2_impl.hpp" +#include "exprs/function/cast/cast_to_string.h" +#include "util/io_helper.h" enum { DIVISOR_FOR_SECOND = 1, @@ -41,7 +41,7 @@ enum { DIVISOR_FOR_NANO = 1000000000 }; -namespace doris::vectorized { +namespace doris { static const int64_t micro_to_nano_second = 1000; #include "common/compile_check_begin.h" @@ -445,7 +445,7 @@ Status DataTypeDateTimeV2SerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, int64_t start, int64_t end, - vectorized::Arena& arena, + Arena& arena, const FormatOptions& options) const { const auto& col_data = assert_cast(column).get_data(); auto* cur_batch = dynamic_cast(orc_col_batch); @@ -580,4 +580,4 @@ template Status DataTypeDateTimeV2SerDe::from_decimal_strict_mode_batch( const DataTypeDecimal256::ColumnType& decimal_col, IColumn& target_col) const; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_datetimev2_serde.h b/be/src/core/data_type_serde/data_type_datetimev2_serde.h similarity index 93% rename from be/src/vec/data_types/serde/data_type_datetimev2_serde.h rename to be/src/core/data_type_serde/data_type_datetimev2_serde.h index b23d4422027d87..22f6d072428265 100644 --- a/be/src/vec/data_types/serde/data_type_datetimev2_serde.h +++ b/be/src/core/data_type_serde/data_type_datetimev2_serde.h @@ -24,13 +24,13 @@ #include #include "common/status.h" -#include "data_type_number_serde.h" -#include "vec/columns/column.h" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" -#include "vec/runtime/vdatetime_value.h" +#include "core/column/column.h" +#include "core/data_type_serde/data_type_number_serde.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "core/value/vdatetime_value.h" -namespace doris::vectorized { +namespace doris { class Arena; class DataTypeDateTimeV2SerDe : public DataTypeNumberSerDe { @@ -98,7 +98,7 @@ class DataTypeDateTimeV2SerDe : public DataTypeNumberSerDe #include @@ -23,17 +23,17 @@ #include -#include "runtime/define_primitive_type.h" -#include "vec/columns/column_const.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/data_types/data_type_number.h" -#include "vec/functions/cast/cast_to_datev2_impl.hpp" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/io/io_helper.h" -#include "vec/runtime/vdatetime_value.h" +#include "core/column/column_const.h" +#include "core/data_type/data_type_decimal.h" +#include "core/data_type/data_type_number.h" +#include "core/data_type/define_primitive_type.h" +#include "core/types.h" +#include "core/value/vdatetime_value.h" +#include "exprs/function/cast/cast_to_datev2_impl.hpp" +#include "exprs/function/cast/cast_to_string.h" +#include "util/io_helper.h" -namespace doris::vectorized { +namespace doris { // This number represents the number of days from 0000-01-01 to 1970-01-01 static const int32_t date_threshold = 719528; @@ -142,8 +142,7 @@ Status DataTypeDateV2SerDe::write_column_to_mysql_binary(const IColumn& column, Status DataTypeDateV2SerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, - vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const { const auto& col_data = assert_cast(column).get_data(); auto* cur_batch = dynamic_cast(orc_col_batch); @@ -442,7 +441,7 @@ Status DataTypeDateV2SerDe::from_decimal_strict_mode_batch( return Status::OK(); } -std::string DataTypeDateV2SerDe::to_olap_string(const vectorized::Field& field) const { +std::string DataTypeDateV2SerDe::to_olap_string(const Field& field) const { return CastToString::from_datev2(field.get()); } // NOLINTEND(readability-function-cognitive-complexity) @@ -498,4 +497,4 @@ template Status DataTypeDateV2SerDe::from_decimal_strict_mode_batch( const DataTypeDecimal256::ColumnType& decimal_col, IColumn& target_col) const; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_datev2_serde.h b/be/src/core/data_type_serde/data_type_datev2_serde.h similarity index 93% rename from be/src/vec/data_types/serde/data_type_datev2_serde.h rename to be/src/core/data_type_serde/data_type_datev2_serde.h index 08ec3ac5749234..0a33c51c806685 100644 --- a/be/src/vec/data_types/serde/data_type_datev2_serde.h +++ b/be/src/core/data_type_serde/data_type_datev2_serde.h @@ -24,12 +24,12 @@ #include #include "common/status.h" -#include "data_type_number_serde.h" -#include "vec/columns/column.h" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" +#include "core/column/column.h" +#include "core/data_type_serde/data_type_number_serde.h" +#include "core/string_ref.h" +#include "core/types.h" -namespace doris::vectorized { +namespace doris { class Arena; class DataTypeDateV2SerDe : public DataTypeNumberSerDe { @@ -95,7 +95,7 @@ class DataTypeDateV2SerDe : public DataTypeNumberSerDe #include @@ -26,22 +26,22 @@ #include "arrow/type.h" #include "common/consts.h" -#include "olap/tablet_schema.h" +#include "core/column/column.h" +#include "core/column/column_decimal.h" +#include "core/data_type/data_type_decimal.h" +#include "core/data_type/define_primitive_type.h" +#include "core/types.h" +#include "exec/common/arithmetic_overflow.h" +#include "exprs/function/cast/cast_to_decimal.h" +#include "exprs/function/cast/cast_to_string.h" #include "orc/Int128.hh" -#include "runtime/define_primitive_type.h" +#include "storage/tablet/tablet_schema.h" +#include "util/io_helper.h" #include "util/jsonb_document.h" #include "util/jsonb_document_cast.h" #include "util/jsonb_writer.h" -#include "vec/columns/column.h" -#include "vec/columns/column_decimal.h" -#include "vec/common/arithmetic_overflow.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/functions/cast/cast_to_decimal.h" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/io/io_helper.h" - -namespace doris::vectorized { + +namespace doris { // #include "common/compile_check_begin.h" template @@ -326,8 +326,7 @@ Status DataTypeDecimalSerDe::read_column_from_arrow(IColumn& column, const auto arrow_scale = arrow_decimal_type->scale(); // TODO check precision for (auto value_i = start; value_i < end; ++value_i) { - auto value = *reinterpret_cast( - concrete_array->Value(value_i)); + auto value = *reinterpret_cast(concrete_array->Value(value_i)); // convert scale to 9; if (9 > arrow_scale) { using MaxNativeType = typename Decimal128V2::NativeType; @@ -395,8 +394,7 @@ template Status DataTypeDecimalSerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, - vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const { if constexpr (T == TYPE_DECIMAL256) { return Status::NotSupported("write_column_to_orc with type " + column.get_name()); @@ -503,7 +501,7 @@ void DataTypeDecimalSerDe::to_string(const IColumn& column, size_t row_num, B } template -std::string DataTypeDecimalSerDe::to_olap_string(const vectorized::Field& field) const { +std::string DataTypeDecimalSerDe::to_olap_string(const Field& field) const { auto value = field.get(); if constexpr (T == TYPE_DECIMALV2) { decimal12_t decimal_val(value.int_value(), value.frac_value()); @@ -743,4 +741,4 @@ template class DataTypeDecimalSerDe; template class DataTypeDecimalSerDe; template class DataTypeDecimalSerDe; template class DataTypeDecimalSerDe; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_decimal_serde.h b/be/src/core/data_type_serde/data_type_decimal_serde.h similarity index 95% rename from be/src/vec/data_types/serde/data_type_decimal_serde.h rename to be/src/core/data_type_serde/data_type_decimal_serde.h index f466e193339a38..61349fa6eeff4d 100644 --- a/be/src/vec/data_types/serde/data_type_decimal_serde.h +++ b/be/src/core/data_type_serde/data_type_decimal_serde.h @@ -23,16 +23,15 @@ #include #include "common/status.h" -#include "data_type_serde.h" -#include "runtime/define_primitive_type.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/string_ref.h" +#include "core/types.h" namespace doris { -namespace vectorized { template class ColumnDecimal; class Arena; @@ -118,7 +117,7 @@ class DataTypeDecimalSerDe : public DataTypeSerDe { Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override; Status deserialize_column_from_fixed_json(IColumn& column, Slice& slice, uint64_t rows, @@ -133,7 +132,7 @@ class DataTypeDecimalSerDe : public DataTypeSerDe { void to_string(const IColumn& column, size_t row_num, BufferWritable& bw, const FormatOptions& options) const override; - std::string to_olap_string(const vectorized::Field& field) const override; + std::string to_olap_string(const Field& field) const override; void to_string_batch(const IColumn& column, ColumnString& column_to, const FormatOptions& options) const override; @@ -188,5 +187,4 @@ Status DataTypeDecimalSerDe::read_column_from_pb(IColumn& column, const PValu } #include "common/compile_check_end.h" -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_hll_serde.cpp b/be/src/core/data_type_serde/data_type_hll_serde.cpp similarity index 96% rename from be/src/vec/data_types/serde/data_type_hll_serde.cpp rename to be/src/core/data_type_serde/data_type_hll_serde.cpp index da65705224ee09..a90a5f44d70f18 100644 --- a/be/src/vec/data_types/serde/data_type_hll_serde.cpp +++ b/be/src/core/data_type_serde/data_type_hll_serde.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_hll_serde.h" +#include "core/data_type_serde/data_type_hll_serde.h" #include #include @@ -25,19 +25,18 @@ #include #include "arrow/array/builder_binary.h" -#include "olap/hll.h" +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/column/column_complex.h" +#include "core/column/column_const.h" +#include "core/data_type_serde/data_type_nullable_serde.h" +#include "core/value/hll.h" #include "util/jsonb_document.h" #include "util/jsonb_writer.h" #include "util/slice.h" -#include "vec/columns/column_complex.h" -#include "vec/columns/column_const.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/data_types/serde/data_type_nullable_serde.h" namespace doris { -namespace vectorized { class IColumn; #include "common/compile_check_begin.h" @@ -173,7 +172,7 @@ bool DataTypeHLLSerDe::write_column_to_mysql_text(const IColumn& column, BufferW Status DataTypeHLLSerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, int64_t start, - int64_t end, vectorized::Arena& arena, + int64_t end, Arena& arena, const FormatOptions& options) const { auto& col_data = assert_cast(column); orc::StringVectorBatch* cur_batch = dynamic_cast(orc_col_batch); @@ -236,5 +235,4 @@ void DataTypeHLLSerDe::to_string(const IColumn& column, size_t row_num, BufferWr bw.write(result.c_str(), result.size()); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_hll_serde.h b/be/src/core/data_type_serde/data_type_hll_serde.h similarity index 96% rename from be/src/vec/data_types/serde/data_type_hll_serde.h rename to be/src/core/data_type_serde/data_type_hll_serde.h index d39cece675d182..96b5b083da7fae 100644 --- a/be/src/vec/data_types/serde/data_type_hll_serde.h +++ b/be/src/core/data_type_serde/data_type_hll_serde.h @@ -20,13 +20,12 @@ #include #include "common/status.h" -#include "data_type_serde.h" +#include "core/data_type_serde/data_type_serde.h" namespace doris { class PValues; struct JsonbValue; -namespace vectorized { class IColumn; class Arena; @@ -78,11 +77,10 @@ class DataTypeHLLSerDe : public DataTypeSerDe { Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override; void to_string(const IColumn& column, size_t row_num, BufferWritable& bw, const FormatOptions& options) const override; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_ipv4_serde.cpp b/be/src/core/data_type_serde/data_type_ipv4_serde.cpp similarity index 96% rename from be/src/vec/data_types/serde/data_type_ipv4_serde.cpp rename to be/src/core/data_type_serde/data_type_ipv4_serde.cpp index cf58a2b319a165..d5b4813c1f372f 100644 --- a/be/src/vec/data_types/serde/data_type_ipv4_serde.cpp +++ b/be/src/core/data_type_serde/data_type_ipv4_serde.cpp @@ -15,17 +15,17 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_ipv4_serde.h" +#include "core/data_type_serde/data_type_ipv4_serde.h" #include -#include "vec/columns/column_const.h" -#include "vec/core/types.h" -#include "vec/functions/cast/cast_to_ip.h" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/io/io_helper.h" +#include "core/column/column_const.h" +#include "core/types.h" +#include "exprs/function/cast/cast_to_ip.h" +#include "exprs/function/cast/cast_to_string.h" +#include "util/io_helper.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" Status DataTypeIPv4SerDe::write_column_to_mysql_binary(const IColumn& column, @@ -222,8 +222,8 @@ void DataTypeIPv4SerDe::write_one_cell_to_binary(const IColumn& src_column, memcpy(chars.data() + old_size + sizeof(uint8_t), data_ref.data, data_ref.size); } -std::string DataTypeIPv4SerDe::to_olap_string(const vectorized::Field& field) const { +std::string DataTypeIPv4SerDe::to_olap_string(const Field& field) const { return CastToString::from_ip(field.get()); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_ipv4_serde.h b/be/src/core/data_type_serde/data_type_ipv4_serde.h similarity index 89% rename from be/src/vec/data_types/serde/data_type_ipv4_serde.h rename to be/src/core/data_type_serde/data_type_ipv4_serde.h index 16cacdc3381af3..a3ff4bf903627d 100644 --- a/be/src/vec/data_types/serde/data_type_ipv4_serde.h +++ b/be/src/core/data_type_serde/data_type_ipv4_serde.h @@ -25,15 +25,15 @@ #include #include "common/status.h" -#include "data_type_number_serde.h" -#include "olap/olap_common.h" -#include "vec/columns/column.h" -#include "vec/columns/column_vector.h" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" -#include "vec/runtime/ipv4_value.h" +#include "core/column/column.h" +#include "core/column/column_vector.h" +#include "core/data_type_serde/data_type_number_serde.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "core/value/ipv4_value.h" +#include "storage/olap_common.h" -namespace doris::vectorized { +namespace doris { class DataTypeIPv4SerDe : public DataTypeNumberSerDe { public: @@ -74,6 +74,6 @@ class DataTypeIPv4SerDe : public DataTypeNumberSerDe { void write_one_cell_to_binary(const IColumn& src_column, ColumnString::Chars& chars, int64_t row_num) const override; - std::string to_olap_string(const vectorized::Field& field) const override; + std::string to_olap_string(const Field& field) const override; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_ipv6_serde.cpp b/be/src/core/data_type_serde/data_type_ipv6_serde.cpp similarity index 96% rename from be/src/vec/data_types/serde/data_type_ipv6_serde.cpp rename to be/src/core/data_type_serde/data_type_ipv6_serde.cpp index 7d396424967546..f60dc892fbf489 100644 --- a/be/src/vec/data_types/serde/data_type_ipv6_serde.cpp +++ b/be/src/core/data_type_serde/data_type_ipv6_serde.cpp @@ -15,21 +15,21 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_ipv6_serde.h" +#include "core/data_type_serde/data_type_ipv6_serde.h" #include #include #include +#include "core/column/column_const.h" +#include "core/types.h" +#include "exprs/function/cast/cast_to_ip.h" +#include "exprs/function/cast/cast_to_string.h" +#include "util/io_helper.h" #include "util/jsonb_writer.h" -#include "vec/columns/column_const.h" -#include "vec/core/types.h" -#include "vec/functions/cast/cast_to_ip.h" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/io/io_helper.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" Status DataTypeIPv6SerDe::write_column_to_mysql_binary(const IColumn& column, @@ -175,7 +175,7 @@ Status DataTypeIPv6SerDe::read_column_from_arrow(IColumn& column, const arrow::A Status DataTypeIPv6SerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, int64_t start, - int64_t end, vectorized::Arena& arena, + int64_t end, Arena& arena, const FormatOptions& options) const { const auto& col_data = assert_cast(column).get_data(); auto* cur_batch = assert_cast(orc_col_batch); @@ -320,8 +320,8 @@ void DataTypeIPv6SerDe::write_one_cell_to_binary(const IColumn& src_column, memcpy(chars.data() + old_size + sizeof(uint8_t), data_ref.data, data_ref.size); } -std::string DataTypeIPv6SerDe::to_olap_string(const vectorized::Field& field) const { +std::string DataTypeIPv6SerDe::to_olap_string(const Field& field) const { return CastToString::from_ip(field.get()); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_ipv6_serde.h b/be/src/core/data_type_serde/data_type_ipv6_serde.h similarity index 89% rename from be/src/vec/data_types/serde/data_type_ipv6_serde.h rename to be/src/core/data_type_serde/data_type_ipv6_serde.h index 3cbc0e284ca752..20b6960e61dc9d 100644 --- a/be/src/vec/data_types/serde/data_type_ipv6_serde.h +++ b/be/src/core/data_type_serde/data_type_ipv6_serde.h @@ -25,17 +25,16 @@ #include #include "common/status.h" -#include "data_type_number_serde.h" -#include "olap/olap_common.h" -#include "vec/columns/column.h" -#include "vec/columns/column_vector.h" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" -#include "vec/runtime/ipv6_value.h" +#include "core/column/column.h" +#include "core/column/column_vector.h" +#include "core/data_type_serde/data_type_number_serde.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "core/value/ipv6_value.h" +#include "storage/olap_common.h" namespace doris { -namespace vectorized { class Arena; class DataTypeIPv6SerDe : public DataTypeNumberSerDe { @@ -55,7 +54,7 @@ class DataTypeIPv6SerDe : public DataTypeNumberSerDe { Status read_column_from_pb(IColumn& column, const PValues& arg) const override; Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override; Status write_column_to_arrow(const IColumn& column, const NullMap* null_map, arrow::ArrayBuilder* array_builder, int64_t start, int64_t end, @@ -85,7 +84,6 @@ class DataTypeIPv6SerDe : public DataTypeNumberSerDe { void write_one_cell_to_binary(const IColumn& src_column, ColumnString::Chars& chars, int64_t row_num) const override; - std::string to_olap_string(const vectorized::Field& field) const override; + std::string to_olap_string(const Field& field) const override; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_jsonb_serde.cpp b/be/src/core/data_type_serde/data_type_jsonb_serde.cpp similarity index 98% rename from be/src/vec/data_types/serde/data_type_jsonb_serde.cpp rename to be/src/core/data_type_serde/data_type_jsonb_serde.cpp index 5a658425f9d4b3..4b0c5b2e2c306e 100644 --- a/be/src/vec/data_types/serde/data_type_jsonb_serde.cpp +++ b/be/src/core/data_type_serde/data_type_jsonb_serde.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_jsonb_serde.h" +#include "core/data_type_serde/data_type_jsonb_serde.h" #include #include @@ -28,11 +28,10 @@ #include "arrow/array/builder_binary.h" #include "common/exception.h" #include "common/status.h" +#include "core/value/jsonb_value.h" #include "exprs/json_functions.h" -#include "runtime/jsonb_value.h" #include "util/jsonb_parser_simd.h" namespace doris { -namespace vectorized { #include "common/compile_check_begin.h" Status DataTypeJsonbSerDe::write_column_to_mysql_binary(const IColumn& column, @@ -193,7 +192,7 @@ Status DataTypeJsonbSerDe::read_column_from_arrow(IColumn& column, const arrow:: Status DataTypeJsonbSerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, int64_t start, - int64_t end, vectorized::Arena& arena, + int64_t end, Arena& arena, const FormatOptions& options) const { auto* cur_batch = dynamic_cast(orc_col_batch); const auto& string_column = assert_cast(column); @@ -442,5 +441,4 @@ bool DataTypeJsonbSerDe::write_column_to_presto_text(const IColumn& column, Buff return true; } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_jsonb_serde.h b/be/src/core/data_type_serde/data_type_jsonb_serde.h similarity index 94% rename from be/src/vec/data_types/serde/data_type_jsonb_serde.h rename to be/src/core/data_type_serde/data_type_jsonb_serde.h index 97c61eb85b8fdd..3a243a1c1a8187 100644 --- a/be/src/vec/data_types/serde/data_type_jsonb_serde.h +++ b/be/src/core/data_type_serde/data_type_jsonb_serde.h @@ -21,15 +21,14 @@ #include #include -#include "data_type_string_serde.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_string.h" -#include "vec/core/types.h" +#include "core/column/column_const.h" +#include "core/column/column_string.h" +#include "core/data_type_serde/data_type_string_serde.h" +#include "core/types.h" namespace doris { class JsonbOutStream; -namespace vectorized { class Arena; class DataTypeJsonbSerDe : public DataTypeStringSerDe { @@ -64,7 +63,7 @@ class DataTypeJsonbSerDe : public DataTypeStringSerDe { Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override; bool write_column_to_presto_text(const IColumn& column, BufferWritable& bw, int64_t row_idx, @@ -94,5 +93,4 @@ class DataTypeJsonbSerDe : public DataTypeStringSerDe { void convert_jsonb_to_rapidjson(const JsonbValue& val, rapidjson::Value& target, rapidjson::Document::AllocatorType& allocator); -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_map_serde.cpp b/be/src/core/data_type_serde/data_type_map_serde.cpp similarity index 98% rename from be/src/vec/data_types/serde/data_type_map_serde.cpp rename to be/src/core/data_type_serde/data_type_map_serde.cpp index 37937ef48cbd8b..44fbde623e7982 100644 --- a/be/src/vec/data_types/serde/data_type_map_serde.cpp +++ b/be/src/core/data_type_serde/data_type_map_serde.cpp @@ -15,22 +15,21 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_map_serde.h" +#include "core/data_type_serde/data_type_map_serde.h" #include "arrow/array/builder_nested.h" #include "common/exception.h" #include "common/status.h" -#include "complex_type_deserialize_util.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_map.h" +#include "core/data_type_serde/complex_type_deserialize_util.h" +#include "core/string_ref.h" #include "util/jsonb_document.h" #include "util/jsonb_writer.h" #include "util/simd/bits.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_map.h" -#include "vec/common/string_ref.h" namespace doris { -namespace vectorized { class Arena; #include "common/compile_check_begin.h" Status DataTypeMapSerDe::serialize_column_to_json(const IColumn& column, int64_t start_idx, @@ -429,7 +428,7 @@ Status DataTypeMapSerDe::write_column_to_mysql_binary(const IColumn& column, Status DataTypeMapSerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, int64_t start, - int64_t end, vectorized::Arena& arena, + int64_t end, Arena& arena, const FormatOptions& options) const { auto* cur_batch = dynamic_cast(orc_col_batch); cur_batch->offsets[0] = 0; @@ -687,5 +686,4 @@ bool DataTypeMapSerDe::write_column_to_hive_text(const IColumn& column, BufferWr return true; } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_map_serde.h b/be/src/core/data_type_serde/data_type_map_serde.h similarity index 97% rename from be/src/vec/data_types/serde/data_type_map_serde.h rename to be/src/core/data_type_serde/data_type_map_serde.h index bd1ad0cbbecc74..b4aa88f3cbec1f 100644 --- a/be/src/vec/data_types/serde/data_type_map_serde.h +++ b/be/src/core/data_type_serde/data_type_map_serde.h @@ -23,12 +23,11 @@ #include #include "common/status.h" -#include "data_type_serde.h" +#include "core/data_type_serde/data_type_serde.h" namespace doris { class PValues; -namespace vectorized { class IColumn; class Arena; #include "common/compile_check_begin.h" @@ -93,7 +92,7 @@ class DataTypeMapSerDe : public DataTypeSerDe { Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override; bool write_column_to_presto_text(const IColumn& column, BufferWritable& bw, int64_t row_idx, @@ -125,5 +124,4 @@ class DataTypeMapSerDe : public DataTypeSerDe { DataTypeSerDeSPtr value_serde; }; #include "common/compile_check_end.h" -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_nothing_serde.h b/be/src/core/data_type_serde/data_type_nothing_serde.h similarity index 96% rename from be/src/vec/data_types/serde/data_type_nothing_serde.h rename to be/src/core/data_type_serde/data_type_nothing_serde.h index e9c659e1d5f80b..1e164e85a9100f 100644 --- a/be/src/vec/data_types/serde/data_type_nothing_serde.h +++ b/be/src/core/data_type_serde/data_type_nothing_serde.h @@ -24,13 +24,12 @@ #include "common/exception.h" #include "common/status.h" -#include "data_type_serde.h" +#include "core/data_type_serde/data_type_serde.h" namespace doris { class PValues; struct JsonbValue; -namespace vectorized { class IColumn; class Arena; @@ -100,10 +99,9 @@ class DataTypeNothingSerde : public DataTypeSerDe { Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override { return Status::NotSupported("write_column_to_orc with type " + column.get_name()); } }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_nullable_serde.cpp b/be/src/core/data_type_serde/data_type_nullable_serde.cpp similarity index 97% rename from be/src/vec/data_types/serde/data_type_nullable_serde.cpp rename to be/src/core/data_type_serde/data_type_nullable_serde.cpp index cec9a4567aa4f7..175da193187896 100644 --- a/be/src/vec/data_types/serde/data_type_nullable_serde.cpp +++ b/be/src/core/data_type_serde/data_type_nullable_serde.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_nullable_serde.h" +#include "core/data_type_serde/data_type_nullable_serde.h" #include #include @@ -24,19 +24,19 @@ #include #include -#include "data_type_string_serde.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_nullable.h" +#include "core/column/column_vector.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/data_type_serde/data_type_string_serde.h" +#include "exprs/function/cast/cast_base.h" +#include "format/transformer/vcsv_transformer.h" #include "util/jsonb_document.h" #include "util/jsonb_writer.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/data_types/serde/data_type_serde.h" -#include "vec/functions/cast/cast_base.h" -#include "vec/runtime/vcsv_transformer.h" - -namespace doris::vectorized { + +namespace doris { class Arena; #include "common/compile_check_begin.h" Status DataTypeNullableSerDe::serialize_column_to_json(const IColumn& column, int64_t start_idx, @@ -427,8 +427,7 @@ Status DataTypeNullableSerDe::write_column_to_mysql_binary(const IColumn& column Status DataTypeNullableSerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, - vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const { const auto& column_nullable = assert_cast(column); orc_col_batch->hasNulls = true; @@ -476,7 +475,7 @@ void DataTypeNullableSerDe::to_string(const IColumn& column, size_t row_num, Buf } } -std::string DataTypeNullableSerDe::to_olap_string(const vectorized::Field& field) const { +std::string DataTypeNullableSerDe::to_olap_string(const Field& field) const { return nested_serde->to_olap_string(field); } @@ -515,4 +514,4 @@ Status DataTypeNullableSerDe::from_string_strict_mode(StringRef& str, IColumn& c null_column.get_null_map_data().push_back(0); return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_nullable_serde.h b/be/src/core/data_type_serde/data_type_nullable_serde.h similarity index 96% rename from be/src/vec/data_types/serde/data_type_nullable_serde.h rename to be/src/core/data_type_serde/data_type_nullable_serde.h index 6f885699824d3a..49d9d55f9f2275 100644 --- a/be/src/vec/data_types/serde/data_type_nullable_serde.h +++ b/be/src/core/data_type_serde/data_type_nullable_serde.h @@ -22,12 +22,11 @@ #include #include "common/status.h" -#include "data_type_serde.h" +#include "core/data_type_serde/data_type_serde.h" namespace doris { class PValues; -namespace vectorized { class IColumn; class Arena; #include "common/compile_check_begin.h" @@ -96,7 +95,7 @@ class DataTypeNullableSerDe : public DataTypeSerDe { Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override; bool write_column_to_presto_text(const IColumn& column, BufferWritable& bw, int64_t row_idx, @@ -126,11 +125,10 @@ class DataTypeNullableSerDe : public DataTypeSerDe { void to_string(const IColumn& column, size_t row_num, BufferWritable& bw, const FormatOptions& options) const override; - std::string to_olap_string(const vectorized::Field& field) const override; + std::string to_olap_string(const Field& field) const override; private: DataTypeSerDeSPtr nested_serde; }; #include "common/compile_check_end.h" -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_number_serde.cpp b/be/src/core/data_type_serde/data_type_number_serde.cpp similarity index 98% rename from be/src/vec/data_types/serde/data_type_number_serde.cpp rename to be/src/core/data_type_serde/data_type_number_serde.cpp index 2ea6e85caca87f..ac488d1a6ae9da 100644 --- a/be/src/vec/data_types/serde/data_type_number_serde.cpp +++ b/be/src/core/data_type_serde/data_type_number_serde.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_number_serde.h" +#include "core/data_type_serde/data_type_number_serde.h" #include @@ -23,25 +23,25 @@ #include "common/exception.h" #include "common/status.h" -#include "olap/olap_common.h" -#include "olap/types.h" -#include "runtime/define_primitive_type.h" -#include "runtime/primitive_type.h" +#include "core/column/column_nullable.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/types.h" +#include "core/value/timestamptz_value.h" +#include "exprs/function/cast/cast_to_basic_number_common.h" +#include "exprs/function/cast/cast_to_boolean.h" +#include "exprs/function/cast/cast_to_string.h" +#include "storage/olap_common.h" +#include "storage/types.h" +#include "util/io_helper.h" #include "util/jsonb_document.h" #include "util/jsonb_document_cast.h" #include "util/jsonb_writer.h" #include "util/mysql_global.h" #include "util/to_string.h" -#include "vec/columns/column_nullable.h" -#include "vec/core/types.h" -#include "vec/data_types/serde/data_type_serde.h" -#include "vec/functions/cast/cast_to_basic_number_common.h" -#include "vec/functions/cast/cast_to_boolean.h" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/io/io_helper.h" -#include "vec/runtime/timestamptz_value.h" - -namespace doris::vectorized { + +namespace doris { #include "common/compile_check_begin.h" // Type map的基本结构 template @@ -578,8 +578,7 @@ template Status DataTypeNumberSerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, - vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const { auto& col_data = assert_cast(column).get_data(); @@ -744,7 +743,7 @@ Status DataTypeNumberSerDe::from_string(StringRef& str, IColumn& column, } template -std::string DataTypeNumberSerDe::to_olap_string(const vectorized::Field& field) const { +std::string DataTypeNumberSerDe::to_olap_string(const Field& field) const { if constexpr (T == TYPE_BOOLEAN) { char buf[8] = {'\0'}; snprintf(buf, sizeof(buf), "%d", field.get()); @@ -1088,4 +1087,4 @@ template class DataTypeNumberSerDe; template class DataTypeNumberSerDe; template class DataTypeNumberSerDe; template class DataTypeNumberSerDe; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_number_serde.h b/be/src/core/data_type_serde/data_type_number_serde.h similarity index 96% rename from be/src/vec/data_types/serde/data_type_number_serde.h rename to be/src/core/data_type_serde/data_type_number_serde.h index 5ef5899a506265..2158919d11281f 100644 --- a/be/src/vec/data_types/serde/data_type_number_serde.h +++ b/be/src/core/data_type_serde/data_type_number_serde.h @@ -23,21 +23,20 @@ #include #include "common/status.h" -#include "data_type_serde.h" -#include "olap/olap_common.h" -#include "runtime/define_primitive_type.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_vector.h" -#include "vec/common/string_ref.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/field.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "storage/olap_common.h" namespace doris { class JsonbOutStream; #include "common/compile_check_begin.h" -namespace vectorized { class Arena; // special data type using, maybe has various serde actions, so use specific date serde @@ -127,7 +126,7 @@ class DataTypeNumberSerDe : public DataTypeSerDe { const FormatOptions& options) const override; Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override; void write_one_cell_to_binary(const IColumn& src_column, ColumnString::Chars& chars, @@ -144,7 +143,7 @@ class DataTypeNumberSerDe : public DataTypeSerDe { void to_string_batch(const IColumn& column, ColumnString& column_to, const FormatOptions& options) const override; - std::string to_olap_string(const vectorized::Field& field) const override; + std::string to_olap_string(const Field& field) const override; // will override in DateTime and Time virtual int get_scale() const { return 0; } @@ -313,5 +312,4 @@ Status DataTypeNumberSerDe::write_column_to_pb(const IColumn& column, PValues } #include "common/compile_check_end.h" -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_quantilestate_serde.cpp b/be/src/core/data_type_serde/data_type_quantilestate_serde.cpp similarity index 96% rename from be/src/vec/data_types/serde/data_type_quantilestate_serde.cpp rename to be/src/core/data_type_serde/data_type_quantilestate_serde.cpp index a8ef2b579cdea8..19a992101418d4 100644 --- a/be/src/vec/data_types/serde/data_type_quantilestate_serde.cpp +++ b/be/src/core/data_type_serde/data_type_quantilestate_serde.cpp @@ -15,11 +15,11 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_quantilestate_serde.h" +#include "core/data_type_serde/data_type_quantilestate_serde.h" #include "util/jsonb_writer.h" -namespace doris::vectorized { +namespace doris { Status DataTypeQuantileStateSerDe::from_olap_string(const std::string& str, Field& field, const FormatOptions& options) const { @@ -72,4 +72,4 @@ bool DataTypeQuantileStateSerDe::write_column_to_mysql_text(const IColumn& colum } } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_quantilestate_serde.h b/be/src/core/data_type_serde/data_type_quantilestate_serde.h similarity index 95% rename from be/src/vec/data_types/serde/data_type_quantilestate_serde.h rename to be/src/core/data_type_serde/data_type_quantilestate_serde.h index 9b75bf80a803de..858ef2adc72b1a 100644 --- a/be/src/vec/data_types/serde/data_type_quantilestate_serde.h +++ b/be/src/core/data_type_serde/data_type_quantilestate_serde.h @@ -23,19 +23,18 @@ #include #include "common/status.h" -#include "data_type_serde.h" -#include "util/quantile_state.h" +#include "core/arena.h" +#include "core/column/column.h" +#include "core/column/column_complex.h" +#include "core/column/column_const.h" +#include "core/data_type_serde/data_type_nullable_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/string_ref.h" +#include "core/value/quantile_state.h" #include "util/slice.h" -#include "vec/columns/column.h" -#include "vec/columns/column_complex.h" -#include "vec/columns/column_const.h" -#include "vec/common/arena.h" -#include "vec/common/string_ref.h" -#include "vec/data_types/serde/data_type_nullable_serde.h" namespace doris { -namespace vectorized { #include "common/compile_check_begin.h" class DataTypeQuantileStateSerDe : public DataTypeSerDe { public: @@ -140,7 +139,7 @@ class DataTypeQuantileStateSerDe : public DataTypeSerDe { Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override { auto& col_data = assert_cast(column); orc::StringVectorBatch* cur_batch = dynamic_cast(orc_col_batch); @@ -192,5 +191,4 @@ class DataTypeQuantileStateSerDe : public DataTypeSerDe { } }; #include "common/compile_check_end.h" -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_serde.cpp b/be/src/core/data_type_serde/data_type_serde.cpp similarity index 95% rename from be/src/vec/data_types/serde/data_type_serde.cpp rename to be/src/core/data_type_serde/data_type_serde.cpp index e6bf7a7053e7f3..5fa8fa2fab8a10 100644 --- a/be/src/vec/data_types/serde/data_type_serde.cpp +++ b/be/src/core/data_type_serde/data_type_serde.cpp @@ -14,25 +14,24 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -#include "data_type_serde.h" +#include "core/data_type_serde/data_type_serde.h" #include "common/cast_set.h" #include "common/exception.h" #include "common/status.h" +#include "core/column/column.h" +#include "core/data_type/data_type.h" +#include "core/data_type_serde/data_type_array_serde.h" +#include "core/data_type_serde/data_type_decimal_serde.h" +#include "core/data_type_serde/data_type_jsonb_serde.h" +#include "core/data_type_serde/data_type_number_serde.h" +#include "core/data_type_serde/data_type_string_serde.h" +#include "core/field.h" +#include "exprs/function/cast/cast_base.h" #include "runtime/descriptors.h" #include "util/jsonb_document.h" #include "util/jsonb_writer.h" -#include "vec/columns/column.h" -#include "vec/core/field.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/serde/data_type_array_serde.h" -#include "vec/data_types/serde/data_type_decimal_serde.h" -#include "vec/data_types/serde/data_type_jsonb_serde.h" -#include "vec/data_types/serde/data_type_number_serde.h" -#include "vec/data_types/serde/data_type_string_serde.h" -#include "vec/functions/cast/cast_base.h" namespace doris { -namespace vectorized { #include "common/compile_check_begin.h" DataTypeSerDe::~DataTypeSerDe() = default; @@ -137,7 +136,7 @@ void DataTypeSerDe::to_string(const IColumn& column, size_t row_num, BufferWrita "Data type {} to_string_batch not implement.", get_name()); } -std::string DataTypeSerDe::to_olap_string(const vectorized::Field& value) const { +std::string DataTypeSerDe::to_olap_string(const Field& value) const { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, "Data type {} to_olap_string not implement.", get_name()); return ""; @@ -292,5 +291,4 @@ const uint8_t* DataTypeSerDe::deserialize_binary_to_field(const uint8_t* data, F return end; } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_serde.h b/be/src/core/data_type_serde/data_type_serde.h similarity index 98% rename from be/src/vec/data_types/serde/data_type_serde.h rename to be/src/core/data_type_serde/data_type_serde.h index 710a6fba10c432..1f9ac312ccea17 100644 --- a/be/src/vec/data_types/serde/data_type_serde.h +++ b/be/src/core/data_type_serde/data_type_serde.h @@ -26,12 +26,12 @@ #include "arrow/status.h" #include "common/cast_set.h" #include "common/status.h" +#include "core/column/column_nullable.h" +#include "core/field.h" +#include "core/string_buffer.hpp" +#include "core/types.h" #include "util/jsonb_document.h" #include "util/mysql_row_buffer.h" -#include "vec/columns/column_nullable.h" -#include "vec/common/string_buffer.hpp" -#include "vec/core/field.h" -#include "vec/core/types.h" namespace arrow { class ArrayBuilder; @@ -84,7 +84,6 @@ class JsonbWriterT; using JsonbWriter = JsonbWriterT; #include "common/compile_check_begin.h" -namespace vectorized { class IColumn; class Arena; class IDataType; @@ -300,7 +299,7 @@ class DataTypeSerDe { virtual void to_string(const IColumn& column, size_t row_num, BufferWritable& bw, const FormatOptions& options) const; - virtual std::string to_olap_string(const vectorized::Field& field) const; + virtual std::string to_olap_string(const Field& field) const; // All types can override this function // When this function is called, column should be of the corresponding type @@ -476,7 +475,7 @@ class DataTypeSerDe { virtual Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, int64_t start, - int64_t end, vectorized::Arena& arena, + int64_t end, Arena& arena, const FormatOptions& options) const = 0; // ORC deserializer @@ -555,5 +554,4 @@ DataTypeSerDeSPtrs create_data_type_serdes( const std::vector>& types); DataTypeSerDeSPtrs create_data_type_serdes(const std::vector& slots); #include "common/compile_check_end.h" -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_string_serde.cpp b/be/src/core/data_type_serde/data_type_string_serde.cpp similarity index 98% rename from be/src/vec/data_types/serde/data_type_string_serde.cpp rename to be/src/core/data_type_serde/data_type_string_serde.cpp index f73a6bdc2247eb..f746672188332b 100644 --- a/be/src/vec/data_types/serde/data_type_string_serde.cpp +++ b/be/src/core/data_type_serde/data_type_string_serde.cpp @@ -15,15 +15,15 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_string_serde.h" +#include "core/data_type_serde/data_type_string_serde.h" -#include "runtime/define_primitive_type.h" +#include "core/column/column_string.h" +#include "core/data_type/define_primitive_type.h" #include "util/jsonb_document_cast.h" #include "util/jsonb_utils.h" #include "util/jsonb_writer.h" -#include "vec/columns/column_string.h" -namespace doris::vectorized { +namespace doris { template Status DataTypeStringSerDeBase::serialize_column_to_json(const IColumn& column, @@ -317,7 +317,7 @@ Status DataTypeStringSerDeBase::read_column_from_arrow( template Status DataTypeStringSerDeBase::write_column_to_orc( const std::string& timezone, const IColumn& column, const NullMap* null_map, - orc::ColumnVectorBatch* orc_col_batch, int64_t start, int64_t end, vectorized::Arena& arena, + orc::ColumnVectorBatch* orc_col_batch, int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const { auto* cur_batch = dynamic_cast(orc_col_batch); @@ -436,8 +436,7 @@ void DataTypeStringSerDeBase::to_string(const IColumn& column, size_ } template -std::string DataTypeStringSerDeBase::to_olap_string( - const vectorized::Field& field) const { +std::string DataTypeStringSerDeBase::to_olap_string(const Field& field) const { return field.get(); } @@ -477,4 +476,4 @@ template class DataTypeStringSerDeBase; template class DataTypeStringSerDeBase; template class DataTypeStringSerDeBase; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_string_serde.h b/be/src/core/data_type_serde/data_type_string_serde.h similarity index 96% rename from be/src/vec/data_types/serde/data_type_string_serde.h rename to be/src/core/data_type_serde/data_type_string_serde.h index 9c68cc61d7efe2..c6c0438369c7cb 100644 --- a/be/src/vec/data_types/serde/data_type_string_serde.h +++ b/be/src/core/data_type_serde/data_type_string_serde.h @@ -23,17 +23,16 @@ #include #include "common/status.h" -#include "data_type_serde.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_fixed_length_object.h" -#include "vec/columns/column_string.h" -#include "vec/core/types.h" +#include "core/column/column_const.h" +#include "core/column/column_fixed_length_object.h" +#include "core/column/column_string.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/types.h" namespace doris { class PValues; struct JsonbValue; -namespace vectorized { class IColumn; class Arena; #include "common/compile_check_begin.h" @@ -218,7 +217,7 @@ class DataTypeStringSerDeBase : public DataTypeSerDe { Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override; bool write_column_to_presto_text(const IColumn& column, BufferWritable& bw, int64_t row_idx, @@ -264,7 +263,7 @@ class DataTypeStringSerDeBase : public DataTypeSerDe { void to_string(const IColumn& column, size_t row_num, BufferWritable& bw, const FormatOptions& options) const override; - std::string to_olap_string(const vectorized::Field& field) const override; + std::string to_olap_string(const Field& field) const override; private: const PrimitiveType _type; @@ -274,5 +273,4 @@ class DataTypeStringSerDeBase : public DataTypeSerDe { using DataTypeStringSerDe = DataTypeStringSerDeBase; using DataTypeFixedLengthObjectSerDe = DataTypeStringSerDeBase; #include "common/compile_check_end.h" -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_struct_serde.cpp b/be/src/core/data_type_serde/data_type_struct_serde.cpp similarity index 98% rename from be/src/vec/data_types/serde/data_type_struct_serde.cpp rename to be/src/core/data_type_serde/data_type_struct_serde.cpp index 9a52e6033b1835..55a215ca1e9db8 100644 --- a/be/src/vec/data_types/serde/data_type_struct_serde.cpp +++ b/be/src/core/data_type_serde/data_type_struct_serde.cpp @@ -15,22 +15,21 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_struct_serde.h" +#include "core/data_type_serde/data_type_struct_serde.h" #include "arrow/array/builder_nested.h" #include "common/status.h" -#include "complex_type_deserialize_util.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_struct.h" +#include "core/data_type_serde/complex_type_deserialize_util.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/string_ref.h" #include "util/jsonb_document.h" #include "util/jsonb_writer.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_struct.h" -#include "vec/common/string_ref.h" -#include "vec/data_types/serde/data_type_serde.h" namespace doris { -namespace vectorized { class Arena; #include "common/compile_check_begin.h" @@ -439,8 +438,7 @@ Status DataTypeStructSerDe::write_column_to_mysql_binary(const IColumn& column, Status DataTypeStructSerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, - vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const { auto* cur_batch = dynamic_cast(orc_col_batch); const auto& struct_col = assert_cast(column); @@ -638,5 +636,4 @@ bool DataTypeStructSerDe::write_column_to_hive_text(const IColumn& column, Buffe return true; } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_struct_serde.h b/be/src/core/data_type_serde/data_type_struct_serde.h similarity index 97% rename from be/src/vec/data_types/serde/data_type_struct_serde.h rename to be/src/core/data_type_serde/data_type_struct_serde.h index 0ec5a094647770..70053fdeb31f25 100644 --- a/be/src/vec/data_types/serde/data_type_struct_serde.h +++ b/be/src/core/data_type_serde/data_type_struct_serde.h @@ -22,13 +22,12 @@ #include #include "common/status.h" -#include "data_type_serde.h" +#include "core/data_type_serde/data_type_serde.h" namespace doris { class PValues; struct JsonbValue; -namespace vectorized { class IColumn; class Arena; #include "common/compile_check_begin.h" @@ -94,7 +93,7 @@ class DataTypeStructSerDe : public DataTypeSerDe { Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override; bool write_column_to_presto_text(const IColumn& column, BufferWritable& bw, int64_t row_idx, @@ -129,5 +128,4 @@ class DataTypeStructSerDe : public DataTypeSerDe { Strings elem_names; }; #include "common/compile_check_end.h" -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_time_serde.cpp b/be/src/core/data_type_serde/data_type_time_serde.cpp similarity index 97% rename from be/src/vec/data_types/serde/data_type_time_serde.cpp rename to be/src/core/data_type_serde/data_type_time_serde.cpp index 787540f7e72ec8..f6a1f312aa802e 100644 --- a/be/src/vec/data_types/serde/data_type_time_serde.cpp +++ b/be/src/core/data_type_serde/data_type_time_serde.cpp @@ -15,16 +15,16 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_time_serde.h" +#include "core/data_type_serde/data_type_time_serde.h" -#include "runtime/primitive_type.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/data_types/data_type_number.h" -#include "vec/functions/cast/cast_base.h" -#include "vec/functions/cast/cast_to_time_impl.hpp" -#include "vec/runtime/time_value.h" +#include "core/data_type/data_type_decimal.h" +#include "core/data_type/data_type_number.h" +#include "core/data_type/primitive_type.h" +#include "core/value/time_value.h" +#include "exprs/function/cast/cast_base.h" +#include "exprs/function/cast/cast_to_time_impl.hpp" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" Status DataTypeTimeV2SerDe::write_column_to_mysql_binary(const IColumn& column, @@ -330,4 +330,4 @@ template Status DataTypeTimeV2SerDe::from_decimal_strict_mode_batch( const DataTypeDecimal256::ColumnType& decimal_col, IColumn& target_col) const; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_time_serde.h b/be/src/core/data_type_serde/data_type_time_serde.h similarity index 96% rename from be/src/vec/data_types/serde/data_type_time_serde.h rename to be/src/core/data_type_serde/data_type_time_serde.h index 227e8daa02df3b..924d4b9719021c 100644 --- a/be/src/vec/data_types/serde/data_type_time_serde.h +++ b/be/src/core/data_type_serde/data_type_time_serde.h @@ -21,13 +21,12 @@ #include -#include "data_type_number_serde.h" -#include "vec/runtime/time_value.h" +#include "core/data_type_serde/data_type_number_serde.h" +#include "core/value/time_value.h" namespace doris { class JsonbOutStream; #include "common/compile_check_begin.h" -namespace vectorized { class DataTypeTimeV2SerDe : public DataTypeNumberSerDe { public: DataTypeTimeV2SerDe(int scale = 0, int nesting_level = 1) @@ -78,5 +77,4 @@ class DataTypeTimeV2SerDe : public DataTypeNumberSerDe -#include "runtime/primitive_type.h" -#include "vec/functions/cast/cast_parameters.h" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/functions/cast/cast_to_timestamptz.h" -#include "vec/runtime/timestamptz_value.h" -namespace doris::vectorized { +#include "core/data_type/primitive_type.h" +#include "core/value/timestamptz_value.h" +#include "exprs/function/cast/cast_parameters.h" +#include "exprs/function/cast/cast_to_string.h" +#include "exprs/function/cast/cast_to_timestamptz.h" +namespace doris { // The implementation of these functions mainly refers to data_type_datetimev2_serde.cpp @@ -225,8 +225,7 @@ Status DataTypeTimeStampTzSerDe::write_column_to_arrow(const IColumn& column, Status DataTypeTimeStampTzSerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, - vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const { const auto& col_data = assert_cast(column).get_data(); auto* cur_batch = dynamic_cast(orc_col_batch); @@ -247,8 +246,8 @@ Status DataTypeTimeStampTzSerDe::write_column_to_orc(const std::string& timezone return Status::OK(); } -std::string DataTypeTimeStampTzSerDe::to_olap_string(const vectorized::Field& field) const { +std::string DataTypeTimeStampTzSerDe::to_olap_string(const Field& field) const { return CastToString::from_timestamptz(field.get(), 6); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_timestamptz_serde.h b/be/src/core/data_type_serde/data_type_timestamptz_serde.h similarity index 92% rename from be/src/vec/data_types/serde/data_type_timestamptz_serde.h rename to be/src/core/data_type_serde/data_type_timestamptz_serde.h index fa0ad115a7af4a..8048731460f5aa 100644 --- a/be/src/vec/data_types/serde/data_type_timestamptz_serde.h +++ b/be/src/core/data_type_serde/data_type_timestamptz_serde.h @@ -21,11 +21,11 @@ #include -#include "data_type_number_serde.h" -#include "vec/core/types.h" -#include "vec/runtime/time_value.h" +#include "core/data_type_serde/data_type_number_serde.h" +#include "core/types.h" +#include "core/value/time_value.h" -namespace doris::vectorized { +namespace doris { class DataTypeTimeStampTzSerDe : public DataTypeNumberSerDe { public: DataTypeTimeStampTzSerDe(const UInt32 scale, int nesting_level = 1) @@ -72,12 +72,12 @@ class DataTypeTimeStampTzSerDe : public DataTypeNumberSerDe(orc_col_batch); const auto& varbinary_column_data = assert_cast(column).get_data(); @@ -127,4 +126,4 @@ void DataTypeVarbinarySerDe::to_string(const IColumn& column, size_t row_num, Bu } } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_varbinary_serde.h b/be/src/core/data_type_serde/data_type_varbinary_serde.h similarity index 91% rename from be/src/vec/data_types/serde/data_type_varbinary_serde.h rename to be/src/core/data_type_serde/data_type_varbinary_serde.h index f4f6730c3db6bf..a3ce30f6f7dac8 100644 --- a/be/src/vec/data_types/serde/data_type_varbinary_serde.h +++ b/be/src/core/data_type_serde/data_type_varbinary_serde.h @@ -22,17 +22,16 @@ #include #include "common/status.h" -#include "data_type_serde.h" -#include "data_type_string_serde.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_varbinary.h" -#include "vec/common/arena.h" -#include "vec/data_types/serde/data_type_nullable_serde.h" +#include "core/arena.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_varbinary.h" +#include "core/data_type_serde/data_type_nullable_serde.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/data_type_serde/data_type_string_serde.h" namespace doris { -namespace vectorized { #include "common/compile_check_begin.h" class DataTypeVarbinarySerDe : public DataTypeSerDe { public: @@ -89,7 +88,7 @@ class DataTypeVarbinarySerDe : public DataTypeSerDe { Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override; void to_string(const IColumn& column, size_t row_num, BufferWritable& bw, @@ -97,5 +96,4 @@ class DataTypeVarbinarySerDe : public DataTypeSerDe { }; #include "common/compile_check_end.h" -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_variant_serde.cpp b/be/src/core/data_type_serde/data_type_variant_serde.cpp similarity index 94% rename from be/src/vec/data_types/serde/data_type_variant_serde.cpp rename to be/src/core/data_type_serde/data_type_variant_serde.cpp index 11a3154f46fc96..983d5dabcff803 100644 --- a/be/src/vec/data_types/serde/data_type_variant_serde.cpp +++ b/be/src/core/data_type_serde/data_type_variant_serde.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "data_type_variant_serde.h" +#include "core/data_type_serde/data_type_variant_serde.h" #include #include @@ -23,21 +23,20 @@ #include "common/cast_set.h" #include "common/exception.h" #include "common/status.h" -#include "runtime/jsonb_value.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_variant.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/field.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "core/value/jsonb_value.h" +#include "exec/common/variant_util.h" +#include "util/json/json_parser.h" #include "util/jsonb_writer.h" -#include "vec/columns/column.h" -#include "vec/columns/column_variant.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_ref.h" -#include "vec/common/variant_util.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/serde/data_type_serde.h" -#include "vec/json/json_parser.h" namespace doris { -namespace vectorized { #include "common/compile_check_begin.h" Status DataTypeVariantSerDe::write_column_to_mysql_binary(const IColumn& column, @@ -110,7 +109,7 @@ Status DataTypeVariantSerDe::serialize_one_cell_to_json(const IColumn& column, i Status DataTypeVariantSerDe::deserialize_one_cell_from_json(IColumn& column, Slice& slice, const FormatOptions& options) const { - vectorized::ParseConfig config; + ParseConfig config; StringRef json_ref(slice.data, slice.size); RETURN_IF_CATCH_EXCEPTION( variant_util::parse_json_to_variant(column, json_ref, nullptr, config)); @@ -157,8 +156,7 @@ void DataTypeVariantSerDe::to_string(const IColumn& column, size_t row_num, Buff Status DataTypeVariantSerDe::write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, - vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const { const auto* var = check_and_get_column(column); orc::StringVectorBatch* cur_batch = dynamic_cast(orc_col_batch); @@ -203,6 +201,4 @@ Status DataTypeVariantSerDe::write_column_to_orc(const std::string& timezone, co return Status::OK(); } -} // namespace vectorized - } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_variant_serde.h b/be/src/core/data_type_serde/data_type_variant_serde.h similarity index 96% rename from be/src/vec/data_types/serde/data_type_variant_serde.h rename to be/src/core/data_type_serde/data_type_variant_serde.h index 59cb3f0c36aa68..dd121cc55d18fd 100644 --- a/be/src/vec/data_types/serde/data_type_variant_serde.h +++ b/be/src/core/data_type_serde/data_type_variant_serde.h @@ -23,12 +23,11 @@ #include #include "common/status.h" -#include "data_type_serde.h" +#include "core/data_type_serde/data_type_serde.h" namespace doris { class PValues; #include "common/compile_check_begin.h" -namespace vectorized { class IColumn; class Arena; @@ -79,11 +78,10 @@ class DataTypeVariantSerDe : public DataTypeSerDe { Status write_column_to_orc(const std::string& timezone, const IColumn& column, const NullMap* null_map, orc::ColumnVectorBatch* orc_col_batch, - int64_t start, int64_t end, vectorized::Arena& arena, + int64_t start, int64_t end, Arena& arena, const FormatOptions& options) const override; void to_string(const IColumn& column, size_t row_num, BufferWritable& bw, const FormatOptions& options) const override; }; #include "common/compile_check_end.h" -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/datelike_serde_common.hpp b/be/src/core/data_type_serde/datelike_serde_common.hpp similarity index 93% rename from be/src/vec/data_types/serde/datelike_serde_common.hpp rename to be/src/core/data_type_serde/datelike_serde_common.hpp index c178fbd810937a..eef56e19be3c7c 100644 --- a/be/src/vec/data_types/serde/datelike_serde_common.hpp +++ b/be/src/core/data_type_serde/datelike_serde_common.hpp @@ -20,9 +20,9 @@ #include #include "common/config.h" -#include "vec/runtime/vdatetime_value.h" +#include "core/value/vdatetime_value.h" -namespace doris::vectorized { +namespace doris { inline PURE uint32_t complete_4digit_year(uint32_t year) { if (year < 70) { @@ -43,4 +43,4 @@ inline bool try_convert_set_zero_date(T& date_val, uint32_t year, uint32_t month } return false; } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/olap/decimal12.h b/be/src/core/decimal12.h similarity index 99% rename from be/src/olap/decimal12.h rename to be/src/core/decimal12.h index 5fc2fb65017934..790960cb6efeae 100644 --- a/be/src/olap/decimal12.h +++ b/be/src/core/decimal12.h @@ -21,7 +21,7 @@ #include #include -#include "olap/utils.h" +#include "storage/utils.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/vec/core/decimal_comparison.h b/be/src/core/decimal_comparison.h similarity index 96% rename from be/src/vec/core/decimal_comparison.h rename to be/src/core/decimal_comparison.h index aa78ce22b8f631..db879c92802c38 100644 --- a/be/src/vec/core/decimal_comparison.h +++ b/be/src/core/decimal_comparison.h @@ -20,17 +20,17 @@ #pragma once -#include "vec/columns/column_const.h" -#include "vec/columns/column_vector.h" -#include "vec/common/arithmetic_overflow.h" -#include "vec/core/accurate_comparison.h" -#include "vec/core/block.h" -#include "vec/core/call_on_type_index.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/functions/function_helpers.h" /// todo core should not depend on function" - -namespace doris::vectorized { +#include "core/accurate_comparison.h" +#include "core/block/block.h" +#include "core/call_on_type_index.h" +#include "core/column/column_const.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type_decimal.h" +#include "core/types.h" +#include "exec/common/arithmetic_overflow.h" +#include "exprs/function/function_helpers.h" /// todo core should not depend on function" + +namespace doris { template struct ConstructDecInt { @@ -331,4 +331,4 @@ class DecimalComparison { } }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/core/extended_types.h b/be/src/core/extended_types.h similarity index 99% rename from be/src/vec/core/extended_types.h rename to be/src/core/extended_types.h index 354ba81516228d..811a2003db9618 100644 --- a/be/src/vec/core/extended_types.h +++ b/be/src/core/extended_types.h @@ -20,7 +20,7 @@ #pragma once #include -#include "wide_integer.h" +#include "core/wide_integer.h" /// The standard library type traits, such as std::is_arithmetic, with one exception /// (std::common_type), are "set in stone". Attempting to specialize them causes undefined behavior. diff --git a/be/src/vec/core/field.cpp b/be/src/core/field.cpp similarity index 98% rename from be/src/vec/core/field.cpp rename to be/src/core/field.cpp index ab86a7ca1e13a2..b93362a0e3996b 100644 --- a/be/src/vec/core/field.cpp +++ b/be/src/core/field.cpp @@ -18,22 +18,22 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Field.cpp // and modified by Doris -#include "vec/core/field.h" - -#include "runtime/define_primitive_type.h" -#include "runtime/jsonb_value.h" -#include "runtime/primitive_type.h" -#include "util/bitmap_value.h" -#include "vec/core/accurate_comparison.h" -#include "vec/core/decimal_comparison.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/io/io_helper.h" -#include "vec/io/var_int.h" -#include "vec/runtime/timestamptz_value.h" -#include "vec/runtime/vdatetime_value.h" - -namespace doris::vectorized { +#include "core/field.h" + +#include "core/accurate_comparison.h" +#include "core/data_type/data_type_decimal.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/decimal_comparison.h" +#include "core/value/bitmap_value.h" +#include "core/value/jsonb_value.h" +#include "core/value/timestamptz_value.h" +#include "core/value/vdatetime_value.h" +#include "exprs/function/cast/cast_to_string.h" +#include "util/io_helper.h" +#include "util/var_int.h" + +namespace doris { class BufferReadable; class BufferWritable; @@ -1019,4 +1019,4 @@ DECLARE_FUNCTION(TYPE_TIMEV2) DECLARE_FUNCTION(TYPE_UINT32) DECLARE_FUNCTION(TYPE_UINT64) #undef DECLARE_FUNCTION -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/core/field.h b/be/src/core/field.h similarity index 95% rename from be/src/vec/core/field.h rename to be/src/core/field.h index c1a2d3b6bf6de8..2c31172794174f 100644 --- a/be/src/vec/core/field.h +++ b/be/src/core/field.h @@ -35,26 +35,24 @@ #include "common/compiler_util.h" // IWYU pragma: keep #include "common/exception.h" -#include "olap/hll.h" -#include "runtime/primitive_type.h" -#include "util/bitmap_value.h" -#include "util/quantile_state.h" -#include "vec/common/string_view.h" -#include "vec/common/uint128.h" -#include "vec/core/types.h" -#include "vec/json/path_in_data.h" +#include "core/data_type/primitive_type.h" +#include "core/string_view.h" +#include "core/types.h" +#include "core/uint128.h" +#include "core/value/bitmap_value.h" +#include "core/value/hll.h" +#include "core/value/quantile_state.h" +#include "util/json/path_in_data.h" namespace doris { template struct PrimitiveTypeTraits; -namespace vectorized { template struct TypeName; -} // namespace vectorized struct PackedInt128; } // namespace doris -namespace doris::vectorized { +namespace doris { class Field; @@ -324,11 +322,11 @@ struct FieldWithDataType { int scale = -1; }; -} // namespace doris::vectorized +} // namespace doris template <> -struct std::hash { - size_t operator()(const doris::vectorized::Field& field) const { +struct std::hash { + size_t operator()(const doris::Field& field) const { if (field.is_null()) { return 0; } diff --git a/be/src/vec/common/memcmp_small.h b/be/src/core/memcmp_small.h similarity index 93% rename from be/src/vec/common/memcmp_small.h rename to be/src/core/memcmp_small.h index e4287b9ecff0cb..5f8eca28588ee5 100644 --- a/be/src/vec/common/memcmp_small.h +++ b/be/src/core/memcmp_small.h @@ -23,7 +23,7 @@ #include #include -namespace doris::vectorized::detail { +namespace doris::detail { #include "common/compile_check_begin.h" inline int cmp(uint8_t a, uint8_t b) { if (a < b) return -1; @@ -36,7 +36,7 @@ inline int cmp(size_t a, size_t b) { if (a > b) return 1; return 0; } -} // namespace doris::vectorized::detail +} // namespace doris::detail /// We can process uninitialized memory in the functions below. /// Results don't depend on the values inside uninitialized memory but Memory Sanitizer cannot see it. @@ -65,11 +65,11 @@ inline int memcmp_small_allow_overflow15(const uint8_t* a, size_t a_size, const if (offset >= min_size) break; - return doris::vectorized::detail::cmp(a[offset], b[offset]); + return doris::detail::cmp(a[offset], b[offset]); } } - return doris::vectorized::detail::cmp(a_size, b_size); + return doris::detail::cmp(a_size, b_size); } /** Variant when memory regions have same size. @@ -87,7 +87,7 @@ inline int memcmp_small_allow_overflow15(const uint8_t* a, const uint8_t* b, siz if (offset >= size) return 0; - return doris::vectorized::detail::cmp(a[offset], b[offset]); + return doris::detail::cmp(a[offset], b[offset]); } } @@ -126,7 +126,7 @@ inline int memcmp_small_multiple_of16(const uint8_t* a, const uint8_t* b, size_t if (mask) { offset += __builtin_ctz(mask); - return doris::vectorized::detail::cmp(a[offset], b[offset]); + return doris::detail::cmp(a[offset], b[offset]); } } @@ -143,7 +143,7 @@ inline int memcmp16(const uint8_t* a, const uint8_t* b) { if (mask) { auto offset = __builtin_ctz(mask); - return doris::vectorized::detail::cmp(a[offset], b[offset]); + return doris::detail::cmp(a[offset], b[offset]); } return 0; @@ -185,7 +185,7 @@ inline int memcmp_small_allow_overflow15(const uint8_t* a, size_t a_size, const if (auto res = memcmp(a, b, std::min(a_size, b_size))) return res; else - return doris::vectorized::detail::cmp(a_size, b_size); + return doris::detail::cmp(a_size, b_size); } inline int memcmp_small_allow_overflow15(const uint8_t* a, const uint8_t* b, size_t size) { diff --git a/be/src/vec/common/memcpy_small.h b/be/src/core/memcpy_small.h similarity index 96% rename from be/src/vec/common/memcpy_small.h rename to be/src/core/memcpy_small.h index 62a093e8b628ed..32d195c1d75788 100644 --- a/be/src/vec/common/memcpy_small.h +++ b/be/src/core/memcpy_small.h @@ -49,7 +49,7 @@ * Use with caution. */ -namespace doris::vectorized::detail { +namespace doris::detail { inline void memcpy_small_allow_read_write_overflow15_impl(char* __restrict dst, const char* __restrict src, ssize_t n) { while (n > 0) { @@ -61,14 +61,14 @@ inline void memcpy_small_allow_read_write_overflow15_impl(char* __restrict dst, n -= 16; } } -} // namespace doris::vectorized::detail +} // namespace doris::detail /** Works under assumption, that it's possible to read up to 15 excessive bytes after end of 'src' region * and to write any garbage into up to 15 bytes after end of 'dst' region. */ inline void memcpy_small_allow_read_write_overflow15(void* __restrict dst, const void* __restrict src, size_t n) { - doris::vectorized::detail::memcpy_small_allow_read_write_overflow15_impl( + doris::detail::memcpy_small_allow_read_write_overflow15_impl( reinterpret_cast(dst), reinterpret_cast(src), n); } diff --git a/be/src/vec/common/mremap.cpp b/be/src/core/mremap.cpp similarity index 98% rename from be/src/vec/common/mremap.cpp rename to be/src/core/mremap.cpp index d7cd1b8d0cfa95..9e09911d6e1ff9 100644 --- a/be/src/vec/common/mremap.cpp +++ b/be/src/core/mremap.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/base/base/mremap.cpp // and modified by Doris -#include "vec/common/mremap.h" +#include "core/mremap.h" // IWYU pragma: no_include #include // IWYU pragma: keep diff --git a/be/src/vec/common/mremap.h b/be/src/core/mremap.h similarity index 100% rename from be/src/vec/common/mremap.h rename to be/src/core/mremap.h diff --git a/be/src/util/types.h b/be/src/core/packed_int128.h similarity index 97% rename from be/src/util/types.h rename to be/src/core/packed_int128.h index 7688dd60390855..07d595fdd03681 100644 --- a/be/src/util/types.h +++ b/be/src/core/packed_int128.h @@ -17,7 +17,7 @@ #pragma once -#include "olap/olap_common.h" +#include "storage/olap_common.h" namespace doris { diff --git a/be/src/vec/common/pod_array.cpp b/be/src/core/pod_array.cpp similarity index 91% rename from be/src/vec/common/pod_array.cpp rename to be/src/core/pod_array.cpp index 322aceab606360..7de200ee002c48 100644 --- a/be/src/vec/common/pod_array.cpp +++ b/be/src/core/pod_array.cpp @@ -18,10 +18,10 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/PODArray.cpp // and modified by Doris -#include "vec/common/pod_array.h" +#include "core/pod_array.h" -namespace doris::vectorized { +namespace doris { /// Used for left padding of PODArray when empty const char empty_pod_array[EmptyPODArraySize] {}; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/pod_array.h b/be/src/core/pod_array.h similarity index 99% rename from be/src/vec/common/pod_array.h rename to be/src/core/pod_array.h index 00d794b272428f..16125034452b22 100644 --- a/be/src/vec/common/pod_array.h +++ b/be/src/core/pod_array.h @@ -20,7 +20,6 @@ #pragma once -#include #include #include #include @@ -32,18 +31,19 @@ #include #include +#include "common/compiler_util.h" #include "common/compiler_util.h" // IWYU pragma: keep +#include "core/allocator.h" // IWYU pragma: keep +#include "core/memcpy_small.h" #include "runtime/thread_context.h" -#include "vec/common/allocator.h" // IWYU pragma: keep -#include "vec/common/memcpy_small.h" #ifndef NDEBUG #include #endif -#include "vec/common/pod_array_fwd.h" +#include "core/pod_array_fwd.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_avoid_begin.h" /** For zero argument, result is zero. * For arguments with most significand bit set, result is zero. @@ -693,5 +693,5 @@ void swap(PODArray& lhs, lhs.swap(rhs); } -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_avoid_end.h" \ No newline at end of file diff --git a/be/src/vec/common/pod_array_fwd.h b/be/src/core/pod_array_fwd.h similarity index 95% rename from be/src/vec/common/pod_array_fwd.h rename to be/src/core/pod_array_fwd.h index bd0c7e272e4ea4..b6159a1204f363 100644 --- a/be/src/vec/common/pod_array_fwd.h +++ b/be/src/core/pod_array_fwd.h @@ -24,9 +24,9 @@ */ #pragma once -#include "vec/common/allocator_fwd.h" +#include "core/allocator_fwd.h" -namespace doris::vectorized { +namespace doris { inline constexpr size_t integerRoundUp(size_t value, size_t dividend) { return ((value + dividend - 1) / dividend) * dividend; @@ -53,4 +53,4 @@ using PODArrayWithStackMemory = PODArray, rounded_bytes, alignof(T)>>; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/string_buffer.hpp b/be/src/core/string_buffer.hpp similarity index 98% rename from be/src/vec/common/string_buffer.hpp rename to be/src/core/string_buffer.hpp index 809bdffcd581f3..c29b024d0c12bf 100644 --- a/be/src/vec/common/string_buffer.hpp +++ b/be/src/core/string_buffer.hpp @@ -20,11 +20,11 @@ #include -#include "vec/columns/column_string.h" -#include "vec/common/arena.h" -#include "vec/common/string_ref.h" +#include "core/arena.h" +#include "core/column/column_string.h" +#include "core/string_ref.h" -namespace doris::vectorized { +namespace doris { static constexpr size_t DEFAULT_MAX_STRING_SIZE = 1073741824; // 1GB static constexpr size_t DEFAULT_MAX_JSON_SIZE = 1073741824; // 1GB @@ -310,4 +310,4 @@ class BufferReadable { using VectorBufferReader = BufferReadable; using BufferReader = BufferReadable; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/string_ref.cpp b/be/src/core/string_ref.cpp similarity index 99% rename from be/src/vec/common/string_ref.cpp rename to be/src/core/string_ref.cpp index bac052e741f581..be04f53331bf20 100644 --- a/be/src/vec/common/string_ref.cpp +++ b/be/src/core/string_ref.cpp @@ -18,7 +18,7 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/base/base/StringRef. // And modified by Doris -#include "string_ref.h" +#include "core/string_ref.h" #include "common/compiler_util.h" // IWYU pragma: keep diff --git a/be/src/vec/common/string_ref.h b/be/src/core/string_ref.h similarity index 94% rename from be/src/vec/common/string_ref.h rename to be/src/core/string_ref.h index 27ab1137fc3bb0..7288527e97f8b1 100644 --- a/be/src/vec/common/string_ref.h +++ b/be/src/core/string_ref.h @@ -32,12 +32,12 @@ #include #include +#include "core/types.h" #include "util/hash/city.h" #include "util/hash_util.hpp" #include "util/slice.h" #include "util/sse_util.hpp" -#include "vec/common/unaligned.h" -#include "vec/core/types.h" +#include "util/unaligned.h" namespace doris { @@ -312,25 +312,24 @@ using StringRefs = std::vector; /// Parts are taken from CityHash. -inline doris::vectorized::UInt64 hash_len16(doris::vectorized::UInt64 u, - doris::vectorized::UInt64 v) { +inline doris::UInt64 hash_len16(doris::UInt64 u, doris::UInt64 v) { return util_hash::HashLen16(u, v); } -inline doris::vectorized::UInt64 shift_mix(doris::vectorized::UInt64 val) { +inline doris::UInt64 shift_mix(doris::UInt64 val) { return val ^ (val >> 47); } -inline doris::vectorized::UInt64 rotate_by_at_least1(doris::vectorized::UInt64 val, int shift) { +inline doris::UInt64 rotate_by_at_least1(doris::UInt64 val, int shift) { return (val >> shift) | (val << (64 - shift)); } inline size_t hash_less_than8(const char* data, size_t size) { - static constexpr doris::vectorized::UInt64 k2 = 0x9ae16a3b2f90404fULL; - static constexpr doris::vectorized::UInt64 k3 = 0xc949d7c7509e6557ULL; + static constexpr doris::UInt64 k2 = 0x9ae16a3b2f90404fULL; + static constexpr doris::UInt64 k3 = 0xc949d7c7509e6557ULL; if (size >= 4) { - doris::vectorized::UInt64 a = unaligned_load(data); + doris::UInt64 a = unaligned_load(data); return hash_len16(size + (a << 3), unaligned_load(data + size - 4)); } @@ -359,14 +358,13 @@ inline size_t crc32_hash(const char* pos, size_t size) { size_t res = -1ULL; do { - auto word = unaligned_load(pos); + auto word = unaligned_load(pos); res = _mm_crc32_u64(res, word); pos += 8; } while (pos + 8 < end); - auto word = - unaligned_load(end - 8); /// I'm not sure if this is normal. + auto word = unaligned_load(end - 8); /// I'm not sure if this is normal. res = _mm_crc32_u64(res, word); return res; diff --git a/be/src/vec/common/string_view.cpp b/be/src/core/string_view.cpp similarity index 98% rename from be/src/vec/common/string_view.cpp rename to be/src/core/string_view.cpp index 657e4585f22e54..6d008b4f1ec85a 100644 --- a/be/src/vec/common/string_view.cpp +++ b/be/src/core/string_view.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/common/string_view.h" +#include "core/string_view.h" namespace doris { diff --git a/be/src/vec/common/string_view.h b/be/src/core/string_view.h similarity index 99% rename from be/src/vec/common/string_view.h rename to be/src/core/string_view.h index 218104ff750026..25693e9da62c0d 100644 --- a/be/src/vec/common/string_view.h +++ b/be/src/core/string_view.h @@ -27,7 +27,7 @@ #include #include -#include "string_ref.h" +#include "core/string_ref.h" namespace doris { // Variable length string or binary type for use in vectors. This has diff --git a/be/src/runtime/type_limit.h b/be/src/core/type_limit.h similarity index 76% rename from be/src/runtime/type_limit.h rename to be/src/core/type_limit.h index 202455d5327046..824433a03191dc 100644 --- a/be/src/runtime/type_limit.h +++ b/be/src/core/type_limit.h @@ -17,10 +17,10 @@ #pragma once -#include "runtime/decimalv2_value.h" -#include "vec/common/string_ref.h" -#include "vec/core/extended_types.h" -#include "vec/runtime/timestamptz_value.h" +#include "core/extended_types.h" +#include "core/string_ref.h" +#include "core/value/decimalv2_value.h" +#include "core/value/timestamptz_value.h" namespace doris { @@ -55,37 +55,37 @@ struct type_limit { }; template <> -struct type_limit { - static vectorized::Decimal32 max() { return 999999999; } - static vectorized::Decimal32 min() { return -max(); } +struct type_limit { + static Decimal32 max() { return 999999999; } + static Decimal32 min() { return -max(); } }; template <> -struct type_limit { - static vectorized::Decimal64 max() { return int64_t(999999999999999999ll); } - static vectorized::Decimal64 min() { return -max(); } +struct type_limit { + static Decimal64 max() { return int64_t(999999999999999999ll); } + static Decimal64 min() { return -max(); } }; template <> -struct type_limit { - static vectorized::Decimal128V3 max() { +struct type_limit { + static Decimal128V3 max() { return (static_cast(999999999999999999ll) * 100000000000000000ll * 1000ll + static_cast(99999999999999999ll) * 1000ll + 999ll); } - static vectorized::Decimal128V3 min() { return -max(); } + static Decimal128V3 min() { return -max(); } }; template <> -struct type_limit { - static vectorized::Decimal128V2 max() { return DecimalV2Value::get_max_decimal().value(); } - static vectorized::Decimal128V2 min() { return -max(); } +struct type_limit { + static Decimal128V2 max() { return DecimalV2Value::get_max_decimal().value(); } + static Decimal128V2 min() { return -max(); } }; static wide::Int256 MAX_DECIMAL256_INT({18446744073709551615ul, 8607968719199866879ul, 532749306367912313ul, 1593091911132452277ul}); template <> -struct type_limit { - static vectorized::Decimal256 max() { return vectorized::Decimal256(MAX_DECIMAL256_INT); } - static vectorized::Decimal256 min() { return vectorized::Decimal256(-MAX_DECIMAL256_INT); } +struct type_limit { + static Decimal256 max() { return Decimal256(MAX_DECIMAL256_INT); } + static Decimal256 min() { return Decimal256(-MAX_DECIMAL256_INT); } }; template <> diff --git a/be/src/vec/common/typeid_cast.h b/be/src/core/typeid_cast.h similarity index 100% rename from be/src/vec/common/typeid_cast.h rename to be/src/core/typeid_cast.h diff --git a/be/src/vec/core/types.h b/be/src/core/types.h similarity index 92% rename from be/src/vec/core/types.h rename to be/src/core/types.h index 713be9a925c69a..f78c72a16458ac 100644 --- a/be/src/vec/core/types.h +++ b/be/src/core/types.h @@ -28,10 +28,10 @@ #include "common/cast_set.h" #include "common/consts.h" -#include "util/binary_cast.hpp" -#include "vec/common/int_exp.h" -#include "vec/core/extended_types.h" -#include "vec/core/wide_integer_to_string.h" +#include "core/binary_cast.hpp" +#include "core/extended_types.h" +#include "core/wide_integer_to_string.h" +#include "exec/common/int_exp.h" namespace doris { #include "common/compile_check_begin.h" @@ -46,8 +46,6 @@ struct StringRef; using IPv4 = uint32_t; using IPv6 = uint128_t; -namespace vectorized { - /// Data types for representing elementary values from a database in RAM. struct Null {}; @@ -577,37 +575,34 @@ struct NativeType { }; // NOLINTEND(readability-function-size) -} // namespace vectorized #include "common/compile_check_end.h" } // namespace doris /// Specialization of `std::hash` for the Decimal types. template -struct std::hash> { - size_t operator()(const doris::vectorized::Decimal& x) const { return hash()(x.value); } +struct std::hash> { + size_t operator()(const doris::Decimal& x) const { return hash()(x.value); } }; template <> -struct std::hash { - size_t operator()(const doris::vectorized::Decimal128V2& x) const { - return std::hash()(x.value >> 64) ^ - std::hash()( - x.value & std::numeric_limits::max()); +struct std::hash { + size_t operator()(const doris::Decimal128V2& x) const { + return std::hash()(x.value >> 64) ^ + std::hash()(x.value & std::numeric_limits::max()); } }; template <> -struct std::hash { - size_t operator()(const doris::vectorized::Decimal128V3& x) const { - return std::hash()(x.value >> 64) ^ - std::hash()( - x.value & std::numeric_limits::max()); +struct std::hash { + size_t operator()(const doris::Decimal128V3& x) const { + return std::hash()(x.value >> 64) ^ + std::hash()(x.value & std::numeric_limits::max()); } }; template <> -struct std::hash { - size_t operator()(const doris::vectorized::Decimal256& x) const { +struct std::hash { + size_t operator()(const doris::Decimal256& x) const { return std::hash()(x.value >> 192) ^ std::hash()(x.value >> 128) ^ std::hash()(x.value >> 64) ^ std::hash()(x.value & std::numeric_limits::max()); @@ -615,7 +610,7 @@ struct std::hash { }; template -struct fmt::formatter> { +struct fmt::formatter> { constexpr auto parse(format_parse_context& ctx) { const auto* it = ctx.begin(); const auto* end = ctx.end(); @@ -629,13 +624,13 @@ struct fmt::formatter> { } template - auto format(const doris::vectorized::Decimal& value, FormatContext& ctx) const { + auto format(const doris::Decimal& value, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "{}", to_string(value.value)); } }; -extern template struct fmt::formatter; -extern template struct fmt::formatter; -extern template struct fmt::formatter; -extern template struct fmt::formatter; -extern template struct fmt::formatter; +extern template struct fmt::formatter; +extern template struct fmt::formatter; +extern template struct fmt::formatter; +extern template struct fmt::formatter; +extern template struct fmt::formatter; diff --git a/be/src/vec/common/uint128.h b/be/src/core/uint128.h similarity index 91% rename from be/src/vec/common/uint128.h rename to be/src/core/uint128.h index 58db42868a9c5f..35d2ad2906fe3f 100644 --- a/be/src/vec/common/uint128.h +++ b/be/src/core/uint128.h @@ -25,12 +25,12 @@ #include #include +#include "core/extended_types.h" +#include "core/types.h" #include "util/hash/city.h" #include "util/sse_util.hpp" -#include "vec/core/extended_types.h" -#include "vec/core/types.h" -namespace doris::vectorized { +namespace doris { using UInt128 = wide::UInt128; @@ -99,12 +99,12 @@ struct UInt136 { }; #pragma pack() -} // namespace doris::vectorized +} // namespace doris /// Overload hash for type casting template <> -struct std::hash { - size_t operator()(const doris::vectorized::UInt128& u) const { +struct std::hash { + size_t operator()(const doris::UInt128& u) const { return doris::util_hash::HashLen16(u.low(), u.high()); } }; diff --git a/be/src/olap/uint24.h b/be/src/core/uint24.h similarity index 100% rename from be/src/olap/uint24.h rename to be/src/core/uint24.h diff --git a/be/src/util/bitmap_value.h b/be/src/core/value/bitmap_value.h similarity index 99% rename from be/src/util/bitmap_value.h rename to be/src/core/value/bitmap_value.h index 77a1a9a0b1db67..3b7b05d04a10c3 100644 --- a/be/src/util/bitmap_value.h +++ b/be/src/core/value/bitmap_value.h @@ -39,9 +39,9 @@ #include "common/config.h" #include "common/exception.h" #include "common/logging.h" +#include "core/pod_array.h" +#include "core/pod_array_fwd.h" #include "util/coding.h" -#include "vec/common/pod_array.h" -#include "vec/common/pod_array_fwd.h" namespace doris { // serialized bitmap := TypeCode(1), Payload @@ -2316,7 +2316,7 @@ class BitmapValue { } //for function bitmap_to_array - void to_array(vectorized::PaddedPODArray& data) const { + void to_array(PaddedPODArray& data) const { switch (_type) { case EMPTY: break; diff --git a/be/src/runtime/decimalv2_value.cpp b/be/src/core/value/decimalv2_value.cpp similarity index 99% rename from be/src/runtime/decimalv2_value.cpp rename to be/src/core/value/decimalv2_value.cpp index 248233a16b5aa8..93dcee92d84b7f 100644 --- a/be/src/runtime/decimalv2_value.cpp +++ b/be/src/core/value/decimalv2_value.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "runtime/decimalv2_value.h" +#include "core/value/decimalv2_value.h" #include diff --git a/be/src/runtime/decimalv2_value.h b/be/src/core/value/decimalv2_value.h similarity index 99% rename from be/src/runtime/decimalv2_value.h rename to be/src/core/value/decimalv2_value.h index 4412db5d021d19..92f22943fbaa37 100644 --- a/be/src/runtime/decimalv2_value.h +++ b/be/src/core/value/decimalv2_value.h @@ -28,9 +28,9 @@ #include #include -#include "runtime/define_primitive_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/extended_types.h" #include "util/hash_util.hpp" -#include "vec/core/extended_types.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/olap/hll.cpp b/be/src/core/value/hll.cpp similarity index 99% rename from be/src/olap/hll.cpp rename to be/src/core/value/hll.cpp index 9f8e38b839bf8e..5f2852958d430e 100644 --- a/be/src/olap/hll.cpp +++ b/be/src/core/value/hll.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "olap/hll.h" +#include "core/value/hll.h" #include #include @@ -48,7 +48,7 @@ void HyperLogLog::_convert_explicit_to_register() { _update_registers(value); } // clear _hash_set - vectorized::flat_hash_set().swap(_hash_set); + flat_hash_set().swap(_hash_set); } // Change HLL_DATA_EXPLICIT to HLL_DATA_FULL directly, because HLL_DATA_SPARSE diff --git a/be/src/olap/hll.h b/be/src/core/value/hll.h similarity index 98% rename from be/src/olap/hll.h rename to be/src/core/value/hll.h index 2b004591c709c7..78531f52111884 100644 --- a/be/src/olap/hll.h +++ b/be/src/core/value/hll.h @@ -23,7 +23,7 @@ #include #include -#include "vec/common/hash_table/phmap_fwd_decl.h" +#include "exec/common/hash_table/phmap_fwd_decl.h" namespace doris { #include "common/compile_check_begin.h" @@ -282,7 +282,7 @@ class HyperLogLog { } HllDataType _type = HLL_DATA_EMPTY; - vectorized::flat_hash_set _hash_set; + flat_hash_set _hash_set; // This field is much space consuming(HLL_REGISTERS_COUNT), we create // it only when it is really needed. diff --git a/be/src/vec/runtime/ip_address_cidr.h b/be/src/core/value/ip_address_cidr.h similarity index 88% rename from be/src/vec/runtime/ip_address_cidr.h rename to be/src/core/value/ip_address_cidr.h index de128bac29b150..cae23db68e02af 100644 --- a/be/src/vec/runtime/ip_address_cidr.h +++ b/be/src/core/value/ip_address_cidr.h @@ -20,13 +20,12 @@ #pragma once +#include "exec/common/format_ip.h" +#include "exec/common/ipv6_to_binary.h" #include "util/sse_util.hpp" -#include "vec/common/format_ip.h" -#include "vec/common/ipv6_to_binary.h" namespace doris { #include "common/compile_check_begin.h" -namespace vectorized { static inline std::pair apply_cidr_mask(UInt32 src, UInt8 bits_to_keep) { if (bits_to_keep >= 8 * sizeof(UInt32)) { return {src, src}; @@ -62,34 +61,32 @@ static inline void apply_cidr_mask(const char* __restrict src, char* __restrict } } -} // namespace vectorized - class IPAddressVariant { public: explicit IPAddressVariant(std::string_view address_str) { - vectorized::Int64 v4 = 0; - if (vectorized::parse_ipv4_whole(address_str.begin(), address_str.end(), - reinterpret_cast(&v4))) { - _addr = static_cast(v4); + Int64 v4 = 0; + if (parse_ipv4_whole(address_str.begin(), address_str.end(), + reinterpret_cast(&v4))) { + _addr = static_cast(v4); } else { _addr = IPv6AddrType(); // parse ipv6 in little-endian - if (!vectorized::parse_ipv6_whole(address_str.begin(), address_str.end(), - std::get(_addr).data())) { + if (!parse_ipv6_whole(address_str.begin(), address_str.end(), + std::get(_addr).data())) { throw Exception(ErrorCode::INVALID_ARGUMENT, "Neither IPv4 nor IPv6 address: '{}'", address_str); } } } - vectorized::UInt32 as_v4() const { + UInt32 as_v4() const { if (const auto* val = std::get_if(&_addr)) { return *val; } return 0; } - const vectorized::UInt8* as_v6() const { + const UInt8* as_v6() const { if (const auto* val = std::get_if(&_addr)) { return val->data(); } @@ -97,15 +94,15 @@ class IPAddressVariant { } private: - using IPv4AddrType = vectorized::UInt32; - using IPv6AddrType = std::array; + using IPv4AddrType = UInt32; + using IPv6AddrType = std::array; std::variant _addr; }; struct IPAddressCIDR { IPAddressVariant _address; - vectorized::UInt8 _prefix; + UInt8 _prefix; }; inline bool match_ipv4_subnet(uint32_t addr, uint32_t cidr_addr, uint8_t prefix) { diff --git a/be/src/vec/runtime/ipv4_value.h b/be/src/core/value/ipv4_value.h similarity index 86% rename from be/src/vec/runtime/ipv4_value.h rename to be/src/core/value/ipv4_value.h index 44205f7dc12eb1..07a9df143d9ca0 100644 --- a/be/src/vec/runtime/ipv4_value.h +++ b/be/src/core/value/ipv4_value.h @@ -22,9 +22,9 @@ #include #include +#include "core/string_ref.h" +#include "exec/common/format_ip.h" #include "util/string_parser.hpp" -#include "vec/common/format_ip.h" -#include "vec/common/string_ref.h" namespace doris { #include "common/compile_check_begin.h" @@ -58,8 +58,8 @@ class IPv4Value { while (end > begin && std::isspace(ipv4_str[end])) { --end; } - if (!vectorized::parse_ipv4_whole(ipv4_str + begin, ipv4_str + end + 1, - reinterpret_cast(&parse_value))) { + if (!parse_ipv4_whole(ipv4_str + begin, ipv4_str + end + 1, + reinterpret_cast(&parse_value))) { return false; } value = static_cast(parse_value); @@ -75,7 +75,7 @@ class IPv4Value { char* start = buf; char* end = buf; const auto* src = reinterpret_cast(&value); - vectorized::format_ipv4(src, end); + format_ipv4(src, end); size_t len = end - start; return {buf, len}; } @@ -93,15 +93,14 @@ class IPv4Value { while (end > begin && std::isspace(ipv4_str[end])) { --end; } - return vectorized::parse_ipv4_whole(ipv4_str + begin, ipv4_str + end + 1, - reinterpret_cast(&parse_value)); + return parse_ipv4_whole(ipv4_str + begin, ipv4_str + end + 1, + reinterpret_cast(&parse_value)); } private: IPv4 _value; }; -namespace vectorized { void inline map_ipv4_to_ipv6(IPv4 ipv4, UInt8* buf) { unaligned_store(buf, 0x0000FFFF00000000ULL | static_cast(ipv4)); unaligned_store(buf + 8, 0); @@ -112,7 +111,6 @@ IPv6 inline ipv4_to_ipv6(IPv4 ipv4) { map_ipv4_to_ipv6(ipv4, reinterpret_cast(&ipv6)); return ipv6; } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/runtime/ipv6_value.h b/be/src/core/value/ipv6_value.h similarity index 85% rename from be/src/vec/runtime/ipv6_value.h rename to be/src/core/value/ipv6_value.h index 74e0d7b20ee499..16f07e198ff680 100644 --- a/be/src/vec/runtime/ipv6_value.h +++ b/be/src/core/value/ipv6_value.h @@ -21,10 +21,10 @@ #include #include -#include "vec/common/format_ip.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_number_base.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_number_base.h" +#include "core/types.h" +#include "exec/common/format_ip.h" namespace doris { #include "common/compile_check_begin.h" @@ -67,8 +67,8 @@ class IPv6Value { --end; } // parse and store in little-endian - return vectorized::parse_ipv6_whole(ipv6_str + begin, ipv6_str + end + 1, - reinterpret_cast(&value)); + return parse_ipv6_whole(ipv6_str + begin, ipv6_str + end + 1, + reinterpret_cast(&value)); } static bool from_string(IPv6& value, const std::string& ipv6_str) { @@ -83,7 +83,7 @@ class IPv6Value { char* end = buf; auto* src = reinterpret_cast(&value); // load and format in little-endian - vectorized::format_ipv6(src, end); + format_ipv6(src, end); size_t len = end - start; return {buf, len}; } @@ -101,8 +101,8 @@ class IPv6Value { while (end > begin && std::isspace(ipv6_str[end])) { --end; } - return vectorized::parse_ipv6_whole(ipv6_str + begin, ipv6_str + end + 1, - reinterpret_cast(&value)); + return parse_ipv6_whole(ipv6_str + begin, ipv6_str + end + 1, + reinterpret_cast(&value)); } private: diff --git a/be/src/runtime/jsonb_value.h b/be/src/core/value/jsonb_value.h similarity index 100% rename from be/src/runtime/jsonb_value.h rename to be/src/core/value/jsonb_value.h diff --git a/be/src/runtime/large_int_value.cpp b/be/src/core/value/large_int_value.cpp similarity index 97% rename from be/src/runtime/large_int_value.cpp rename to be/src/core/value/large_int_value.cpp index b9f354b8234369..a9b81d843129b8 100644 --- a/be/src/runtime/large_int_value.cpp +++ b/be/src/core/value/large_int_value.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "runtime/large_int_value.h" +#include "core/value/large_int_value.h" #include diff --git a/be/src/runtime/large_int_value.h b/be/src/core/value/large_int_value.h similarity index 100% rename from be/src/runtime/large_int_value.h rename to be/src/core/value/large_int_value.h diff --git a/be/src/runtime/map_value.cpp b/be/src/core/value/map_value.cpp similarity index 96% rename from be/src/runtime/map_value.cpp rename to be/src/core/value/map_value.cpp index 1828fd27b39058..f9e77c952680ca 100644 --- a/be/src/runtime/map_value.cpp +++ b/be/src/core/value/map_value.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "map_value.h" +#include "core/value/map_value.h" namespace doris { diff --git a/be/src/runtime/map_value.h b/be/src/core/value/map_value.h similarity index 100% rename from be/src/runtime/map_value.h rename to be/src/core/value/map_value.h diff --git a/be/src/util/quantile_state.cpp b/be/src/core/value/quantile_state.cpp similarity index 99% rename from be/src/util/quantile_state.cpp rename to be/src/core/value/quantile_state.cpp index 1e47ff49acf1d5..95598c2b38a0a4 100644 --- a/be/src/util/quantile_state.cpp +++ b/be/src/core/value/quantile_state.cpp @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -#include "util/quantile_state.h" +#include "core/value/quantile_state.h" #include @@ -26,7 +26,7 @@ #include "util/coding.h" #include "util/slice.h" #include "util/tdigest.h" -#include "vec/common/unaligned.h" +#include "util/unaligned.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/util/quantile_state.h b/be/src/core/value/quantile_state.h similarity index 99% rename from be/src/util/quantile_state.h rename to be/src/core/value/quantile_state.h index 23e43860c34804..50868290976ebf 100644 --- a/be/src/util/quantile_state.h +++ b/be/src/core/value/quantile_state.h @@ -25,7 +25,7 @@ #include #include "common/exception.h" -#include "slice.h" +#include "util/slice.h" namespace doris { diff --git a/be/src/runtime/struct_value.cpp b/be/src/core/value/struct_value.cpp similarity index 96% rename from be/src/runtime/struct_value.cpp rename to be/src/core/value/struct_value.cpp index ff0b9cc62a7c6e..e440bd53dc8afc 100644 --- a/be/src/runtime/struct_value.cpp +++ b/be/src/core/value/struct_value.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "runtime/struct_value.h" +#include "core/value/struct_value.h" namespace doris { diff --git a/be/src/runtime/struct_value.h b/be/src/core/value/struct_value.h similarity index 100% rename from be/src/runtime/struct_value.h rename to be/src/core/value/struct_value.h diff --git a/be/src/vec/runtime/time_value.h b/be/src/core/value/time_value.h similarity index 98% rename from be/src/vec/runtime/time_value.h rename to be/src/core/value/time_value.h index 340b4da42b3517..ce72e92d635f0f 100644 --- a/be/src/vec/runtime/time_value.h +++ b/be/src/core/value/time_value.h @@ -25,10 +25,10 @@ #include "common/exception.h" #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "runtime/primitive_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/value/vdatetime_value.h" #include "util/date_func.h" -#include "vec/runtime/vdatetime_value.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/vec/runtime/timestamptz_value.cpp b/be/src/core/value/timestamptz_value.cpp similarity index 93% rename from be/src/vec/runtime/timestamptz_value.cpp rename to be/src/core/value/timestamptz_value.cpp index fae68cf3907a56..1226c3bf3cccd2 100644 --- a/be/src/vec/runtime/timestamptz_value.cpp +++ b/be/src/core/value/timestamptz_value.cpp @@ -15,9 +15,9 @@ // specific language governing permissions and limitations // under the License. -#include "timestamptz_value.h" +#include "core/value/timestamptz_value.h" -#include "vec/functions/cast/cast_to_datetimev2_impl.hpp" +#include "exprs/function/cast/cast_to_datetimev2_impl.hpp" namespace doris { @@ -25,8 +25,7 @@ const TimestampTzValue TimestampTzValue::FIRST_DAY = TimestampTzValue(DateV2Value::FIRST_DAY.to_date_int_val()); bool TimestampTzValue::from_string(const StringRef& str, const cctz::time_zone* local_time_zone, - vectorized::CastParameters& params, uint32_t to_scale) { - using namespace vectorized; + CastParameters& params, uint32_t to_scale) { if (params.is_strict) { return CastToDatetimeV2::from_string_strict_mode( str, _utc_dt, local_time_zone, to_scale, params); @@ -93,8 +92,8 @@ bool TimestampTzValue::from_datetime(const DateV2Value& ori int tz_scale) { PrimitiveTypeTraits::CppType dt_value; - PROPAGATE_FALSE(vectorized::transform_date_scale(tz_scale, dt_scale, dt_value, - origin_dt.to_date_int_val())); + PROPAGATE_FALSE( + transform_date_scale(tz_scale, dt_scale, dt_value, origin_dt.to_date_int_val())); DateV2Value dt {dt_value}; @@ -115,8 +114,7 @@ bool TimestampTzValue::to_datetime(DateV2Value& dt, int tz_scale) const { PrimitiveTypeTraits::CppType dt_value; - PROPAGATE_FALSE(vectorized::transform_date_scale(dt_scale, tz_scale, dt_value, - _utc_dt.to_date_int_val())); + PROPAGATE_FALSE(transform_date_scale(dt_scale, tz_scale, dt_value, _utc_dt.to_date_int_val())); dt = DateV2Value {dt_value}; diff --git a/be/src/vec/runtime/timestamptz_value.h b/be/src/core/value/timestamptz_value.h similarity index 98% rename from be/src/vec/runtime/timestamptz_value.h rename to be/src/core/value/timestamptz_value.h index 7b7f1139a52f6b..0f95ac7a152acb 100644 --- a/be/src/vec/runtime/timestamptz_value.h +++ b/be/src/core/value/timestamptz_value.h @@ -25,15 +25,13 @@ #include #include "common/status.h" -#include "vec/runtime/vdatetime_value.h" +#include "core/value/vdatetime_value.h" namespace doris { struct StringRef; -namespace vectorized { struct CastParameters; -} // TIMESTAMPTZ can be understood as a DATETIME type with timezone conversion functionality. // Doris automatically handles timezone conversions internally. @@ -65,7 +63,7 @@ class TimestampTzValue { // Parses a string, CastParameters can control whether strict mode is used bool from_string(const StringRef& str, const cctz::time_zone* local_time_zone, - vectorized::CastParameters& params, uint32_t to_scale); + CastParameters& params, uint32_t to_scale); // Converts from a datetime value bool from_datetime(const DateV2Value& dt, diff --git a/be/src/vec/runtime/vdatetime_value.cpp b/be/src/core/value/vdatetime_value.cpp similarity index 98% rename from be/src/vec/runtime/vdatetime_value.cpp rename to be/src/core/value/vdatetime_value.cpp index 6cf1d631fdd6a0..bdec05028f8309 100644 --- a/be/src/vec/runtime/vdatetime_value.cpp +++ b/be/src/core/value/vdatetime_value.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/runtime/vdatetime_value.h" +#include "core/value/vdatetime_value.h" #include #include @@ -39,12 +39,12 @@ #include "common/config.h" #include "common/exception.h" #include "common/status.h" +#include "exec/common/int_exp.h" +#include "exprs/function/cast/cast_parameters.h" +#include "exprs/function/cast/cast_to_date_or_datetime_impl.hpp" +#include "exprs/function/cast/cast_to_datetimev2_impl.hpp" +#include "exprs/function/cast/cast_to_datev2_impl.hpp" #include "util/timezone_utils.h" -#include "vec/common/int_exp.h" -#include "vec/functions/cast/cast_parameters.h" -#include "vec/functions/cast/cast_to_date_or_datetime_impl.hpp" -#include "vec/functions/cast/cast_to_datetimev2_impl.hpp" -#include "vec/functions/cast/cast_to_datev2_impl.hpp" namespace doris { #include "common/compile_check_avoid_begin.h" @@ -87,24 +87,24 @@ bool VecDateTimeValue::check_date(uint32_t year, uint32_t month, uint32_t day) { } bool VecDateTimeValue::from_date_str(const char* date_str, size_t len) { - vectorized::CastParameters params; + CastParameters params; if (type() == TIME_DATE) { - return vectorized::CastToDateOrDatetime::from_string_non_strict_mode( - {date_str, len}, *this, nullptr, params); + return CastToDateOrDatetime::from_string_non_strict_mode({date_str, len}, *this, + nullptr, params); } else { - return vectorized::CastToDateOrDatetime::from_string_non_strict_mode( - {date_str, len}, *this, nullptr, params); + return CastToDateOrDatetime::from_string_non_strict_mode({date_str, len}, *this, + nullptr, params); } } bool VecDateTimeValue::from_date_str(const char* date_str, size_t len, const cctz::time_zone& local_time_zone) { - vectorized::CastParameters params; + CastParameters params; if (type() == TIME_DATE) { - return vectorized::CastToDateOrDatetime::from_string_non_strict_mode( - {date_str, len}, *this, &local_time_zone, params); + return CastToDateOrDatetime::from_string_non_strict_mode({date_str, len}, *this, + &local_time_zone, params); } else { - return vectorized::CastToDateOrDatetime::from_string_non_strict_mode( - {date_str, len}, *this, &local_time_zone, params); + return CastToDateOrDatetime::from_string_non_strict_mode({date_str, len}, *this, + &local_time_zone, params); } } @@ -1806,13 +1806,12 @@ void DateV2Value::format_datetime(uint32_t* date_val, bool* carry_bits) const template bool DateV2Value::from_date_str(const char* date_str, size_t len, int scale /* = -1*/, bool convert_zero) { - vectorized::CastParameters params; + CastParameters params; if constexpr (is_datetime) { - return vectorized::CastToDatetimeV2::from_string_non_strict_mode({date_str, len}, *this, - nullptr, scale, params); + return CastToDatetimeV2::from_string_non_strict_mode({date_str, len}, *this, nullptr, scale, + params); } else { - return vectorized::CastToDateV2::from_string_non_strict_mode({date_str, len}, *this, - nullptr, params); + return CastToDateV2::from_string_non_strict_mode({date_str, len}, *this, nullptr, params); } } @@ -1820,13 +1819,13 @@ template bool DateV2Value::from_date_str(const char* date_str, size_t len, const cctz::time_zone& local_time_zone, int scale /* = -1*/, bool convert_zero) { - vectorized::CastParameters params; + CastParameters params; if constexpr (is_datetime) { - return vectorized::CastToDatetimeV2::from_string_non_strict_mode( - {date_str, len}, *this, &local_time_zone, scale, params); + return CastToDatetimeV2::from_string_non_strict_mode({date_str, len}, *this, + &local_time_zone, scale, params); } else { - return vectorized::CastToDateV2::from_string_non_strict_mode({date_str, len}, *this, - &local_time_zone, params); + return CastToDateV2::from_string_non_strict_mode({date_str, len}, *this, &local_time_zone, + params); } } diff --git a/be/src/vec/runtime/vdatetime_value.h b/be/src/core/value/vdatetime_value.h similarity index 96% rename from be/src/vec/runtime/vdatetime_value.h rename to be/src/core/value/vdatetime_value.h index a9ff6503ddfcb1..e6cc43f285c09a 100644 --- a/be/src/vec/runtime/vdatetime_value.h +++ b/be/src/core/value/vdatetime_value.h @@ -33,7 +33,7 @@ #include #include -#include "runtime/define_primitive_type.h" +#include "core/data_type/define_primitive_type.h" #include "util/hash_util.hpp" #include "util/time_lut.h" #include "util/timezone_utils.h" @@ -42,11 +42,11 @@ namespace cctz { class time_zone; } // namespace cctz -namespace doris::vectorized { +namespace doris { class DataTypeDateTime; class DataTypeDateV2; class DataTypeDateTimeV2; -} // namespace doris::vectorized +} // namespace doris namespace doris { #include "common/compile_check_avoid_begin.h" @@ -230,8 +230,22 @@ struct DateV2ValueType { uint32_t month_ : 4; uint32_t year_ : 23; - DateV2ValueType(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, - uint8_t second, uint32_t microsecond) + /// The library restructuring (splitting Vec into Core, Exprs, Format, Storage) changed the order of static variable initialization. Here's the dependency chain: + /// TimestampTzValue::FIRST_DAY (timestamptz_value.cpp:24-25) — non-inline, dynamic initialization — depends on: + /// DateV2Value::FIRST_DAY (vdatetime_value.h:1489) — inline, also dynamic initialization because the constructors were NOT constexpr + /// Since both are dynamically initialized, the C++ standard provides no ordering guarantee when one static variable's initializer uses another static variable (uses from within initialization are not "non-initialization odr-uses"). The old Vec library happened to initialize them in the correct order; the new Core library does not. + /// + /// When TimestampTzValue::FIRST_DAY is initialized first, it reads a zero-initialized DateV2Value::FIRST_DAY → constructs a zero date (0000-00-00) → is_valid_date() fails on !day → date_add_interval returns false → "Operation week_ceil out of range". + + /// Fix : Made the DateV2ValueType, + /// DateTimeV2ValueType, + ///and DateV2Value(year, month, day, ...) constructors constexpr in + /// vdatetime_value.h.This makes DateV2Value::FIRST_DAY and DEFAULT_VALUE constant + /// - initialized(guaranteed to happen before any dynamic initialization), + /// so TimestampTzValue::FIRST_DAY always sees the correct value + /// regardless of library link order.** / + constexpr DateV2ValueType(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, + uint8_t minute, uint8_t second, uint32_t microsecond) : day_(day), month_(month), year_(year) {} }; @@ -244,8 +258,8 @@ struct DateTimeV2ValueType { uint64_t month_ : 4; uint64_t year_ : 18; - DateTimeV2ValueType(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, - uint8_t second, uint32_t microsecond) + constexpr DateTimeV2ValueType(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, + uint8_t minute, uint8_t second, uint32_t microsecond) : microsecond_(microsecond), second_(second), minute_(minute), @@ -1471,8 +1485,8 @@ class DateV2Value { underlying_value int_val_; }; - DateV2Value(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, - uint8_t second, uint32_t microsecond) + constexpr DateV2Value(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, + uint8_t second, uint32_t microsecond) : date_v2_value_(year, month, day, hour, minute, second, microsecond) {} }; @@ -1791,19 +1805,19 @@ struct DateTraits {}; template <> struct DateTraits { using T = VecDateTimeValue; - using DateType = vectorized::DataTypeDateTime; + using DateType = DataTypeDateTime; }; template <> struct DateTraits { using T = DateV2Value; - using DateType = vectorized::DataTypeDateV2; + using DateType = DataTypeDateV2; }; template <> struct DateTraits { using T = DateV2Value; - using DateType = vectorized::DataTypeDateTimeV2; + using DateType = DataTypeDateTimeV2; }; #include "common/compile_check_avoid_end.h" } // namespace doris diff --git a/be/src/vec/core/wide_integer.h b/be/src/core/wide_integer.h similarity index 95% rename from be/src/vec/core/wide_integer.h rename to be/src/core/wide_integer.h index 16f0ac7e0caa08..08d542e4b8517c 100644 --- a/be/src/vec/core/wide_integer.h +++ b/be/src/core/wide_integer.h @@ -77,6 +77,8 @@ class integer { using base_type = uint64_t; using signed_base_type = int64_t; + static constexpr size_t item_count = Bits / 8 / sizeof(base_type); + // ctors constexpr integer() noexcept = default; @@ -143,25 +145,18 @@ class integer { constexpr operator double() const noexcept; constexpr operator float() const noexcept; - std::string to_hex_string() const { - std::ostringstream os; - os << std::setw(16) << std::setfill('0') << std::hex; - for (size_t i = 0; i < _impl::item_count; i++) { - os << items[i]; - } - return os.str(); - } + std::string to_hex_string() const; struct _impl; - base_type items[_impl::item_count]; + base_type items[item_count]; uint64_t low() const { - static_assert(_impl::item_count == 2); + static_assert(item_count == 2); return items[0]; } uint64_t high() const { - static_assert(_impl::item_count == 2); + static_assert(item_count == 2); return items[1]; } @@ -323,4 +318,18 @@ constexpr auto operator<=>(const Arithmetic& rhs, const Arithmetic2& lhs); // NOLINTEND(*) -#include "wide_integer_impl.h" +#include "core/wide_integer_impl.h" + +namespace wide { + +template +inline std::string integer::to_hex_string() const { + std::ostringstream os; + os << std::setw(16) << std::setfill('0') << std::hex; + for (size_t i = 0; i < item_count; i++) { + os << items[i]; + } + return os.str(); +} + +} // namespace wide diff --git a/be/src/vec/core/wide_integer_impl.h b/be/src/core/wide_integer_impl.h similarity index 100% rename from be/src/vec/core/wide_integer_impl.h rename to be/src/core/wide_integer_impl.h diff --git a/be/src/vec/core/wide_integer_to_string.cpp b/be/src/core/wide_integer_to_string.cpp similarity index 97% rename from be/src/vec/core/wide_integer_to_string.cpp rename to be/src/core/wide_integer_to_string.cpp index f392a627ff69a6..a0b98195038389 100644 --- a/be/src/vec/core/wide_integer_to_string.cpp +++ b/be/src/core/wide_integer_to_string.cpp @@ -18,12 +18,14 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/base/base/wide_integer_to_string.cpp // and modified by Doris +#include "core/wide_integer_to_string.h" + #include -#include -#include #include +#include "core/wide_integer.h" + namespace wide { template diff --git a/be/src/vec/core/wide_integer_to_string.h b/be/src/core/wide_integer_to_string.h similarity index 100% rename from be/src/vec/core/wide_integer_to_string.h rename to be/src/core/wide_integer_to_string.h diff --git a/be/src/exec/CMakeLists.txt b/be/src/exec/CMakeLists.txt index 1f9da86abfab5c..10f59e25dbb90e 100644 --- a/be/src/exec/CMakeLists.txt +++ b/be/src/exec/CMakeLists.txt @@ -23,6 +23,9 @@ set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/src/exec") file(GLOB_RECURSE EXEC_FILES CONFIGURE_DEPENDS *.cpp) +# Task executor simulator files are built as a separate executable +list(FILTER EXEC_FILES EXCLUDE REGEX ".*scan/task_executor/tools/simulator/.*") + if (WITH_LZO) set(EXEC_FILES ${EXEC_FILES} lzo_decompressor.cpp @@ -33,4 +36,32 @@ add_library(Exec STATIC ${EXEC_FILES} ) -pch_reuse(Exec) \ No newline at end of file +pch_reuse(Exec) + +if (${BUILD_TASK_EXECUTOR_SIMULATOR} STREQUAL "ON") + file(GLOB_RECURSE SIMULATOR_FILES CONFIGURE_DEPENDS + "${CMAKE_CURRENT_SOURCE_DIR}/scan/task_executor/tools/simulator/*.cpp" + ) + message(STATUS "Add Task Executor Simulator To Build") + add_executable(task_executor_simulator ${SIMULATOR_FILES}) + + pch_reuse(task_executor_simulator) + + # This permits libraries loaded by dlopen to link to the symbols in the program. + set_target_properties(task_executor_simulator PROPERTIES ENABLE_EXPORTS 1) + + target_link_libraries(task_executor_simulator + ${DORIS_LINK_LIBS} + ) + + install(DIRECTORY DESTINATION ${OUTPUT_DIR}/lib/) + install(TARGETS task_executor_simulator DESTINATION ${OUTPUT_DIR}/lib/) + + if (NOT OS_MACOSX) + add_custom_command(TARGET task_executor_simulator POST_BUILD + COMMAND ${CMAKE_OBJCOPY} --only-keep-debug $ $.dbg + COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $ + COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=$.dbg $ + ) + endif() +endif() \ No newline at end of file diff --git a/be/src/pipeline/common/agg_utils.h b/be/src/exec/common/agg_utils.h similarity index 53% rename from be/src/pipeline/common/agg_utils.h rename to be/src/exec/common/agg_utils.h index f676013c27f002..fada1b49e30095 100644 --- a/be/src/pipeline/common/agg_utils.h +++ b/be/src/exec/common/agg_utils.h @@ -20,149 +20,124 @@ #include #include -#include "vec/common/arena.h" -#include "vec/common/hash_table/hash_map_context.h" -#include "vec/common/hash_table/hash_map_util.h" -#include "vec/common/hash_table/ph_hash_map.h" -#include "vec/common/hash_table/string_hash_map.h" +#include "core/arena.h" +#include "exec/common/hash_table/hash_map_context.h" +#include "exec/common/hash_table/hash_map_util.h" +#include "exec/common/hash_table/ph_hash_map.h" +#include "exec/common/hash_table/string_hash_map.h" namespace doris { template -using AggData = PHHashMap>; +using AggData = PHHashMap>; template -using AggDataNullable = vectorized::DataWithNullKey>; +using AggDataNullable = DataWithNullKey>; -using AggregatedDataWithoutKey = vectorized::AggregateDataPtr; -using AggregatedDataWithStringKey = PHHashMap; -using AggregatedDataWithShortStringKey = StringHashMap; +using AggregatedDataWithoutKey = AggregateDataPtr; +using AggregatedDataWithStringKey = PHHashMap; +using AggregatedDataWithShortStringKey = StringHashMap; using AggregatedDataWithUInt32KeyPhase2 = - PHHashMap>; + PHHashMap>; using AggregatedDataWithUInt64KeyPhase2 = - PHHashMap>; + PHHashMap>; using AggregatedDataWithNullableUInt32KeyPhase2 = - vectorized::DataWithNullKey; + DataWithNullKey; using AggregatedDataWithNullableUInt64KeyPhase2 = - vectorized::DataWithNullKey; -using AggregatedDataWithNullableShortStringKey = - vectorized::DataWithNullKey; + DataWithNullKey; +using AggregatedDataWithNullableShortStringKey = DataWithNullKey; using AggregatedMethodVariants = std::variant< - std::monostate, vectorized::MethodSerialized, - vectorized::MethodOneNumber>, - vectorized::MethodOneNumber>, - vectorized::MethodOneNumber>, - vectorized::MethodOneNumber>, - vectorized::MethodStringNoCache, - vectorized::MethodOneNumber>, - vectorized::MethodOneNumber>, - vectorized::MethodOneNumber, - vectorized::MethodOneNumber, - vectorized::MethodSingleNullableColumn< - vectorized::MethodOneNumber>>, - vectorized::MethodSingleNullableColumn>>, - vectorized::MethodSingleNullableColumn>>, - vectorized::MethodSingleNullableColumn>>, - vectorized::MethodSingleNullableColumn>, - vectorized::MethodSingleNullableColumn>, - vectorized::MethodSingleNullableColumn>>, - vectorized::MethodSingleNullableColumn>>, - vectorized::MethodSingleNullableColumn< - vectorized::MethodStringNoCache>, - vectorized::MethodKeysFixed>, - vectorized::MethodKeysFixed>, - vectorized::MethodKeysFixed>, - vectorized::MethodKeysFixed>, - vectorized::MethodKeysFixed>, - vectorized::MethodKeysFixed>, - vectorized::MethodKeysFixed>>; + std::monostate, MethodSerialized, + MethodOneNumber>, MethodOneNumber>, + MethodOneNumber>, MethodOneNumber>, + MethodStringNoCache, + MethodOneNumber>, MethodOneNumber>, + MethodOneNumber, + MethodOneNumber, + MethodSingleNullableColumn>>, + MethodSingleNullableColumn>>, + MethodSingleNullableColumn>>, + MethodSingleNullableColumn>>, + MethodSingleNullableColumn< + MethodOneNumber>, + MethodSingleNullableColumn< + MethodOneNumber>, + MethodSingleNullableColumn>>, + MethodSingleNullableColumn>>, + MethodSingleNullableColumn>, + MethodKeysFixed>, MethodKeysFixed>, + MethodKeysFixed>, MethodKeysFixed>, + MethodKeysFixed>, MethodKeysFixed>, + MethodKeysFixed>>; struct AggregatedDataVariants - : public DataVariants { + : public DataVariants { AggregatedDataWithoutKey without_key = nullptr; - void init(const std::vector& data_types, HashKeyType type) { + void init(const std::vector& data_types, HashKeyType type) { bool nullable = data_types.size() == 1 && data_types[0]->is_nullable(); switch (type) { case HashKeyType::without_key: break; case HashKeyType::serialized: - method_variant.emplace>(); + method_variant.emplace>(); break; case HashKeyType::int8_key: - emplace_single>(nullable); + emplace_single>(nullable); break; case HashKeyType::int16_key: - emplace_single>(nullable); + emplace_single>(nullable); break; case HashKeyType::int32_key: - emplace_single>(nullable); + emplace_single>(nullable); break; case HashKeyType::int32_key_phase2: - emplace_single(nullable); + emplace_single(nullable); break; case HashKeyType::int64_key: - emplace_single>(nullable); + emplace_single>(nullable); break; case HashKeyType::int64_key_phase2: - emplace_single(nullable); + emplace_single(nullable); break; case HashKeyType::int128_key: - emplace_single>(nullable); + emplace_single>(nullable); break; case HashKeyType::int256_key: - emplace_single>(nullable); + emplace_single>(nullable); break; case HashKeyType::string_key: if (nullable) { - method_variant.emplace< - vectorized::MethodSingleNullableColumn>>(); + method_variant.emplace>>(); } else { - method_variant.emplace< - vectorized::MethodStringNoCache>(); + method_variant.emplace>(); } break; case HashKeyType::fixed64: - method_variant.emplace>>( - get_key_sizes(data_types)); + method_variant.emplace>>(get_key_sizes(data_types)); break; case HashKeyType::fixed72: - method_variant.emplace>>( - get_key_sizes(data_types)); + method_variant.emplace>>(get_key_sizes(data_types)); break; case HashKeyType::fixed96: - method_variant.emplace>>( - get_key_sizes(data_types)); + method_variant.emplace>>(get_key_sizes(data_types)); break; case HashKeyType::fixed104: - method_variant.emplace>>( - get_key_sizes(data_types)); + method_variant.emplace>>(get_key_sizes(data_types)); break; case HashKeyType::fixed128: - method_variant.emplace>>( - get_key_sizes(data_types)); + method_variant.emplace>>(get_key_sizes(data_types)); break; case HashKeyType::fixed136: - method_variant.emplace>>( - get_key_sizes(data_types)); + method_variant.emplace>>(get_key_sizes(data_types)); break; case HashKeyType::fixed256: - method_variant.emplace>>( - get_key_sizes(data_types)); + method_variant.emplace>>(get_key_sizes(data_types)); break; default: throw Exception(ErrorCode::INTERNAL_ERROR, @@ -172,7 +147,7 @@ struct AggregatedDataVariants }; using AggregatedDataVariantsUPtr = std::unique_ptr; -using ArenaUPtr = std::unique_ptr; +using ArenaUPtr = std::unique_ptr; struct AggregateDataContainer { public: @@ -182,7 +157,7 @@ struct AggregateDataContainer { int64_t memory_usage() const { return _arena_pool.size(); } template - vectorized::AggregateDataPtr append_data(const KeyType& key) { + AggregateDataPtr append_data(const KeyType& key) { DCHECK_EQ(sizeof(KeyType), _size_of_key); // SUB_CONTAINER_CAPACITY should add a new sub container, and also expand when it is zero if (UNLIKELY(_index_in_sub_container % SUB_CONTAINER_CAPACITY == 0)) { @@ -238,7 +213,7 @@ struct AggregateDataContainer { [index_in_sub_container]; } - vectorized::AggregateDataPtr get_aggregate_data() { + AggregateDataPtr get_aggregate_data() { return &(container->_value_containers[sub_container_index] [container->_size_of_aggregate_states * index_in_sub_container]); @@ -305,8 +280,8 @@ struct AggregateDataContainer { _current_keys = _arena_pool.alloc(_size_of_key * SUB_CONTAINER_CAPACITY); _key_containers.emplace_back(_current_keys); - _current_agg_data = (vectorized::AggregateDataPtr)_arena_pool.alloc( - _size_of_aggregate_states * SUB_CONTAINER_CAPACITY); + _current_agg_data = (AggregateDataPtr)_arena_pool.alloc(_size_of_aggregate_states * + SUB_CONTAINER_CAPACITY); _value_containers.emplace_back(_current_agg_data); } catch (...) { if (_current_keys) { @@ -322,10 +297,10 @@ struct AggregateDataContainer { } static constexpr uint32_t SUB_CONTAINER_CAPACITY = 8192; - vectorized::Arena _arena_pool; + Arena _arena_pool; std::vector _key_containers; - std::vector _value_containers; - vectorized::AggregateDataPtr _current_agg_data = nullptr; + std::vector _value_containers; + AggregateDataPtr _current_agg_data = nullptr; char* _current_keys = nullptr; size_t _size_of_key {}; size_t _size_of_aggregate_states {}; diff --git a/be/src/vec/common/arithmetic_overflow.h b/be/src/exec/common/arithmetic_overflow.h similarity index 99% rename from be/src/vec/common/arithmetic_overflow.h rename to be/src/exec/common/arithmetic_overflow.h index 74e1700c1f64f5..ddf79dce2cc46d 100644 --- a/be/src/vec/common/arithmetic_overflow.h +++ b/be/src/exec/common/arithmetic_overflow.h @@ -20,7 +20,7 @@ #pragma once -#include "vec/core/extended_types.h" +#include "core/extended_types.h" namespace common { template inline bool add_overflow(T x, T y, T& res) { diff --git a/be/src/vec/utils/arrow_column_to_doris_column.cpp b/be/src/exec/common/arrow_column_to_doris_column.cpp similarity index 86% rename from be/src/vec/utils/arrow_column_to_doris_column.cpp rename to be/src/exec/common/arrow_column_to_doris_column.cpp index ed931af947777f..cd6e959596791b 100644 --- a/be/src/vec/utils/arrow_column_to_doris_column.cpp +++ b/be/src/exec/common/arrow_column_to_doris_column.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/utils/arrow_column_to_doris_column.h" +#include "exec/common/arrow_column_to_doris_column.h" #include #include @@ -35,20 +35,20 @@ #include "arrow/array/array_nested.h" #include "arrow/type.h" #include "common/status.h" -#include "util/binary_cast.hpp" +#include "core/assert_cast.h" +#include "core/binary_cast.hpp" +#include "core/column/column.h" +#include "core/column/column_array.h" +#include "core/column/column_decimal.h" +#include "core/column/column_nullable.h" +#include "core/column/column_string.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type/data_type_decimal.h" +#include "core/data_type/data_type_nullable.h" +#include "core/types.h" +#include "core/value/vdatetime_value.h" #include "util/timezone_utils.h" -#include "vec/columns/column.h" -#include "vec/columns/column_array.h" -#include "vec/columns/column_decimal.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_string.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type_array.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/runtime/vdatetime_value.h" #define FOR_ARROW_TYPES(M) \ M(::arrow::Type::BOOL, TYPE_BOOLEAN) \ @@ -71,7 +71,7 @@ M(::arrow::Type::DATE64, TYPE_DATETIME) \ M(::arrow::Type::DECIMAL, TYPE_DECIMALV2) -namespace doris::vectorized { +namespace doris { PrimitiveType arrow_type_to_primitive_type(::arrow::Type::type type) { switch (type) { @@ -106,4 +106,4 @@ Status arrow_column_to_doris_column(const arrow::Array* arrow_column, size_t arr return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/utils/arrow_column_to_doris_column.h b/be/src/exec/common/arrow_column_to_doris_column.h similarity index 92% rename from be/src/vec/utils/arrow_column_to_doris_column.h rename to be/src/exec/common/arrow_column_to_doris_column.h index 285030bb813855..d25c1ff0797d53 100644 --- a/be/src/vec/utils/arrow_column_to_doris_column.h +++ b/be/src/exec/common/arrow_column_to_doris_column.h @@ -23,8 +23,8 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" -#include "vec/data_types/data_type.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" namespace arrow { class Array; @@ -35,7 +35,7 @@ class time_zone; // This files contains some utilities to convert Doris internal // data format from Apache Arrow format. -namespace doris::vectorized { +namespace doris { PrimitiveType arrow_type_to_primitive_type(::arrow::Type::type type); @@ -48,4 +48,4 @@ Status arrow_column_to_doris_column(const arrow::Array* arrow_column, size_t arr ColumnPtr& doris_column, const DataTypePtr& type, size_t num_elements, const cctz::time_zone& ctz); -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/bit_helpers.h b/be/src/exec/common/bit_helpers.h similarity index 96% rename from be/src/vec/common/bit_helpers.h rename to be/src/exec/common/bit_helpers.h index 13db63e4df5dc0..10265b17594650 100644 --- a/be/src/vec/common/bit_helpers.h +++ b/be/src/exec/common/bit_helpers.h @@ -20,7 +20,7 @@ #pragma once -namespace doris::vectorized { +namespace doris { template inline uint32_t get_leading_zero_bits_unsafe(T x) { @@ -42,4 +42,4 @@ inline uint32_t bit_scan_reverse(T x) { get_leading_zero_bits_unsafe(x); } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/common/columns_hashing.h b/be/src/exec/common/columns_hashing.h similarity index 94% rename from be/src/vec/common/columns_hashing.h rename to be/src/exec/common/columns_hashing.h index 60c2370bc6086a..3ed5a8d58b463e 100644 --- a/be/src/vec/common/columns_hashing.h +++ b/be/src/exec/common/columns_hashing.h @@ -24,16 +24,16 @@ #include #include -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/columns/column_string.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/common/columns_hashing_impl.h" -#include "vec/common/hash_table/ph_hash_map.h" -#include "vec/common/string_ref.h" -#include "vec/common/unaligned.h" +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/column/column_string.h" +#include "core/string_ref.h" +#include "exec/common/columns_hashing_impl.h" +#include "exec/common/hash_table/ph_hash_map.h" +#include "exprs/aggregate/aggregate_function.h" +#include "util/unaligned.h" -namespace doris::vectorized { +namespace doris { using Sizes = std::vector; @@ -164,4 +164,4 @@ struct HashMethodSingleLowNullableColumn : public SingleColumnMethod { }; } // namespace ColumnsHashing -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/columns_hashing_impl.h b/be/src/exec/common/columns_hashing_impl.h similarity index 94% rename from be/src/vec/common/columns_hashing_impl.h rename to be/src/exec/common/columns_hashing_impl.h index a11ec17ec70527..d6758c163c35da 100644 --- a/be/src/vec/common/columns_hashing_impl.h +++ b/be/src/exec/common/columns_hashing_impl.h @@ -20,13 +20,13 @@ #pragma once -#include "vec/columns/column.h" -#include "vec/columns/column_nullable.h" -#include "vec/common/assert_cast.h" -#include "vec/common/hash_table/ph_hash_map.h" -#include "vec/common/hash_table/ph_hash_set.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_nullable.h" +#include "exec/common/hash_table/ph_hash_map.h" +#include "exec/common/hash_table/ph_hash_set.h" -namespace doris::vectorized { +namespace doris { namespace ColumnsHashing { @@ -153,4 +153,4 @@ class HashMethodBase { } // namespace ColumnsHashing -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/pipeline/common/data_gen_functions/vdata_gen_function_inf.h b/be/src/exec/common/data_gen_functions/vdata_gen_function_inf.h similarity index 90% rename from be/src/pipeline/common/data_gen_functions/vdata_gen_function_inf.h rename to be/src/exec/common/data_gen_functions/vdata_gen_function_inf.h index bb9ffdb74b7bc3..2fc47bb995d72a 100644 --- a/be/src/pipeline/common/data_gen_functions/vdata_gen_function_inf.h +++ b/be/src/exec/common/data_gen_functions/vdata_gen_function_inf.h @@ -20,8 +20,8 @@ #include #include "common/global_types.h" +#include "core/block/block.h" #include "runtime/descriptors.h" -#include "vec/core/block.h" namespace doris { @@ -29,8 +29,6 @@ class RuntimeState; class Status; class TScanRangeParams; -namespace pipeline { - class VDataGenFunctionInf { public: VDataGenFunctionInf(TupleId tuple_id, const TupleDescriptor* tuple_desc) @@ -40,7 +38,7 @@ class VDataGenFunctionInf { // Should set function parameters in this method virtual Status set_scan_ranges(const std::vector& scan_ranges) = 0; - virtual Status get_next(RuntimeState* state, vectorized::Block* block, bool* eos) = 0; + virtual Status get_next(RuntimeState* state, Block* block, bool* eos) = 0; Status close(RuntimeState* state) { return Status::OK(); } void set_tuple_desc(const TupleDescriptor* tuple_desc) { _tuple_desc = tuple_desc; } @@ -51,6 +49,4 @@ class VDataGenFunctionInf { const TupleDescriptor* _tuple_desc = nullptr; }; -} // namespace pipeline - } // namespace doris diff --git a/be/src/pipeline/common/data_gen_functions/vnumbers_tvf.cpp b/be/src/exec/common/data_gen_functions/vnumbers_tvf.cpp similarity index 77% rename from be/src/pipeline/common/data_gen_functions/vnumbers_tvf.cpp rename to be/src/exec/common/data_gen_functions/vnumbers_tvf.cpp index d1cdb499f05958..d1d4f91270f409 100644 --- a/be/src/pipeline/common/data_gen_functions/vnumbers_tvf.cpp +++ b/be/src/exec/common/data_gen_functions/vnumbers_tvf.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/common/data_gen_functions/vnumbers_tvf.h" +#include "exec/common/data_gen_functions/vnumbers_tvf.h" #include #include @@ -25,26 +25,26 @@ #include #include "common/status.h" +#include "core/assert_cast.h" +#include "core/block/block.h" +#include "core/block/column_with_type_and_name.h" +#include "core/column/column.h" +#include "core/data_type/data_type.h" +#include "core/types.h" #include "runtime/descriptors.h" #include "runtime/runtime_state.h" -#include "vec/columns/column.h" -#include "vec/common/assert_cast.h" -#include "vec/core/block.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -namespace doris::pipeline { +namespace doris { VNumbersTVF::VNumbersTVF(TupleId tuple_id, const TupleDescriptor* tuple_desc) : VDataGenFunctionInf(tuple_id, tuple_desc) {} -Status VNumbersTVF::get_next(RuntimeState* state, vectorized::Block* block, bool* eos) { +Status VNumbersTVF::get_next(RuntimeState* state, Block* block, bool* eos) { DCHECK(block->rows() == 0); RETURN_IF_CANCELLED(state); bool mem_reuse = block->mem_reuse(); int batch_size = state->batch_size(); - std::vector columns(_slot_num); + std::vector columns(_slot_num); // now only support one column for tvf numbers for (int i = 0; i < _slot_num; ++i) { @@ -58,7 +58,7 @@ Status VNumbersTVF::get_next(RuntimeState* state, vectorized::Block* block, bool *eos = true; continue; } - auto* column_res = assert_cast(columns[i].get()); //BIGINT + auto* column_res = assert_cast(columns[i].get()); //BIGINT int64_t end_value = std::min((int64_t)(_next_number + batch_size), _total_numbers); if (_use_const) { column_res->insert_many_vals(_const_value, end_value - _next_number); @@ -77,9 +77,9 @@ Status VNumbersTVF::get_next(RuntimeState* state, vectorized::Block* block, bool } else { size_t n_columns = 0; for (const auto* slot_desc : _tuple_desc->slots()) { - block->insert(vectorized::ColumnWithTypeAndName(std::move(columns[n_columns++]), - slot_desc->get_data_type_ptr(), - slot_desc->col_name())); + block->insert(ColumnWithTypeAndName(std::move(columns[n_columns++]), + slot_desc->get_data_type_ptr(), + slot_desc->col_name())); } } return Status::OK(); @@ -96,4 +96,4 @@ Status VNumbersTVF::set_scan_ranges(const std::vector& scan_ra return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/common/data_gen_functions/vnumbers_tvf.h b/be/src/exec/common/data_gen_functions/vnumbers_tvf.h similarity index 87% rename from be/src/pipeline/common/data_gen_functions/vnumbers_tvf.h rename to be/src/exec/common/data_gen_functions/vnumbers_tvf.h index bf8b117a378115..70d4b016fb7108 100644 --- a/be/src/pipeline/common/data_gen_functions/vnumbers_tvf.h +++ b/be/src/exec/common/data_gen_functions/vnumbers_tvf.h @@ -21,7 +21,7 @@ #include #include "common/global_types.h" -#include "pipeline/common/data_gen_functions/vdata_gen_function_inf.h" +#include "exec/common/data_gen_functions/vdata_gen_function_inf.h" namespace doris { @@ -30,7 +30,6 @@ class RuntimeState; class Status; class TScanRangeParams; -namespace pipeline { class Block; class VNumbersTVF : public VDataGenFunctionInf { @@ -38,7 +37,7 @@ class VNumbersTVF : public VDataGenFunctionInf { VNumbersTVF(TupleId tuple_id, const TupleDescriptor* tuple_desc); ~VNumbersTVF() override = default; - Status get_next(RuntimeState* state, vectorized::Block* block, bool* eos) override; + Status get_next(RuntimeState* state, Block* block, bool* eos) override; Status set_scan_ranges(const std::vector& scan_ranges) override; @@ -51,6 +50,4 @@ class VNumbersTVF : public VDataGenFunctionInf { int64_t _next_number = 0; }; -} // namespace pipeline - } // namespace doris diff --git a/be/src/exec/common/distinct_agg_utils.h b/be/src/exec/common/distinct_agg_utils.h new file mode 100644 index 00000000000000..9fcdcba3a4efc3 --- /dev/null +++ b/be/src/exec/common/distinct_agg_utils.h @@ -0,0 +1,179 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include +#include + +#include "core/arena.h" +#include "core/types.h" +#include "exec/common/hash_table/hash_map_context.h" +#include "exec/common/hash_table/hash_map_util.h" +#include "exec/common/hash_table/ph_hash_map.h" +#include "exec/common/hash_table/ph_hash_set.h" +#include "exec/common/hash_table/string_hash_map.h" + +namespace doris { + +template +struct DistinctHashSetType { + using HashSet = PHHashSet>; +}; + +template <> +struct DistinctHashSetType { + using HashSet = SmallFixedSizeHashSet; +}; + +template <> +struct DistinctHashSetType { + using HashSet = SmallFixedSizeHashSet; +}; + +template +struct DistinctPhase2HashSetType { + using HashSet = PHHashSet>; +}; + +template <> +struct DistinctPhase2HashSetType { + using HashSet = SmallFixedSizeHashSet; +}; + +template <> +struct DistinctPhase2HashSetType { + using HashSet = SmallFixedSizeHashSet; +}; + +template +using DistinctData = typename DistinctHashSetType::HashSet; + +template +using DistinctDataPhase2 = typename DistinctPhase2HashSetType::HashSet; + +using DistinctDataWithStringKey = PHHashSet; + +// todo: Need to implement StringHashSet like StringHashMap +using DistinctDataWithShortStringKey = PHHashSet; + +using DistinctMethodVariants = std::variant< + std::monostate, MethodSerialized, + MethodOneNumber>, MethodOneNumber>, + MethodOneNumber>, + MethodOneNumber>, + MethodStringNoCache, + MethodOneNumber>, + MethodOneNumber>, + MethodOneNumber>, + MethodOneNumber>, + MethodSingleNullableColumn>>>, + MethodSingleNullableColumn>>>, + MethodSingleNullableColumn>>>, + MethodSingleNullableColumn>>>, + MethodSingleNullableColumn< + MethodOneNumber>>>, + MethodSingleNullableColumn< + MethodOneNumber>>>, + MethodSingleNullableColumn< + MethodOneNumber>>>, + MethodSingleNullableColumn< + MethodOneNumber>>>, + MethodSingleNullableColumn< + MethodStringNoCache>>, + MethodKeysFixed>, MethodKeysFixed>, + MethodKeysFixed>, MethodKeysFixed>, + MethodKeysFixed>, MethodKeysFixed>, + MethodKeysFixed>>; + +struct DistinctDataVariants + : public DataVariants { + void init(const std::vector& data_types, HashKeyType type) { + bool nullable = data_types.size() == 1 && data_types[0]->is_nullable(); + switch (type) { + case HashKeyType::serialized: + method_variant.emplace>(); + break; + case HashKeyType::int8_key: + emplace_single>(nullable); + break; + case HashKeyType::int16_key: + emplace_single>(nullable); + break; + case HashKeyType::int32_key: + emplace_single>(nullable); + break; + case HashKeyType::int32_key_phase2: + emplace_single>(nullable); + break; + case HashKeyType::int64_key: + emplace_single>(nullable); + break; + case HashKeyType::int64_key_phase2: + emplace_single>(nullable); + break; + case HashKeyType::int128_key: + emplace_single>(nullable); + break; + case HashKeyType::int256_key: + emplace_single>(nullable); + break; + case HashKeyType::string_key: + if (nullable) { + method_variant.emplace>>>(); + } else { + method_variant.emplace>(); + } + break; + case HashKeyType::fixed64: + method_variant.emplace>>( + get_key_sizes(data_types)); + break; + case HashKeyType::fixed72: + method_variant.emplace>>( + get_key_sizes(data_types)); + break; + case HashKeyType::fixed96: + method_variant.emplace>>( + get_key_sizes(data_types)); + break; + case HashKeyType::fixed104: + method_variant.emplace>>( + get_key_sizes(data_types)); + break; + case HashKeyType::fixed128: + method_variant.emplace>>( + get_key_sizes(data_types)); + break; + case HashKeyType::fixed136: + method_variant.emplace>>( + get_key_sizes(data_types)); + break; + case HashKeyType::fixed256: + method_variant.emplace>>( + get_key_sizes(data_types)); + break; + default: + throw Exception(ErrorCode::INTERNAL_ERROR, + "AggregatedDataVariants meet invalid key type, type={}", type); + } + } +}; + +} // namespace doris diff --git a/be/src/vec/common/endian.h b/be/src/exec/common/endian.h similarity index 98% rename from be/src/vec/common/endian.h rename to be/src/exec/common/endian.h index 48b1ad771c3ba1..acc240b6c80811 100644 --- a/be/src/vec/common/endian.h +++ b/be/src/exec/common/endian.h @@ -17,9 +17,9 @@ #pragma once -#include "olap/uint24.h" -#include "vec/common/unaligned.h" -#include "vec/core/extended_types.h" +#include "core/extended_types.h" +#include "core/uint24.h" +#include "util/unaligned.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/vec/common/field_visitors.h b/be/src/exec/common/field_visitors.h similarity index 97% rename from be/src/vec/common/field_visitors.h rename to be/src/exec/common/field_visitors.h index cd0dcb330300c8..8b14b6bbd17626 100644 --- a/be/src/vec/common/field_visitors.h +++ b/be/src/exec/common/field_visitors.h @@ -20,14 +20,14 @@ #pragma once +#include "common/demangle.h" #include "common/exception.h" #include "common/status.h" -#include "runtime/primitive_type.h" -#include "vec/common/demangle.h" -#include "vec/core/accurate_comparison.h" -#include "vec/core/field.h" +#include "core/accurate_comparison.h" +#include "core/data_type/primitive_type.h" +#include "core/field.h" -namespace doris::vectorized { +namespace doris { /** StaticVisitor (and its descendants) - class with overloaded operator() for all types of fields. * You could call visitor for field using function 'apply_visitor'. @@ -146,4 +146,4 @@ typename std::decay_t::ResultType apply_visitor(Visitor&& visitor, F&& } } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/format_ip.cpp b/be/src/exec/common/format_ip.cpp similarity index 96% rename from be/src/vec/common/format_ip.cpp rename to be/src/exec/common/format_ip.cpp index d9f5ffd45ddaeb..30cad6a79db855 100644 --- a/be/src/vec/common/format_ip.cpp +++ b/be/src/exec/common/format_ip.cpp @@ -18,12 +18,12 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/formatIPv6.cpp // and modified by Doris -#include "vec/common/format_ip.h" +#include "exec/common/format_ip.h" #include #include -namespace doris::vectorized { +namespace doris { /** Further we want to generate constexpr array of strings with sizes from sequence of unsigned ints [0..N) * in order to use this arrey for fast conversion of unsigned integers to strings @@ -74,4 +74,4 @@ consteval std::array, N> str_make_array() { extern constexpr std::array, 256> one_byte_to_string_lookup_table = str_make_array<256>(); -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/format_ip.h b/be/src/exec/common/format_ip.h similarity index 99% rename from be/src/vec/common/format_ip.h rename to be/src/exec/common/format_ip.h index 3b6a5483998460..42e6cc918f2aef 100644 --- a/be/src/vec/common/format_ip.h +++ b/be/src/exec/common/format_ip.h @@ -20,10 +20,6 @@ #pragma once -#include -#include -#include - #include #include #include @@ -31,6 +27,10 @@ #include #include +#include "core/types.h" +#include "exec/common/hex.h" +#include "exec/common/string_utils/string_utils.h" + constexpr size_t IPV4_BINARY_LENGTH = 4; constexpr size_t IPV4_MAX_TEXT_LENGTH = 15; /// Does not count tail zero byte. constexpr size_t IPV6_MAX_TEXT_LENGTH = 39; @@ -41,7 +41,7 @@ constexpr size_t IPV4_OCTET_BITS = 8; constexpr size_t DECIMAL_BASE = 10; constexpr size_t IPV6_BINARY_LENGTH = 16; -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" extern const std::array, 256> one_byte_to_string_lookup_table; @@ -496,4 +496,4 @@ inline bool parse_ipv6_whole(const char* src, unsigned char* dst) { } #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/hash_table/hash.h b/be/src/exec/common/hash_table/hash.h similarity index 74% rename from be/src/vec/common/hash_table/hash.h rename to be/src/exec/common/hash_table/hash.h index 786a19ba2afd91..e8487bf4c8db96 100644 --- a/be/src/vec/common/hash_table/hash.h +++ b/be/src/exec/common/hash_table/hash.h @@ -22,11 +22,11 @@ #include +#include "core/extended_types.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "core/uint128.h" #include "parallel_hashmap/phmap_utils.h" -#include "vec/common/string_ref.h" -#include "vec/common/uint128.h" -#include "vec/core/extended_types.h" -#include "vec/core/types.h" // Here is an empirical value. static constexpr size_t HASH_MAP_PREFETCH_DIST = 16; @@ -45,7 +45,7 @@ static constexpr size_t HASH_MAP_PREFETCH_DIST = 16; /** Taken from MurmurHash. This is Murmur finalizer. * Faster than int_hash32 when inserting into the hash table UInt64 -> UInt64, where the key is the visitor ID. */ -inline doris::vectorized::UInt64 int_hash64(doris::vectorized::UInt64 x) { +inline doris::UInt64 int_hash64(doris::UInt64 x) { x ^= x >> 33; x *= 0xff51afd7ed558ccdULL; x ^= x >> 33; @@ -63,7 +63,7 @@ inline doris::vectorized::UInt64 int_hash64(doris::vectorized::UInt64 x) { */ #include "util/sse_util.hpp" -inline doris::vectorized::UInt64 int_hash_crc32(doris::vectorized::UInt64 x) { +inline doris::UInt64 int_hash_crc32(doris::UInt64 x) { #if defined(__SSE4_2__) || (defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)) return _mm_crc32_u64(-1ULL, x); #else @@ -76,7 +76,7 @@ template inline size_t default_hash64(T key) { union { T in; - doris::vectorized::UInt64 out; + doris::UInt64 out; } u; u.out = 0; u.in = key; @@ -131,7 +131,7 @@ template inline size_t hash_crc32(T key) { union { T in; - doris::vectorized::UInt64 out; + doris::UInt64 out; } u; u.out = 0; u.in = key; @@ -139,18 +139,18 @@ inline size_t hash_crc32(T key) { } template <> -inline size_t hash_crc32(doris::vectorized::UInt128 u) { - return doris::vectorized::UInt128HashCRC32()(u); +inline size_t hash_crc32(doris::UInt128 u) { + return doris::UInt128HashCRC32()(u); } template <> inline size_t hash_crc32(unsigned __int128 u) { - return doris::vectorized::UInt128HashCRC32()(u); + return doris::UInt128HashCRC32()(u); } template <> -inline size_t hash_crc32(doris::vectorized::Int128 u) { - return doris::vectorized::UInt128HashCRC32()({(u >> 64) & int64_t(-1), u & int64_t(-1)}); +inline size_t hash_crc32(doris::Int128 u) { + return doris::UInt128HashCRC32()({(u >> 64) & int64_t(-1), u & int64_t(-1)}); } template <> @@ -181,18 +181,18 @@ inline size_t hash_crc32(doris::TimestampTzValue u) { } \ }; -DEFINE_HASH(doris::vectorized::UInt8) -DEFINE_HASH(doris::vectorized::UInt16) -DEFINE_HASH(doris::vectorized::UInt32) -DEFINE_HASH(doris::vectorized::UInt64) -DEFINE_HASH(doris::vectorized::UInt128) -DEFINE_HASH(doris::vectorized::Int8) -DEFINE_HASH(doris::vectorized::Int16) -DEFINE_HASH(doris::vectorized::Int32) -DEFINE_HASH(doris::vectorized::Int64) -DEFINE_HASH(doris::vectorized::Int128) -DEFINE_HASH(doris::vectorized::Float32) -DEFINE_HASH(doris::vectorized::Float64) +DEFINE_HASH(doris::UInt8) +DEFINE_HASH(doris::UInt16) +DEFINE_HASH(doris::UInt32) +DEFINE_HASH(doris::UInt64) +DEFINE_HASH(doris::UInt128) +DEFINE_HASH(doris::Int8) +DEFINE_HASH(doris::Int16) +DEFINE_HASH(doris::Int32) +DEFINE_HASH(doris::Int64) +DEFINE_HASH(doris::Int128) +DEFINE_HASH(doris::Float32) +DEFINE_HASH(doris::Float64) DEFINE_HASH(doris::VecDateTimeValue) DEFINE_HASH(doris::DateV2Value) DEFINE_HASH(doris::DateV2Value) @@ -207,10 +207,10 @@ struct HashMixWrapper { }; template <> -struct HashCRC32 { - size_t operator()(const doris::vectorized::UInt256& x) const { +struct HashCRC32 { + size_t operator()(const doris::UInt256& x) const { #if defined(__SSE4_2__) || defined(__aarch64__) - doris::vectorized::UInt64 crc = -1ULL; + doris::UInt64 crc = -1ULL; crc = _mm_crc32_u64(crc, x.items[0]); crc = _mm_crc32_u64(crc, x.items[1]); crc = _mm_crc32_u64(crc, x.items[2]); @@ -226,7 +226,7 @@ template <> struct HashCRC32 { size_t operator()(const wide::Int256& x) const { #if defined(__SSE4_2__) || defined(__aarch64__) - doris::vectorized::UInt64 crc = -1ULL; + doris::UInt64 crc = -1ULL; crc = _mm_crc32_u64(crc, x.items[0]); crc = _mm_crc32_u64(crc, x.items[1]); crc = _mm_crc32_u64(crc, x.items[2]); @@ -240,36 +240,36 @@ struct HashCRC32 { }; template <> -struct HashCRC32 { - size_t operator()(const doris::vectorized::Decimal256& value) const { +struct HashCRC32 { + size_t operator()(const doris::Decimal256& value) const { return HashCRC32()(value.value); } }; template <> -struct HashCRC32 { - size_t operator()(const doris::vectorized::Decimal32& value) const { +struct HashCRC32 { + size_t operator()(const doris::Decimal32& value) const { return HashCRC32()(value.value); } }; template <> -struct HashCRC32 { - size_t operator()(const doris::vectorized::Decimal64& value) const { +struct HashCRC32 { + size_t operator()(const doris::Decimal64& value) const { return HashCRC32()(value.value); } }; template <> -struct HashCRC32 { - size_t operator()(const doris::vectorized::Decimal128V3& value) const { +struct HashCRC32 { + size_t operator()(const doris::Decimal128V3& value) const { return HashCRC32<__int128>()(value.value); } }; template <> -struct HashCRC32 { - size_t operator()(const doris::vectorized::Decimal128V2& value) const { +struct HashCRC32 { + size_t operator()(const doris::Decimal128V2& value) const { return HashCRC32<__int128>()(value.value); } }; @@ -284,9 +284,9 @@ struct HashCRC32 { #include "common/compile_check_avoid_begin.h" template <> -struct HashCRC32 { - size_t operator()(const doris::vectorized::UInt72& x) const { - doris::vectorized::UInt64 crc = -1ULL; +struct HashCRC32 { + size_t operator()(const doris::UInt72& x) const { + doris::UInt64 crc = -1ULL; crc = _mm_crc32_u8(crc, x.a); crc = _mm_crc32_u64(crc, x.b); return crc; @@ -294,9 +294,9 @@ struct HashCRC32 { }; template <> -struct HashCRC32 { - size_t operator()(const doris::vectorized::UInt96& x) const { - doris::vectorized::UInt64 crc = -1ULL; +struct HashCRC32 { + size_t operator()(const doris::UInt96& x) const { + doris::UInt64 crc = -1ULL; crc = _mm_crc32_u32(crc, x.a); crc = _mm_crc32_u64(crc, x.b); return crc; @@ -304,9 +304,9 @@ struct HashCRC32 { }; template <> -struct HashCRC32 { - size_t operator()(const doris::vectorized::UInt104& x) const { - doris::vectorized::UInt64 crc = -1ULL; +struct HashCRC32 { + size_t operator()(const doris::UInt104& x) const { + doris::UInt64 crc = -1ULL; crc = _mm_crc32_u8(crc, x.a); crc = _mm_crc32_u32(crc, x.b); crc = _mm_crc32_u64(crc, x.c); @@ -315,9 +315,9 @@ struct HashCRC32 { }; template <> -struct HashCRC32 { - size_t operator()(const doris::vectorized::UInt136& x) const { - doris::vectorized::UInt64 crc = -1ULL; +struct HashCRC32 { + size_t operator()(const doris::UInt136& x) const { + doris::UInt64 crc = -1ULL; crc = _mm_crc32_u8(crc, x.a); crc = _mm_crc32_u64(crc, x.b); crc = _mm_crc32_u64(crc, x.c); diff --git a/be/src/vec/common/hash_table/hash_key_type.h b/be/src/exec/common/hash_table/hash_key_type.h similarity index 84% rename from be/src/vec/common/hash_table/hash_key_type.h rename to be/src/exec/common/hash_table/hash_key_type.h index 8a264c9ddb9687..313df63f3d3142 100644 --- a/be/src/vec/common/hash_table/hash_key_type.h +++ b/be/src/exec/common/hash_table/hash_key_type.h @@ -17,9 +17,9 @@ #pragma once -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/common/hash_table/hash_map_context.h" -#include "vec/core/types.h" +#include "core/types.h" +#include "exec/common/hash_table/hash_map_context.h" +#include "exprs/aggregate/aggregate_function.h" namespace doris { @@ -59,7 +59,6 @@ inline HashKeyType get_hash_key_type_with_phase(HashKeyType t, bool phase2) { } inline HashKeyType get_hash_key_type_with_fixed(size_t size) { - using namespace vectorized; if (size <= sizeof(UInt64)) { return HashKeyType::fixed64; } else if (size <= sizeof(UInt72)) { @@ -79,8 +78,8 @@ inline HashKeyType get_hash_key_type_with_fixed(size_t size) { } } -inline HashKeyType get_hash_key_type_fixed(const std::vector& data_types) { - if (data_types.size() >= vectorized::BITSIZE) { +inline HashKeyType get_hash_key_type_fixed(const std::vector& data_types) { + if (data_types.size() >= BITSIZE) { return HashKeyType::serialized; } @@ -101,7 +100,7 @@ inline HashKeyType get_hash_key_type_fixed(const std::vector& data_types) { +inline HashKeyType get_hash_key_type(const std::vector& data_types) { if (data_types.size() > 1) { return get_hash_key_type_fixed(data_types); } @@ -123,17 +122,17 @@ inline HashKeyType get_hash_key_type(const std::vector& } size_t size = t->get_size_of_value_in_memory(); - if (size == sizeof(vectorized::UInt8)) { + if (size == sizeof(UInt8)) { return HashKeyType::int8_key; - } else if (size == sizeof(vectorized::UInt16)) { + } else if (size == sizeof(UInt16)) { return HashKeyType::int16_key; - } else if (size == sizeof(vectorized::UInt32)) { + } else if (size == sizeof(UInt32)) { return HashKeyType::int32_key; - } else if (size == sizeof(vectorized::UInt64)) { + } else if (size == sizeof(UInt64)) { return HashKeyType::int64_key; - } else if (size == sizeof(vectorized::UInt128)) { + } else if (size == sizeof(UInt128)) { return HashKeyType::int128_key; - } else if (size == sizeof(vectorized::UInt256)) { + } else if (size == sizeof(UInt256)) { return HashKeyType::int256_key; } else { throw Exception(ErrorCode::INTERNAL_ERROR, "meet invalid type size, size={}, type={}", size, diff --git a/be/src/vec/common/hash_table/hash_map.h b/be/src/exec/common/hash_table/hash_map.h similarity index 98% rename from be/src/vec/common/hash_table/hash_map.h rename to be/src/exec/common/hash_table/hash_map.h index c71a854561581f..136257d9858b59 100644 --- a/be/src/vec/common/hash_table/hash_map.h +++ b/be/src/exec/common/hash_table/hash_map.h @@ -20,8 +20,8 @@ #pragma once -#include "vec/common/hash_table/hash.h" -#include "vec/common/hash_table/hash_table.h" +#include "exec/common/hash_table/hash.h" +#include "exec/common/hash_table/hash_table.h" namespace doris { /** NOTE HashMap could only be used for memmoveable (position independent) types. diff --git a/be/src/vec/common/hash_table/hash_map_context.h b/be/src/exec/common/hash_table/hash_map_context.h similarity index 99% rename from be/src/vec/common/hash_table/hash_map_context.h rename to be/src/exec/common/hash_table/hash_map_context.h index 1854209b282cb6..df7f4aacf047c0 100644 --- a/be/src/vec/common/hash_table/hash_map_context.h +++ b/be/src/exec/common/hash_table/hash_map_context.h @@ -23,19 +23,19 @@ #include #include "common/compiler_util.h" +#include "core/arena.h" +#include "core/assert_cast.h" +#include "core/column/column_array.h" +#include "core/column/column_nullable.h" +#include "core/custom_allocator.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "exec/common/columns_hashing.h" +#include "exec/common/hash_table/string_hash_map.h" +#include "exec/common/template_helpers.hpp" #include "util/simd/bits.h" -#include "vec/columns/column_array.h" -#include "vec/columns/column_nullable.h" -#include "vec/common/arena.h" -#include "vec/common/assert_cast.h" -#include "vec/common/columns_hashing.h" -#include "vec/common/custom_allocator.h" -#include "vec/common/hash_table/string_hash_map.h" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" -#include "vec/utils/template_helpers.hpp" - -namespace doris::vectorized { + +namespace doris { #include "common/compile_check_begin.h" constexpr auto BITSIZE = 8; @@ -1194,4 +1194,4 @@ struct MethodSingleNullableColumn : public SingleColumnMethod { } }; #include "common/compile_check_end.h" -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/common/hash_table/hash_map_util.h b/be/src/exec/common/hash_table/hash_map_util.h similarity index 86% rename from be/src/vec/common/hash_table/hash_map_util.h rename to be/src/exec/common/hash_table/hash_map_util.h index bd8af36ba12310..717e9c75429b02 100644 --- a/be/src/vec/common/hash_table/hash_map_util.h +++ b/be/src/exec/common/hash_table/hash_map_util.h @@ -17,15 +17,14 @@ #pragma once -#include "vec/common/hash_table/hash_key_type.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" +#include "exec/common/hash_table/hash_key_type.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" namespace doris { -inline std::vector get_data_types( - const vectorized::VExprContextSPtrs& expr_contexts) { - std::vector data_types; +inline std::vector get_data_types(const VExprContextSPtrs& expr_contexts) { + std::vector data_types; for (const auto& ctx : expr_contexts) { data_types.emplace_back(ctx->root()->data_type()); } @@ -33,7 +32,7 @@ inline std::vector get_data_types( } template -Status init_hash_method(DataVariants* data, const std::vector& data_types, +Status init_hash_method(DataVariants* data, const std::vector& data_types, bool is_first_phase) { auto type = HashKeyType::EMPTY; try { diff --git a/be/src/vec/common/hash_table/hash_table.h b/be/src/exec/common/hash_table/hash_table.h similarity index 97% rename from be/src/vec/common/hash_table/hash_table.h rename to be/src/exec/common/hash_table/hash_table.h index 34e02e5798a630..0c0c98238db006 100644 --- a/be/src/vec/common/hash_table/hash_table.h +++ b/be/src/exec/common/hash_table/hash_table.h @@ -28,9 +28,9 @@ #include "common/exception.h" #include "common/status.h" -#include "util/runtime_profile.h" -#include "vec/core/types.h" -#include "vec/io/io_helper.h" +#include "core/types.h" +#include "runtime/runtime_profile.h" +#include "util/io_helper.h" /** NOTE HashTable could only be used for memmoveable (position independent) types. * Example: std::string is not position independent in libstdc++ with C++11 ABI or in libc++. @@ -48,10 +48,10 @@ #include "common/compile_check_begin.h" struct HashTableNoState { /// Serialization, in binary and text form. - void write(doris::vectorized::BufferWritable&) const {} + void write(doris::BufferWritable&) const {} // /// Deserialization, in binary and text form. - void read(doris::vectorized::BufferReadable&) {} + void read(doris::BufferReadable&) {} }; /// These functions can be overloaded for custom types. @@ -197,10 +197,10 @@ struct HashTableCell { void set_mapped(const value_type& /*value*/) {} /// Serialization, in binary and text form. - void write(doris::vectorized::BufferWritable& wb) const { wb.write_binary(key); } + void write(doris::BufferWritable& wb) const { wb.write_binary(key); } /// Deserialization, in binary and text form. - void read(doris::vectorized::BufferReadable& rb) { rb.read_binary(key); } + void read(doris::BufferReadable& rb) { rb.read_binary(key); } }; template @@ -225,17 +225,17 @@ void insert_set_mapped(MappedType* dest, const ValueType& src) { *dest = src.second; } -static doris::vectorized::Int32 double_resize_threshold = doris::config::double_resize_threshold; +static doris::Int32 double_resize_threshold = doris::config::double_resize_threshold; /** Determines the size of the hash table, and when and how much it should be resized. */ template struct HashTableGrower { /// The state of this structure is enough to get the buffer size of the hash table. - doris::vectorized::UInt8 size_degree = initial_size_degree; - doris::vectorized::Int64 double_grow_degree = doris::config::hash_table_double_grow_degree; + doris::UInt8 size_degree = initial_size_degree; + doris::Int64 double_grow_degree = doris::config::hash_table_double_grow_degree; - doris::vectorized::Int32 max_fill_rate = doris::config::max_fill_rate; + doris::Int32 max_fill_rate = doris::config::max_fill_rate; /// The size of the hash table in the cells. size_t buf_size() const { return 1ULL << size_degree; } @@ -293,15 +293,15 @@ template class alignas(64) HashTableGrowerWithPrecalculation { /// The state of this structure is enough to get the buffer size of the hash table. - doris::vectorized::UInt8 size_degree_ = initial_size_degree; + doris::UInt8 size_degree_ = initial_size_degree; size_t precalculated_mask = (1ULL << initial_size_degree) - 1; size_t precalculated_max_fill = 1ULL << (initial_size_degree - 1); - doris::vectorized::Int64 double_grow_degree = doris::config::hash_table_double_grow_degree; + doris::Int64 double_grow_degree = doris::config::hash_table_double_grow_degree; public: - doris::vectorized::UInt8 size_degree() const { return size_degree_; } + doris::UInt8 size_degree() const { return size_degree_; } - void increase_size_degree(doris::vectorized::UInt8 delta) { + void increase_size_degree(doris::UInt8 delta) { size_degree_ += delta; DCHECK(size_degree_ <= 64); precalculated_mask = (1ULL << size_degree_) - 1; @@ -946,7 +946,7 @@ class HashTable : private boost::noncopyable, return !buf[place_value].is_zero(*this); } - void write(doris::vectorized::BufferWritable& wb) const { + void write(doris::BufferWritable& wb) const { Cell::State::write(wb); wb.write_var_uint(m_size); @@ -956,14 +956,14 @@ class HashTable : private boost::noncopyable, if (!ptr->is_zero(*this)) ptr->write(wb); } - void read(doris::vectorized::BufferReadable& rb) { + void read(doris::BufferReadable& rb) { Cell::State::read(rb); destroy_elements(); this->clear_get_has_zero(); m_size = 0; - doris::vectorized::UInt64 new_size = 0; + doris::UInt64 new_size = 0; rb.read_var_uint(new_size); free(); diff --git a/be/src/vec/common/hash_table/hash_table_set_build.h b/be/src/exec/common/hash_table/hash_table_set_build.h similarity index 94% rename from be/src/vec/common/hash_table/hash_table_set_build.h rename to be/src/exec/common/hash_table/hash_table_set_build.h index bd66b9d3197382..7ad20a5942ece4 100644 --- a/be/src/vec/common/hash_table/hash_table_set_build.h +++ b/be/src/exec/common/hash_table/hash_table_set_build.h @@ -15,11 +15,11 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/exec/set_sink_operator.h" +#include "core/column/column.h" +#include "exec/operator/set_sink_operator.h" #include "runtime/runtime_state.h" -#include "vec/columns/column.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" constexpr size_t CHECK_FRECUENCY = 65536; template @@ -57,4 +57,4 @@ struct HashTableBuild { RuntimeState* _state = nullptr; }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/hash_table/hash_table_set_probe.h b/be/src/exec/common/hash_table/hash_table_set_probe.h similarity index 94% rename from be/src/vec/common/hash_table/hash_table_set_probe.h rename to be/src/exec/common/hash_table/hash_table_set_probe.h index fbb2d3d1fde73d..694e3c797a084b 100644 --- a/be/src/vec/common/hash_table/hash_table_set_probe.h +++ b/be/src/exec/common/hash_table/hash_table_set_probe.h @@ -15,10 +15,10 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/exec/set_probe_sink_operator.h" -#include "vec/columns/column.h" +#include "core/column/column.h" +#include "exec/operator/set_probe_sink_operator.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" template struct HashTableProbe { @@ -58,4 +58,4 @@ struct HashTableProbe { std::vector _probe_keys; }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/hash_table/join_hash_table.h b/be/src/exec/common/hash_table/join_hash_table.h similarity index 98% rename from be/src/vec/common/hash_table/join_hash_table.h rename to be/src/exec/common/hash_table/join_hash_table.h index c116a17777cd85..7d725392110de5 100644 --- a/be/src/vec/common/hash_table/join_hash_table.h +++ b/be/src/exec/common/hash_table/join_hash_table.h @@ -23,8 +23,8 @@ #include "common/exception.h" #include "common/status.h" -#include "vec/columns/column_filter_helper.h" -#include "vec/common/custom_allocator.h" +#include "core/column/column_filter_helper.h" +#include "core/custom_allocator.h" namespace doris { #include "common/compile_check_begin.h" @@ -198,8 +198,7 @@ class JoinHashTable { } template - bool iterate_map(vectorized::ColumnOffset32& build_idxs, - vectorized::ColumnFilterHelper* mark_column_helper) const { + bool iterate_map(ColumnOffset32& build_idxs, ColumnFilterHelper* mark_column_helper) const { const auto batch_size = max_batch_size; const auto elem_num = visited.size(); int count = 0; diff --git a/be/src/vec/common/hash_table/ph_hash_map.h b/be/src/exec/common/hash_table/ph_hash_map.h similarity index 97% rename from be/src/vec/common/hash_table/ph_hash_map.h rename to be/src/exec/common/hash_table/ph_hash_map.h index cd627cfe39e522..92a6b5f9557897 100644 --- a/be/src/vec/common/hash_table/ph_hash_map.h +++ b/be/src/exec/common/hash_table/ph_hash_map.h @@ -22,8 +22,8 @@ #include #include -#include "vec/common/hash_table/hash.h" -#include "vec/common/hash_table/phmap_fwd_decl.h" +#include "exec/common/hash_table/hash.h" +#include "exec/common/hash_table/phmap_fwd_decl.h" template ALWAYS_INLINE inline auto lookup_result_get_mapped(std::pair* it) { @@ -36,7 +36,7 @@ class PHHashMap : private boost::noncopyable { using Self = PHHashMap; using Hash = HashMethod; using cell_type = std::pair; - using HashMapImpl = doris::vectorized::flat_hash_map; + using HashMapImpl = doris::flat_hash_map; using key_type = Key; using mapped_type = Mapped; diff --git a/be/src/vec/common/hash_table/ph_hash_set.h b/be/src/exec/common/hash_table/ph_hash_set.h similarity index 97% rename from be/src/vec/common/hash_table/ph_hash_set.h rename to be/src/exec/common/hash_table/ph_hash_set.h index 8c30218755c53d..a954116edbe425 100644 --- a/be/src/vec/common/hash_table/ph_hash_set.h +++ b/be/src/exec/common/hash_table/ph_hash_set.h @@ -20,8 +20,8 @@ #include #include -#include "vec/common/hash_table/hash.h" -#include "vec/common/hash_table/phmap_fwd_decl.h" +#include "exec/common/hash_table/hash.h" +#include "exec/common/hash_table/phmap_fwd_decl.h" ALWAYS_INLINE inline void* lookup_result_get_mapped(void*) { return nullptr; @@ -32,7 +32,7 @@ class PHHashSet : private boost::noncopyable { public: using Self = PHHashSet; using Hash = HashMethod; - using HashSetImpl = doris::vectorized::flat_hash_set; + using HashSetImpl = doris::flat_hash_set; using key_type = Key; using mapped_type = void; diff --git a/be/src/vec/common/hash_table/phmap_fwd_decl.h b/be/src/exec/common/hash_table/phmap_fwd_decl.h similarity index 93% rename from be/src/vec/common/hash_table/phmap_fwd_decl.h rename to be/src/exec/common/hash_table/phmap_fwd_decl.h index 7fdac4411a660d..5879303ad5ef83 100644 --- a/be/src/vec/common/hash_table/phmap_fwd_decl.h +++ b/be/src/exec/common/hash_table/phmap_fwd_decl.h @@ -20,10 +20,10 @@ #include // IWYU pragma: export #include "common/compare.h" -#include "vec/common/allocator.h" -#include "vec/common/allocator_fwd.h" +#include "core/allocator.h" +#include "core/allocator_fwd.h" -namespace doris::vectorized { +namespace doris { /// `Allocator_` implements several interfaces of `std::allocator` /// which `phmap::flat_hash_map` will use. @@ -53,4 +53,4 @@ template , typename Eq = doris::Equal typename Alloc = Allocator_> using flat_hash_set = phmap::flat_hash_set; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/hash_table/string_hash_map.h b/be/src/exec/common/hash_table/string_hash_map.h similarity index 98% rename from be/src/vec/common/hash_table/string_hash_map.h rename to be/src/exec/common/hash_table/string_hash_map.h index 67a90ea8e4dda0..c615e6b5dcc924 100644 --- a/be/src/vec/common/hash_table/string_hash_map.h +++ b/be/src/exec/common/hash_table/string_hash_map.h @@ -20,8 +20,8 @@ #pragma once -#include "vec/common/hash_table/hash_map.h" -#include "vec/common/hash_table/string_hash_table.h" +#include "exec/common/hash_table/hash_map.h" +#include "exec/common/hash_table/string_hash_table.h" namespace doris { template diff --git a/be/src/vec/common/hash_table/string_hash_table.h b/be/src/exec/common/hash_table/string_hash_table.h similarity index 98% rename from be/src/vec/common/hash_table/string_hash_table.h rename to be/src/exec/common/hash_table/string_hash_table.h index b7f8d707b453e0..87f7e9147d7e99 100644 --- a/be/src/vec/common/hash_table/string_hash_table.h +++ b/be/src/exec/common/hash_table/string_hash_table.h @@ -23,14 +23,14 @@ #include #include -#include "vec/common/hash_table/hash.h" -#include "vec/common/hash_table/hash_table.h" -#include "vec/common/memcpy_small.h" - -using StringKey2 = doris::vectorized::UInt16; -using StringKey4 = doris::vectorized::UInt32; -using StringKey8 = doris::vectorized::UInt64; -using StringKey16 = doris::vectorized::UInt128; +#include "core/memcpy_small.h" +#include "exec/common/hash_table/hash.h" +#include "exec/common/hash_table/hash_table.h" + +using StringKey2 = doris::UInt16; +using StringKey4 = doris::UInt32; +using StringKey8 = doris::UInt64; +using StringKey16 = doris::UInt128; struct StringHashMapSubKeys { using T1 = StringKey2; diff --git a/be/src/vec/common/hex.cpp b/be/src/exec/common/hex.cpp similarity index 98% rename from be/src/vec/common/hex.cpp rename to be/src/exec/common/hex.cpp index 612a8ec291e9df..601df69de82d68 100644 --- a/be/src/vec/common/hex.cpp +++ b/be/src/exec/common/hex.cpp @@ -18,9 +18,9 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/hex.cpp // and modified by Doris -#include "vec/common/hex.h" +#include "exec/common/hex.h" -namespace doris::vectorized { +namespace doris { const char* const hex_digit_to_char_uppercase_table = "0123456789ABCDEF"; const char* const hex_digit_to_char_lowercase_table = "0123456789abcdef"; @@ -112,4 +112,4 @@ const char* const bin_byte_to_char_table = "1110100011101001111010101110101111101100111011011110111011101111" "1111000011110001111100101111001111110100111101011111011011110111" "1111100011111001111110101111101111111100111111011111111011111111"; -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/common/hex.h b/be/src/exec/common/hex.h similarity index 97% rename from be/src/vec/common/hex.h rename to be/src/exec/common/hex.h index 114639a8425bcf..846eb48ba22ec0 100644 --- a/be/src/vec/common/hex.h +++ b/be/src/exec/common/hex.h @@ -22,9 +22,9 @@ #include #include -#include "vec/core/types.h" +#include "core/types.h" -namespace doris::vectorized { +namespace doris { /// Maps 0..15 to 0..9A..F or 0..9a..f correspondingly. @@ -132,4 +132,4 @@ TUInt unhex_uint(const char* data) { } return res; } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/utils/histogram_helpers.hpp b/be/src/exec/common/histogram_helpers.hpp similarity index 98% rename from be/src/vec/utils/histogram_helpers.hpp rename to be/src/exec/common/histogram_helpers.hpp index 65dff46eb48536..b94f59827ad00e 100644 --- a/be/src/vec/utils/histogram_helpers.hpp +++ b/be/src/exec/common/histogram_helpers.hpp @@ -24,10 +24,10 @@ #include #include "common/cast_set.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/io/io_helper.h" +#include "core/data_type/data_type_decimal.h" +#include "util/io_helper.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" template struct Bucket { @@ -309,4 +309,4 @@ bool histogram_to_json(rapidjson::StringBuffer& buffer, const std::vector 0; } #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/int_exp.h b/be/src/exec/common/int_exp.h similarity index 99% rename from be/src/vec/common/int_exp.h rename to be/src/exec/common/int_exp.h index 0bd5e4154d2f31..4e94f8e3c28f18 100644 --- a/be/src/vec/common/int_exp.h +++ b/be/src/exec/common/int_exp.h @@ -24,7 +24,7 @@ #include #include -#include "vec/core/extended_types.h" +#include "core/extended_types.h" namespace exp_details { diff --git a/be/src/vec/common/ipv6_to_binary.h b/be/src/exec/common/ipv6_to_binary.h similarity index 96% rename from be/src/vec/common/ipv6_to_binary.h rename to be/src/exec/common/ipv6_to_binary.h index 3113a394b614d5..6b0033fa4124a4 100644 --- a/be/src/vec/common/ipv6_to_binary.h +++ b/be/src/exec/common/ipv6_to_binary.h @@ -20,9 +20,9 @@ #pragma once -#include "vec/common/format_ip.h" +#include "exec/common/format_ip.h" -namespace doris::vectorized { +namespace doris { /// Result array could be indexed with all possible uint8 values without extra check. /// For values greater than 128 we will store same value as for 128 (all bits set). @@ -67,4 +67,4 @@ inline const std::array& get_cidr_mask_ipv6(uint8_t prefix_len) { return IPV6_RAW_MASK_ARRAY[prefix_len]; } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/pipeline/common/join_utils.h b/be/src/exec/common/join_utils.h similarity index 69% rename from be/src/pipeline/common/join_utils.h rename to be/src/exec/common/join_utils.h index 7ea6fe6c128b0e..aa3a5d32bfe3d2 100644 --- a/be/src/pipeline/common/join_utils.h +++ b/be/src/exec/common/join_utils.h @@ -20,9 +20,9 @@ #include #include -#include "vec/common/hash_table/hash_key_type.h" -#include "vec/common/hash_table/hash_map_context.h" -#include "vec/common/hash_table/join_hash_table.h" +#include "exec/common/hash_table/hash_key_type.h" +#include "exec/common/hash_table/hash_map_context.h" +#include "exec/common/hash_table/join_hash_table.h" namespace doris { @@ -33,14 +33,14 @@ namespace doris { // `func` receives a single argument: a const pointer to the concrete column // (or const IColumn* as fallback for unexpected types). template -decltype(auto) asof_column_dispatch(const vectorized::IColumn* col, Func&& func) { - if (const auto* c_dv2 = vectorized::check_and_get_column(col)) { +decltype(auto) asof_column_dispatch(const IColumn* col, Func&& func) { + if (const auto* c_dv2 = check_and_get_column(col)) { return std::forward(func)(c_dv2); } else if (const auto* c_dtv2 = - vectorized::check_and_get_column(col)) { + check_and_get_column(col)) { return std::forward(func)(c_dtv2); } else if (const auto* c_tstz = - vectorized::check_and_get_column(col)) { + check_and_get_column(col)) { return std::forward(func)(c_tstz); } else { return std::forward(func)(col); @@ -73,96 +73,80 @@ template inline constexpr bool is_asof_outer_join_op_v = JoinOpType == TJoinOp::ASOF_LEFT_OUTER_JOIN; template -using PrimaryTypeHashTableContext = - vectorized::MethodOneNumber, false>>; +using PrimaryTypeHashTableContext = MethodOneNumber, false>>; template using DirectPrimaryTypeHashTableContext = - vectorized::MethodOneNumberDirect, true>>; + MethodOneNumberDirect, true>>; template -using FixedKeyHashTableContext = - vectorized::MethodKeysFixed, false>>; +using FixedKeyHashTableContext = MethodKeysFixed, false>>; using SerializedHashTableContext = - vectorized::MethodSerialized, false>>; -using MethodOneString = - vectorized::MethodStringNoCache, false>>; + MethodSerialized, false>>; +using MethodOneString = MethodStringNoCache, false>>; using HashTableVariants = std::variant< - std::monostate, SerializedHashTableContext, PrimaryTypeHashTableContext, - PrimaryTypeHashTableContext, - PrimaryTypeHashTableContext, - PrimaryTypeHashTableContext, - PrimaryTypeHashTableContext, - PrimaryTypeHashTableContext, - DirectPrimaryTypeHashTableContext, - DirectPrimaryTypeHashTableContext, - DirectPrimaryTypeHashTableContext, - DirectPrimaryTypeHashTableContext, - DirectPrimaryTypeHashTableContext, - FixedKeyHashTableContext, FixedKeyHashTableContext, - FixedKeyHashTableContext, FixedKeyHashTableContext, - FixedKeyHashTableContext, - FixedKeyHashTableContext, - FixedKeyHashTableContext, MethodOneString>; + std::monostate, SerializedHashTableContext, PrimaryTypeHashTableContext, + PrimaryTypeHashTableContext, PrimaryTypeHashTableContext, + PrimaryTypeHashTableContext, PrimaryTypeHashTableContext, + PrimaryTypeHashTableContext, DirectPrimaryTypeHashTableContext, + DirectPrimaryTypeHashTableContext, DirectPrimaryTypeHashTableContext, + DirectPrimaryTypeHashTableContext, DirectPrimaryTypeHashTableContext, + FixedKeyHashTableContext, FixedKeyHashTableContext, + FixedKeyHashTableContext, FixedKeyHashTableContext, + FixedKeyHashTableContext, FixedKeyHashTableContext, + FixedKeyHashTableContext, MethodOneString>; struct JoinDataVariants { HashTableVariants method_variant; - void init(const std::vector& data_types, HashKeyType type) { + void init(const std::vector& data_types, HashKeyType type) { switch (type) { case HashKeyType::serialized: method_variant.emplace(); break; case HashKeyType::int8_key: - method_variant.emplace>(); + method_variant.emplace>(); break; case HashKeyType::int16_key: - method_variant.emplace>(); + method_variant.emplace>(); break; case HashKeyType::int32_key: - method_variant.emplace>(); + method_variant.emplace>(); break; case HashKeyType::int64_key: - method_variant.emplace>(); + method_variant.emplace>(); break; case HashKeyType::int128_key: - method_variant.emplace>(); + method_variant.emplace>(); break; case HashKeyType::int256_key: - method_variant.emplace>(); + method_variant.emplace>(); break; case HashKeyType::string_key: method_variant.emplace(); break; case HashKeyType::fixed64: - method_variant.emplace>( - get_key_sizes(data_types)); + method_variant.emplace>(get_key_sizes(data_types)); break; case HashKeyType::fixed72: - method_variant.emplace>( - get_key_sizes(data_types)); + method_variant.emplace>(get_key_sizes(data_types)); break; case HashKeyType::fixed96: - method_variant.emplace>( - get_key_sizes(data_types)); + method_variant.emplace>(get_key_sizes(data_types)); break; case HashKeyType::fixed104: - method_variant.emplace>( - get_key_sizes(data_types)); + method_variant.emplace>(get_key_sizes(data_types)); break; case HashKeyType::fixed128: - method_variant.emplace>( - get_key_sizes(data_types)); + method_variant.emplace>(get_key_sizes(data_types)); break; case HashKeyType::fixed136: - method_variant.emplace>( - get_key_sizes(data_types)); + method_variant.emplace>(get_key_sizes(data_types)); break; case HashKeyType::fixed256: - method_variant.emplace>( - get_key_sizes(data_types)); + method_variant.emplace>(get_key_sizes(data_types)); break; default: throw Exception(ErrorCode::INTERNAL_ERROR, @@ -172,7 +156,7 @@ struct JoinDataVariants { }; template -void primary_to_direct_mapping(Method* context, const vectorized::ColumnRawPtrs& key_columns, +void primary_to_direct_mapping(Method* context, const ColumnRawPtrs& key_columns, const std::vector>& variant_ptrs) { using FieldType = typename Method::Base::Key; FieldType max_key = std::numeric_limits::min(); @@ -180,13 +164,12 @@ void primary_to_direct_mapping(Method* context, const vectorized::ColumnRawPtrs& size_t num_rows = key_columns[0]->size(); if (key_columns[0]->is_nullable()) { - const FieldType* input_keys = - (FieldType*)assert_cast(key_columns[0]) - ->get_nested_column_ptr() - ->get_raw_data() - .data; - const vectorized::NullMap& null_map = - assert_cast(key_columns[0])->get_null_map_data(); + const FieldType* input_keys = (FieldType*)assert_cast(key_columns[0]) + ->get_nested_column_ptr() + ->get_raw_data() + .data; + const NullMap& null_map = + assert_cast(key_columns[0])->get_null_map_data(); // skip first mocked row for (size_t i = 1; i < num_rows; i++) { if (null_map[i]) { @@ -216,40 +199,35 @@ void primary_to_direct_mapping(Method* context, const vectorized::ColumnRawPtrs& template void try_convert_to_direct_mapping( - Method* method, const vectorized::ColumnRawPtrs& key_columns, + Method* method, const ColumnRawPtrs& key_columns, const std::vector>& variant_ptrs) {} inline void try_convert_to_direct_mapping( - PrimaryTypeHashTableContext* context, - const vectorized::ColumnRawPtrs& key_columns, + PrimaryTypeHashTableContext* context, const ColumnRawPtrs& key_columns, const std::vector>& variant_ptrs) { primary_to_direct_mapping(context, key_columns, variant_ptrs); } inline void try_convert_to_direct_mapping( - PrimaryTypeHashTableContext* context, - const vectorized::ColumnRawPtrs& key_columns, + PrimaryTypeHashTableContext* context, const ColumnRawPtrs& key_columns, const std::vector>& variant_ptrs) { primary_to_direct_mapping(context, key_columns, variant_ptrs); } inline void try_convert_to_direct_mapping( - PrimaryTypeHashTableContext* context, - const vectorized::ColumnRawPtrs& key_columns, + PrimaryTypeHashTableContext* context, const ColumnRawPtrs& key_columns, const std::vector>& variant_ptrs) { primary_to_direct_mapping(context, key_columns, variant_ptrs); } inline void try_convert_to_direct_mapping( - PrimaryTypeHashTableContext* context, - const vectorized::ColumnRawPtrs& key_columns, + PrimaryTypeHashTableContext* context, const ColumnRawPtrs& key_columns, const std::vector>& variant_ptrs) { primary_to_direct_mapping(context, key_columns, variant_ptrs); } inline void try_convert_to_direct_mapping( - PrimaryTypeHashTableContext* context, - const vectorized::ColumnRawPtrs& key_columns, + PrimaryTypeHashTableContext* context, const ColumnRawPtrs& key_columns, const std::vector>& variant_ptrs) { primary_to_direct_mapping(context, key_columns, variant_ptrs); } diff --git a/be/src/vec/common/nan_utils.h b/be/src/exec/common/nan_utils.h similarity index 100% rename from be/src/vec/common/nan_utils.h rename to be/src/exec/common/nan_utils.h diff --git a/be/src/pipeline/common/partition_sort_utils.cpp b/be/src/exec/common/partition_sort_utils.cpp similarity index 85% rename from be/src/pipeline/common/partition_sort_utils.cpp rename to be/src/exec/common/partition_sort_utils.cpp index cf6b20048db666..eb8c89903e7b44 100644 --- a/be/src/pipeline/common/partition_sort_utils.cpp +++ b/be/src/exec/common/partition_sort_utils.cpp @@ -15,20 +15,19 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/common/partition_sort_utils.h" +#include "exec/common/partition_sort_utils.h" namespace doris { #include "common/compile_check_begin.h" -Status PartitionBlocks::append_block_by_selector(const vectorized::Block* input_block, bool eos) { +Status PartitionBlocks::append_block_by_selector(const Block* input_block, bool eos) { auto selector_rows = _selector.size(); if (selector_rows) { if (_blocks.empty() || reach_limit()) { _init_rows = _partition_sort_info->_runtime_state->batch_size(); - _blocks.push_back(vectorized::Block::create_unique( - vectorized::VectorizedUtils::create_empty_block( - _partition_sort_info->_row_desc))); + _blocks.push_back(Block::create_unique( + VectorizedUtils::create_empty_block(_partition_sort_info->_row_desc))); } auto columns = input_block->get_columns(); auto mutable_columns = _blocks.back()->mutate_columns(); @@ -54,8 +53,8 @@ Status PartitionBlocks::append_block_by_selector(const vectorized::Block* input_ void PartitionBlocks::create_or_reset_sorter_state() { if (_partition_topn_sorter == nullptr) { - _previous_row = std::make_unique(); - _partition_topn_sorter = vectorized::PartitionSorter::create_unique( + _previous_row = std::make_unique(); + _partition_topn_sorter = PartitionSorter::create_unique( *_partition_sort_info->_vsort_exec_exprs, _partition_sort_info->_limit, _partition_sort_info->_offset, _partition_sort_info->_pool, _partition_sort_info->_is_asc_order, _partition_sort_info->_nulls_first, @@ -79,8 +78,8 @@ Status PartitionBlocks::do_partition_topn_sort() { bool current_eos = false; while (!current_eos) { // output_block maybe need better way - auto output_block = vectorized::Block::create_unique( - vectorized::VectorizedUtils::create_empty_block(_partition_sort_info->_row_desc)); + auto output_block = Block::create_unique( + VectorizedUtils::create_empty_block(_partition_sort_info->_row_desc)); RETURN_IF_ERROR(_partition_topn_sorter->get_next(_partition_sort_info->_runtime_state, output_block.get(), ¤t_eos)); auto rows = output_block->rows(); diff --git a/be/src/pipeline/common/partition_sort_utils.h b/be/src/exec/common/partition_sort_utils.h similarity index 54% rename from be/src/pipeline/common/partition_sort_utils.h rename to be/src/exec/common/partition_sort_utils.h index e1eebddf1c9e35..f9edbb39e448c0 100644 --- a/be/src/pipeline/common/partition_sort_utils.h +++ b/be/src/exec/common/partition_sort_utils.h @@ -21,19 +21,19 @@ #include #include -#include "vec/common/hash_table/hash_map_context.h" -#include "vec/common/hash_table/hash_map_util.h" -#include "vec/common/hash_table/ph_hash_map.h" -#include "vec/common/hash_table/string_hash_map.h" -#include "vec/common/sort/partition_sorter.h" -#include "vec/common/sort/vsort_exec_exprs.h" +#include "exec/common/hash_table/hash_map_context.h" +#include "exec/common/hash_table/hash_map_util.h" +#include "exec/common/hash_table/ph_hash_map.h" +#include "exec/common/hash_table/string_hash_map.h" +#include "exec/sort/partition_sorter.h" +#include "exec/sort/vsort_exec_exprs.h" namespace doris { struct PartitionSortInfo { ~PartitionSortInfo() = default; - PartitionSortInfo(vectorized::VSortExecExprs* vsort_exec_exprs, int64_t limit, int64_t offset, + PartitionSortInfo(VSortExecExprs* vsort_exec_exprs, int64_t limit, int64_t offset, ObjectPool* pool, const std::vector& is_asc_order, const std::vector& nulls_first, const RowDescriptor& row_desc, RuntimeState* runtime_state, RuntimeProfile* runtime_profile, @@ -54,7 +54,7 @@ struct PartitionSortInfo { _topn_phase(topn_phase) {} public: - vectorized::VSortExecExprs* _vsort_exec_exprs = nullptr; + VSortExecExprs* _vsort_exec_exprs = nullptr; int64_t _limit = -1; int64_t _offset = 0; ObjectPool* _pool = nullptr; @@ -86,15 +86,14 @@ struct PartitionBlocks { void add_row_idx(size_t row) { _selector.push_back(row); } - Status append_block_by_selector(const vectorized::Block* input_block, bool eos); + Status append_block_by_selector(const Block* input_block, bool eos); Status do_partition_topn_sort(); void create_or_reset_sorter_state(); - void append_whole_block(vectorized::Block* input_block, const RowDescriptor& row_desc) { - auto empty_block = vectorized::Block::create_unique( - vectorized::VectorizedUtils::create_empty_block(row_desc)); + void append_whole_block(Block* input_block, const RowDescriptor& row_desc) { + auto empty_block = Block::create_unique(VectorizedUtils::create_empty_block(row_desc)); empty_block->swap(*input_block); _blocks.emplace_back(std::move(empty_block)); } @@ -103,14 +102,14 @@ struct PartitionBlocks { return _init_rows <= 0 || _blocks.back()->bytes() > INITIAL_BUFFERED_BLOCK_BYTES; } - vectorized::IColumn::Selector _selector; - std::vector> _blocks; + IColumn::Selector _selector; + std::vector> _blocks; size_t _current_input_rows = 0; int64_t _init_rows = 4096; bool _is_first_sorter = false; - std::unique_ptr _previous_row; - std::unique_ptr _partition_topn_sorter = nullptr; + std::unique_ptr _previous_row; + std::unique_ptr _partition_topn_sorter = nullptr; std::shared_ptr _partition_sort_info = nullptr; }; @@ -122,108 +121,99 @@ template using PartitionData = PHHashMap>; template -using PartitionDataSingle = vectorized::MethodOneNumber>; +using PartitionDataSingle = MethodOneNumber>; template -using PartitionDataSingleNullable = vectorized::MethodSingleNullableColumn< - vectorized::MethodOneNumber>>>; +using PartitionDataSingleNullable = + MethodSingleNullableColumn>>>; using PartitionedMethodVariants = std::variant< - std::monostate, vectorized::MethodSerialized, - PartitionDataSingle, PartitionDataSingle, - PartitionDataSingle, PartitionDataSingle, - PartitionDataSingle, PartitionDataSingle, - PartitionDataSingleNullable, - PartitionDataSingleNullable, - PartitionDataSingleNullable, - PartitionDataSingleNullable, - PartitionDataSingleNullable, - PartitionDataSingleNullable, - vectorized::MethodKeysFixed>, - vectorized::MethodKeysFixed>, - vectorized::MethodKeysFixed>, - vectorized::MethodKeysFixed>, - vectorized::MethodKeysFixed>, - vectorized::MethodKeysFixed>, - vectorized::MethodKeysFixed>, - vectorized::MethodStringNoCache, - vectorized::MethodSingleNullableColumn>>>; + std::monostate, MethodSerialized, PartitionDataSingle, + PartitionDataSingle, PartitionDataSingle, PartitionDataSingle, + PartitionDataSingle, PartitionDataSingle, + PartitionDataSingleNullable, PartitionDataSingleNullable, + PartitionDataSingleNullable, PartitionDataSingleNullable, + PartitionDataSingleNullable, PartitionDataSingleNullable, + MethodKeysFixed>, MethodKeysFixed>, + MethodKeysFixed>, MethodKeysFixed>, + MethodKeysFixed>, MethodKeysFixed>, + MethodKeysFixed>, + MethodStringNoCache, + MethodSingleNullableColumn< + MethodStringNoCache>>>; struct PartitionedHashMapVariants - : public DataVariants { - void init(const std::vector& data_types, HashKeyType type) { + : public DataVariants { + void init(const std::vector& data_types, HashKeyType type) { bool nullable = data_types.size() == 1 && data_types[0]->is_nullable(); switch (type) { case HashKeyType::without_key: { break; } case HashKeyType::serialized: { - method_variant.emplace>(); + method_variant.emplace>(); break; } case HashKeyType::int8_key: { - emplace_single>(nullable); + emplace_single>(nullable); break; } case HashKeyType::int16_key: { - emplace_single>(nullable); + emplace_single>(nullable); break; } case HashKeyType::int32_key: { - emplace_single>(nullable); + emplace_single>(nullable); break; } case HashKeyType::int64_key: { - emplace_single>(nullable); + emplace_single>(nullable); break; } case HashKeyType::int128_key: { - emplace_single>(nullable); + emplace_single>(nullable); break; } case HashKeyType::int256_key: { - emplace_single>(nullable); + emplace_single>(nullable); break; } case HashKeyType::string_key: { if (nullable) { - method_variant.emplace< - vectorized::MethodSingleNullableColumn>>>(); + method_variant.emplace>>>(); } else { - method_variant.emplace< - vectorized::MethodStringNoCache>(); + method_variant.emplace>(); } break; } case HashKeyType::fixed64: - method_variant.emplace>>( + method_variant.emplace>>( get_key_sizes(data_types)); break; case HashKeyType::fixed72: - method_variant.emplace>>( + method_variant.emplace>>( get_key_sizes(data_types)); break; case HashKeyType::fixed96: - method_variant.emplace>>( + method_variant.emplace>>( get_key_sizes(data_types)); break; case HashKeyType::fixed104: - method_variant.emplace>>( + method_variant.emplace>>( get_key_sizes(data_types)); break; case HashKeyType::fixed128: - method_variant.emplace>>( + method_variant.emplace>>( get_key_sizes(data_types)); break; case HashKeyType::fixed136: - method_variant.emplace>>( + method_variant.emplace>>( get_key_sizes(data_types)); break; case HashKeyType::fixed256: - method_variant.emplace>>( + method_variant.emplace>>( get_key_sizes(data_types)); break; default: diff --git a/be/src/vec/common/pinyin.h b/be/src/exec/common/pinyin.h similarity index 100% rename from be/src/vec/common/pinyin.h rename to be/src/exec/common/pinyin.h diff --git a/be/src/exec/common/set_utils.h b/be/src/exec/common/set_utils.h new file mode 100644 index 00000000000000..f7feb05529b476 --- /dev/null +++ b/be/src/exec/common/set_utils.h @@ -0,0 +1,133 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include +#include + +#include "exec/common/hash_table/hash_map_util.h" + +namespace doris { + +struct RowRefWithFlag { + bool visited; + uint32_t row_num = 0; + RowRefWithFlag() = default; +#include "common/compile_check_avoid_begin.h" + //To consider performance, checks are avoided here. + RowRefWithFlag(size_t row_num_count, bool is_visited = false) + : visited(is_visited), row_num(row_num_count) {} +#include "common/compile_check_avoid_end.h" +}; + +template +using SetData = PHHashMap>; + +template +using SetFixedKeyHashTableContext = MethodKeysFixed>; + +template +using SetPrimaryTypeHashTableContext = MethodOneNumber>; + +template +using SetPrimaryTypeHashTableContextNullable = + MethodSingleNullableColumn>>>; + +using SetSerializedHashTableContext = MethodSerialized>; +using SetMethodOneString = MethodStringNoCache>; +using SetMethodOneStringNullable = MethodSingleNullableColumn< + MethodStringNoCache>>>; + +using SetHashTableVariants = + std::variant, + SetPrimaryTypeHashTableContextNullable, + SetPrimaryTypeHashTableContextNullable, + SetPrimaryTypeHashTableContextNullable, + SetPrimaryTypeHashTableContextNullable, + SetPrimaryTypeHashTableContextNullable, + SetPrimaryTypeHashTableContext, SetPrimaryTypeHashTableContext, + SetPrimaryTypeHashTableContext, SetPrimaryTypeHashTableContext, + SetPrimaryTypeHashTableContext, + SetPrimaryTypeHashTableContext, SetFixedKeyHashTableContext, + SetFixedKeyHashTableContext, SetFixedKeyHashTableContext, + SetFixedKeyHashTableContext, SetFixedKeyHashTableContext, + SetFixedKeyHashTableContext, SetFixedKeyHashTableContext>; + +struct SetDataVariants : public DataVariants { + void init(const std::vector& data_types, HashKeyType type) { + bool nullable = data_types.size() == 1 && data_types[0]->is_nullable(); + switch (type) { + case HashKeyType::serialized: + method_variant.emplace(); + break; + case HashKeyType::int8_key: + emplace_single>(nullable); + break; + case HashKeyType::int16_key: + emplace_single>(nullable); + break; + case HashKeyType::int32_key: + emplace_single>(nullable); + break; + case HashKeyType::int64_key: + emplace_single>(nullable); + break; + case HashKeyType::int128_key: + emplace_single>(nullable); + break; + case HashKeyType::int256_key: + emplace_single>(nullable); + break; + case HashKeyType::string_key: + if (nullable) { + method_variant.emplace(); + } else { + method_variant.emplace(); + } + break; + case HashKeyType::fixed64: + method_variant.emplace>(get_key_sizes(data_types)); + break; + case HashKeyType::fixed72: + method_variant.emplace>(get_key_sizes(data_types)); + break; + case HashKeyType::fixed96: + method_variant.emplace>(get_key_sizes(data_types)); + break; + case HashKeyType::fixed104: + method_variant.emplace>(get_key_sizes(data_types)); + break; + case HashKeyType::fixed128: + method_variant.emplace>(get_key_sizes(data_types)); + break; + case HashKeyType::fixed136: + method_variant.emplace>(get_key_sizes(data_types)); + break; + case HashKeyType::fixed256: + method_variant.emplace>(get_key_sizes(data_types)); + break; + default: + throw Exception(ErrorCode::INTERNAL_ERROR, + "SetDataVariants meet invalid key type, type={}", type); + } + } +}; + +} // namespace doris diff --git a/be/src/vec/common/sip_hash.h b/be/src/exec/common/sip_hash.h similarity index 88% rename from be/src/vec/common/sip_hash.h rename to be/src/exec/common/sip_hash.h index 0f9c23d698d2bb..865d068743522f 100644 --- a/be/src/vec/common/sip_hash.h +++ b/be/src/exec/common/sip_hash.h @@ -37,12 +37,12 @@ #include #include "common/compiler_util.h" // IWYU pragma: keep -#include "vec/common/unaligned.h" -#include "vec/core/types.h" +#include "core/types.h" +#include "util/unaligned.h" namespace doris { #include "common/compile_check_begin.h" -#define ROTL(x, b) static_cast(((x) << (b)) | ((x) >> (64 - (b)))) +#define ROTL(x, b) static_cast(((x) << (b)) | ((x) >> (64 - (b)))) #define SIPROUND \ do { \ @@ -65,18 +65,18 @@ namespace doris { class SipHash { private: /// State. - vectorized::UInt64 v0; - vectorized::UInt64 v1; - vectorized::UInt64 v2; - vectorized::UInt64 v3; + UInt64 v0; + UInt64 v1; + UInt64 v2; + UInt64 v3; /// How many bytes have been processed. - vectorized::UInt64 cnt; + UInt64 cnt; /// The current 8 bytes of input data. union { - vectorized::UInt64 current_word; - vectorized::UInt8 current_bytes[8]; + UInt64 current_word; + UInt8 current_bytes[8]; }; ALWAYS_INLINE void finalize() { @@ -97,7 +97,7 @@ class SipHash { public: /// Arguments - seed. - SipHash(vectorized::UInt64 k0 = 0, vectorized::UInt64 k1 = 0) { + SipHash(UInt64 k0 = 0, UInt64 k1 = 0) { /// Initialize the state with some random bytes and seed. v0 = 0x736f6d6570736575ULL ^ k0; v1 = 0x646f72616e646f6dULL ^ k1; @@ -108,7 +108,7 @@ class SipHash { current_word = 0; } - void update(const char* data, vectorized::UInt64 size) { + void update(const char* data, UInt64 size) { const char* end = data + size; /// We'll finish to process the remainder of the previous update, if any. @@ -131,7 +131,7 @@ class SipHash { cnt += end - data; while (data + 8 <= end) { - current_word = unaligned_load(data); + current_word = unaligned_load(data); v3 ^= current_word; SIPROUND; @@ -182,8 +182,8 @@ class SipHash { void get128(char* out) { finalize(); - reinterpret_cast(out)[0] = v0 ^ v1; - reinterpret_cast(out)[1] = v2 ^ v3; + reinterpret_cast(out)[0] = v0 ^ v1; + reinterpret_cast(out)[1] = v2 ^ v3; } /// template for avoiding 'unsigned long long' vs 'unsigned long' problem on old poco in macos @@ -195,7 +195,7 @@ class SipHash { hi = v2 ^ v3; } - vectorized::UInt64 get64() { + UInt64 get64() { finalize(); return v0 ^ v1 ^ v2 ^ v3; } diff --git a/be/src/vec/common/space_saving.h b/be/src/exec/common/space_saving.h similarity index 97% rename from be/src/vec/common/space_saving.h rename to be/src/exec/common/space_saving.h index 85d5d08521621a..65b85506cb7288 100644 --- a/be/src/vec/common/space_saving.h +++ b/be/src/exec/common/space_saving.h @@ -22,12 +22,12 @@ #include -#include "vec/common/arena_with_free_lists.h" -#include "vec/common/hash_table/hash_map.h" -#include "vec/common/string_buffer.hpp" -#include "vec/io/io_helper.h" +#include "core/arena_with_free_lists.h" +#include "exec/common/hash_table/hash_map.h" +#include "core/string_buffer.hpp" +#include "util/io_helper.h" -namespace doris::vectorized { +namespace doris { template struct SpaceSavingArena { @@ -339,4 +339,4 @@ class SpaceSaving { size_t removed_keys = 0; }; -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/common/string_searcher.h b/be/src/exec/common/string_searcher.h similarity index 99% rename from be/src/vec/common/string_searcher.h rename to be/src/exec/common/string_searcher.h index e675e40bf43239..7fb17df34736c0 100644 --- a/be/src/vec/common/string_searcher.h +++ b/be/src/exec/common/string_searcher.h @@ -27,9 +27,9 @@ #include #include +#include "core/string_ref.h" +#include "exec/common/string_utils/string_utils.h" #include "util/sse_util.hpp" -#include "vec/common/string_ref.h" -#include "vec/common/string_utils/string_utils.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/vec/common/string_utils/string_utils.h b/be/src/exec/common/string_utils/string_utils.h similarity index 100% rename from be/src/vec/common/string_utils/string_utils.h rename to be/src/exec/common/string_utils/string_utils.h diff --git a/be/src/vec/utils/stringop_substring.h b/be/src/exec/common/stringop_substring.h similarity index 93% rename from be/src/vec/utils/stringop_substring.h rename to be/src/exec/common/stringop_substring.h index 5bafe5f0f73dbe..1c597d4618ec7c 100644 --- a/be/src/vec/utils/stringop_substring.h +++ b/be/src/exec/common/stringop_substring.h @@ -32,15 +32,15 @@ #include #include "common/compiler_util.h" // IWYU pragma: keep -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_vector.h" -#include "vec/common/pod_array_fwd.h" -#include "vec/core/block.h" -#include "vec/core/column_numbers.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" +#include "core/block/block.h" +#include "core/block/column_numbers.h" +#include "core/block/column_with_type_and_name.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type.h" +#include "core/pod_array_fwd.h" +#include "core/types.h" #ifndef USE_LIBCPP #include @@ -56,14 +56,14 @@ #include #include +#include "core/assert_cast.h" +#include "core/column/column_decimal.h" +#include "core/column/column_nullable.h" +#include "core/column/column_string.h" +#include "core/string_ref.h" #include "util/simd/vstring_function.h" -#include "vec/columns/column_decimal.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_string.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_ref.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" struct StringOP { static void push_empty_string(size_t index, ColumnString::Chars& chars, @@ -150,10 +150,8 @@ struct SubstringUtil { specific_start_column->get_data(), specific_len_column->get_data(), res->get_chars(), res->get_offsets(), input_rows_count); }, - vectorized::make_bool_variant(is_ascii), - vectorized::make_bool_variant(col_const[0]), - vectorized::make_bool_variant(col_const[1]), - vectorized::make_bool_variant(col_const[2])); + make_bool_variant(is_ascii), make_bool_variant(col_const[0]), + make_bool_variant(col_const[1]), make_bool_variant(col_const[2])); block.get_by_position(result).column = std::move(res); } @@ -282,4 +280,4 @@ struct SubstringUtil { #include "common/compile_check_end.h" -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/utils/template_helpers.hpp b/be/src/exec/common/template_helpers.hpp similarity index 96% rename from be/src/vec/utils/template_helpers.hpp rename to be/src/exec/common/template_helpers.hpp index b2b466466217f2..aa05da10a889e8 100644 --- a/be/src/vec/utils/template_helpers.hpp +++ b/be/src/exec/common/template_helpers.hpp @@ -20,7 +20,7 @@ #include #include -namespace doris::vectorized { +namespace doris { template typename Reducer> struct constexpr_loop_match { @@ -56,4 +56,4 @@ struct Overload : Callables... { template Overload(Callables&&... callables) -> Overload; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/utils/util.hpp b/be/src/exec/common/util.hpp similarity index 98% rename from be/src/vec/utils/util.hpp rename to be/src/exec/common/util.hpp index 9081c0e05acaa9..46ec9f560cc1ad 100644 --- a/be/src/vec/utils/util.hpp +++ b/be/src/exec/common/util.hpp @@ -21,15 +21,15 @@ #include +#include "core/block/block.h" +#include "core/column/column.h" +#include "core/column/column_nullable.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" #include "runtime/descriptors.h" #include "util/simd/bits.h" -#include "vec/columns/column.h" -#include "vec/columns/column_nullable.h" -#include "vec/core/block.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -namespace doris::vectorized { +namespace doris { class VectorizedUtils { public: static Block create_empty_columnswithtypename(const RowDescriptor& row_desc) { @@ -300,7 +300,7 @@ T read_from_json(const std::string& json_str) { return params; } -} // namespace doris::vectorized +} // namespace doris namespace apache::thrift { template diff --git a/be/src/vec/utils/varbinaryop_subbinary.h b/be/src/exec/common/varbinaryop_subbinary.h similarity index 89% rename from be/src/vec/utils/varbinaryop_subbinary.h rename to be/src/exec/common/varbinaryop_subbinary.h index ef4d0b1d20a2ad..e7b6049b1c00dd 100644 --- a/be/src/vec/utils/varbinaryop_subbinary.h +++ b/be/src/exec/common/varbinaryop_subbinary.h @@ -17,14 +17,14 @@ #pragma once -#include "vec/columns/column_const.h" -#include "vec/columns/column_varbinary.h" -#include "vec/core/block.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type_number.h" -#include "vec/data_types/data_type_varbinary.h" - -namespace doris::vectorized { +#include "core/block/block.h" +#include "core/column/column_const.h" +#include "core/column/column_varbinary.h" +#include "core/data_type/data_type_number.h" +#include "core/data_type/data_type_varbinary.h" +#include "core/types.h" + +namespace doris { #include "common/compile_check_begin.h" constexpr auto SIZE_OF_UINT = sizeof(uint32_t); @@ -77,9 +77,8 @@ struct SubBinaryUtil { specific_binary_column, specific_start_column, specific_len_column, res.get(), input_rows_count); }, - vectorized::make_bool_variant(col_const[0]), - vectorized::make_bool_variant(col_const[1]), - vectorized::make_bool_variant(col_const[2])); + make_bool_variant(col_const[0]), make_bool_variant(col_const[1]), + make_bool_variant(col_const[2])); block.get_by_position(result).column = std::move(res); } @@ -116,4 +115,4 @@ struct SubBinaryUtil { }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/variant_util.cpp b/be/src/exec/common/variant_util.cpp similarity index 97% rename from be/src/vec/common/variant_util.cpp rename to be/src/exec/common/variant_util.cpp index 3c5221be321ad9..f8d4dc6a96b3e8 100644 --- a/be/src/vec/common/variant_util.cpp +++ b/be/src/exec/common/variant_util.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/common/variant_util.h" +#include "exec/common/variant_util.h" #include #include @@ -52,54 +52,55 @@ #include "common/config.h" #include "common/status.h" +#include "core/assert_cast.h" +#include "core/block/block.h" +#include "core/block/column_numbers.h" +#include "core/block/column_with_type_and_name.h" +#include "core/column/column.h" +#include "core/column/column_array.h" +#include "core/column/column_map.h" +#include "core/column/column_nullable.h" +#include "core/column/column_string.h" +#include "core/column/column_variant.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type/data_type_factory.hpp" +#include "core/data_type/data_type_jsonb.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/data_type_string.h" +#include "core/data_type/data_type_variant.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/get_least_supertype.h" +#include "core/data_type/primitive_type.h" +#include "core/field.h" +#include "core/typeid_cast.h" +#include "core/types.h" +#include "exec/common/field_visitors.h" +#include "exec/common/sip_hash.h" +#include "exprs/function/function.h" +#include "exprs/function/simple_function_factory.h" +#include "exprs/function_context.h" #include "exprs/json_functions.h" -#include "olap/olap_common.h" -#include "olap/rowset/beta_rowset.h" -#include "olap/rowset/rowset.h" -#include "olap/rowset/rowset_fwd.h" -#include "olap/rowset/segment_v2/variant/variant_column_reader.h" -#include "olap/rowset/segment_v2/variant/variant_column_writer_impl.h" -#include "olap/segment_loader.h" -#include "olap/tablet.h" -#include "olap/tablet_fwd.h" -#include "olap/tablet_schema.h" -#include "runtime/client_cache.h" -#include "runtime/define_primitive_type.h" +#include "re2/re2.h" #include "runtime/exec_env.h" -#include "runtime/primitive_type.h" #include "runtime/runtime_state.h" +#include "storage/olap_common.h" +#include "storage/rowset/beta_rowset.h" +#include "storage/rowset/rowset.h" +#include "storage/rowset/rowset_fwd.h" +#include "storage/segment/segment_loader.h" +#include "storage/segment/variant/variant_column_reader.h" +#include "storage/segment/variant/variant_column_writer_impl.h" +#include "storage/tablet/tablet.h" +#include "storage/tablet/tablet_fwd.h" +#include "storage/tablet/tablet_schema.h" +#include "util/client_cache.h" #include "util/defer_op.h" -#include "vec/columns/column.h" -#include "vec/columns/column_array.h" -#include "vec/columns/column_map.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_string.h" -#include "vec/columns/column_variant.h" -#include "vec/common/assert_cast.h" -#include "vec/common/field_visitors.h" -#include "vec/common/sip_hash.h" -#include "vec/common/typeid_cast.h" -#include "vec/core/block.h" -#include "vec/core/column_numbers.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_array.h" -#include "vec/data_types/data_type_factory.hpp" -#include "vec/data_types/data_type_jsonb.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/data_types/data_type_string.h" -#include "vec/data_types/data_type_variant.h" -#include "vec/data_types/get_least_supertype.h" -#include "vec/exprs/function_context.h" -#include "vec/functions/function.h" -#include "vec/functions/simple_function_factory.h" -#include "vec/json/json_parser.h" -#include "vec/json/path_in_data.h" -#include "vec/json/simd_json_parser.h" - -namespace doris::vectorized::variant_util { +#include "util/json/json_parser.h" +#include "util/json/path_in_data.h" +#include "util/json/simd_json_parser.h" + +namespace doris::variant_util { #include "common/compile_check_begin.h" size_t get_number_of_dimensions(const IDataType& type) { @@ -195,8 +196,8 @@ Status cast_column(const ColumnWithTypeAndName& arg, const DataTypePtr& type, Co return Status::OK(); } -void get_column_by_type(const vectorized::DataTypePtr& data_type, const std::string& name, - TabletColumn& column, const ExtraInfo& ext_info) { +void get_column_by_type(const DataTypePtr& data_type, const std::string& name, TabletColumn& column, + const ExtraInfo& ext_info) { column.set_name(name); column.set_type(data_type->get_storage_field_type()); if (ext_info.unique_id >= 0) { @@ -252,7 +253,7 @@ void get_column_by_type(const vectorized::DataTypePtr& data_type, const std::str data_type->get_name(), name); } -TabletColumn get_column_by_type(const vectorized::DataTypePtr& data_type, const std::string& name, +TabletColumn get_column_by_type(const DataTypePtr& data_type, const std::string& name, const ExtraInfo& ext_info) { TabletColumn result; get_column_by_type(data_type, name, result, ext_info); @@ -544,10 +545,9 @@ Status get_least_common_schema(const std::vector& schemas, } // sort by paths in lexicographical order -vectorized::ColumnVariant::Subcolumns get_sorted_subcolumns( - const vectorized::ColumnVariant::Subcolumns& subcolumns) { +ColumnVariant::Subcolumns get_sorted_subcolumns(const ColumnVariant::Subcolumns& subcolumns) { // sort by paths in lexicographical order - vectorized::ColumnVariant::Subcolumns sorted = subcolumns; + ColumnVariant::Subcolumns sorted = subcolumns; std::sort(sorted.begin(), sorted.end(), [](const auto& lhsItem, const auto& rhsItem) { return lhsItem->path < rhsItem->path; }); @@ -899,8 +899,7 @@ Status VariantCompactionUtil::get_compaction_typed_columns( } Status VariantCompactionUtil::get_compaction_nested_columns( - const std::unordered_set& - nested_paths, + const std::unordered_set& nested_paths, const PathToDataTypes& path_to_data_types, const TabletColumnPtr parent_column, TabletSchemaSPtr& output_schema, TabletSchema::PathsSetInfo& paths_set_info) { const auto& parent_indexes = output_schema->inverted_indexs(parent_column->unique_id()); @@ -913,7 +912,7 @@ Status VariantCompactionUtil::get_compaction_nested_columns( get_least_supertype_jsonb(find_data_types->second, &data_type); const std::string& column_name = parent_column->name_lower_case() + "." + path.get_path(); - vectorized::PathInDataBuilder full_path_builder; + PathInDataBuilder full_path_builder; auto full_path = full_path_builder.append(parent_column->name_lower_case(), false) .append(path.get_parts(), false) .build(); @@ -1404,8 +1403,8 @@ TabletSchemaSPtr VariantCompactionUtil::calculate_variant_extended_schema( } const std::string& column_name = column->name_lower_case() + "." + entry->path.get_path(); - const vectorized::DataTypePtr& data_type = entry->data.file_column_type; - vectorized::PathInDataBuilder full_path_builder; + const DataTypePtr& data_type = entry->data.file_column_type; + PathInDataBuilder full_path_builder; auto full_path = full_path_builder.append(column->name_lower_case(), false) .append(entry->path.get_parts(), false) .build(); @@ -2025,4 +2024,4 @@ Status parse_and_materialize_variant_columns(Block& block, const TabletSchema& t } #include "common/compile_check_end.h" -} // namespace doris::vectorized::variant_util +} // namespace doris::variant_util diff --git a/be/src/vec/common/variant_util.h b/be/src/exec/common/variant_util.h similarity index 92% rename from be/src/vec/common/variant_util.h rename to be/src/exec/common/variant_util.h index 1cb83d30a63142..8942e171da7b4a 100644 --- a/be/src/vec/common/variant_util.h +++ b/be/src/exec/common/variant_util.h @@ -29,16 +29,16 @@ #include #include "common/status.h" -#include "olap/tablet_fwd.h" -#include "olap/tablet_schema.h" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/columns/column.h" -#include "vec/columns/column_variant.h" -#include "vec/common/string_ref.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/json/json_parser.h" +#include "core/column/column.h" +#include "core/column/column_variant.h" +#include "core/data_type/data_type.h" +#include "core/field.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "exprs/aggregate/aggregate_function.h" +#include "storage/tablet/tablet_fwd.h" +#include "storage/tablet/tablet_schema.h" +#include "util/json/json_parser.h" namespace doris { class TabletSchema; @@ -46,7 +46,6 @@ enum class FieldType; namespace segment_v2 { struct VariantStatisticsPB; } // namespace segment_v2 -namespace vectorized { class Block; class IColumn; struct ColumnWithTypeAndName; @@ -58,12 +57,11 @@ template class ColumnStr; using ColumnString = ColumnStr; using JsonParser = JSONDataParser; -} // namespace vectorized } // namespace doris const std::string SPARSE_COLUMN_PATH = "__DORIS_VARIANT_SPARSE__"; const std::string DOC_VALUE_COLUMN_PATH = "__DORIS_VARIANT_DOC_VALUE__"; -namespace doris::vectorized::variant_util { +namespace doris::variant_util { using PathToNoneNullValues = std::unordered_map; using PathToDataTypes = std::unordered_map, PathInData::Hash>; @@ -71,7 +69,7 @@ struct VariantExtendedInfo { PathToNoneNullValues path_to_none_null_values; // key: path, value: number of none null values std::unordered_set sparse_paths; // sparse paths in this variant column std::unordered_set typed_paths; // typed paths in this variant column - std::unordered_set + std::unordered_set nested_paths; // nested paths in this variant column PathToDataTypes path_to_data_types; // key: path, value: data types bool has_nested_group = false; // whether this variant column has nested group @@ -93,10 +91,10 @@ struct ExtraInfo { // -1 indicates it's not a Frontend generated column int32_t unique_id = -1; int32_t parent_unique_id = -1; - vectorized::PathInData path_info; + PathInData path_info; }; -TabletColumn get_column_by_type(const vectorized::DataTypePtr& data_type, const std::string& name, +TabletColumn get_column_by_type(const DataTypePtr& data_type, const std::string& name, const ExtraInfo& ext_info); // check if the tuple_paths has ambiguous paths @@ -130,8 +128,8 @@ void inherit_column_attributes(const TabletColumn& source, TabletColumn& target, bool is_bf_supported_by_fe_for_variant_subcolumn(FieldType type); // get sorted subcolumns of variant -vectorized::ColumnVariant::Subcolumns get_sorted_subcolumns( - const vectorized::ColumnVariant::Subcolumns& subcolumns); +ColumnVariant::Subcolumns get_sorted_subcolumns( + const ColumnVariant::Subcolumns& subcolumns); bool has_schema_index_diff(const TabletSchema* new_schema, const TabletSchema* old_schema, int32_t new_col_idx, int32_t old_col_idx); @@ -221,7 +219,7 @@ class VariantCompactionUtil { TabletSchema::PathsSetInfo& paths_set_info); static Status get_compaction_nested_columns( - const std::unordered_set& + const std::unordered_set& nested_paths, const PathToDataTypes& path_to_data_types, const TabletColumnPtr parent_column, TabletSchemaSPtr& output_schema, TabletSchema::PathsSetInfo& paths_set_info); @@ -252,4 +250,4 @@ Status parse_and_materialize_variant_columns(Block& block, const TabletSchema& t phmap::flat_hash_map materialize_docs_to_subcolumns_map( const ColumnVariant& variant); -} // namespace doris::vectorized::variant_util +} // namespace doris::variant_util diff --git a/be/src/vec/exec/jni_connector.cpp b/be/src/exec/connector/jni_connector.cpp similarity index 97% rename from be/src/vec/exec/jni_connector.cpp rename to be/src/exec/connector/jni_connector.cpp index 17d3e570029c4b..6216500a29343f 100644 --- a/be/src/vec/exec/jni_connector.cpp +++ b/be/src/exec/connector/jni_connector.cpp @@ -15,39 +15,39 @@ // specific language governing permissions and limitations // under the License. -#include "jni_connector.h" +#include "exec/connector/jni_connector.h" #include #include #include +#include "core/block/block.h" +#include "core/column/column_array.h" +#include "core/column/column_map.h" +#include "core/column/column_nullable.h" +#include "core/column/column_string.h" +#include "core/column/column_struct.h" +#include "core/column/column_varbinary.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type/data_type_map.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/data_type_struct.h" +#include "core/data_type/data_type_varbinary.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/types.h" +#include "core/value/decimalv2_value.h" #include "jni.h" -#include "runtime/decimalv2_value.h" -#include "runtime/define_primitive_type.h" -#include "runtime/primitive_type.h" #include "runtime/runtime_state.h" #include "util/jni-util.h" -#include "vec/columns/column_array.h" -#include "vec/columns/column_map.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_string.h" -#include "vec/columns/column_struct.h" -#include "vec/columns/column_varbinary.h" -#include "vec/core/block.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type_array.h" -#include "vec/data_types/data_type_map.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/data_types/data_type_struct.h" -#include "vec/data_types/data_type_varbinary.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeProfile; } // namespace doris -namespace doris::vectorized { +namespace doris { #define FOR_FIXED_LENGTH_TYPES(M) \ M(PrimitiveType::TYPE_TINYINT, ColumnInt8, Int8) \ @@ -303,7 +303,7 @@ Status JniConnector::_fill_column(TableMetaAddress& address, ColumnPtr& doris_co MutableColumnPtr data_column; if (doris_column->is_nullable()) { auto* nullable_column = - reinterpret_cast(doris_column->assume_mutable().get()); + reinterpret_cast(doris_column->assume_mutable().get()); data_column = nullable_column->get_nested_column_ptr(); NullMap& null_map = nullable_column->get_null_map_data(); size_t origin_size = null_map.size(); @@ -678,7 +678,7 @@ Status JniConnector::_fill_column_meta(const ColumnPtr& doris_column, const Data // insert null map address const IColumn* data_column = nullptr; if (column->is_nullable()) { - const auto& nullable_column = assert_cast(*column); + const auto& nullable_column = assert_cast(*column); data_column = &(nullable_column.get_nested_column()); const auto& null_map = nullable_column.get_null_map_data(); meta_data.emplace_back((long)null_map.data()); @@ -858,4 +858,4 @@ void JniConnector::_collect_profile_before_close() { } } #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/jni_connector.h b/be/src/exec/connector/jni_connector.h similarity index 97% rename from be/src/vec/exec/jni_connector.h rename to be/src/exec/connector/jni_connector.h index a6b76e7052473e..40549963cfd080 100644 --- a/be/src/vec/exec/jni_connector.h +++ b/be/src/exec/connector/jni_connector.h @@ -28,33 +28,30 @@ #include #include "common/status.h" -#include "exec/olap_common.h" -#include "exec/olap_utils.h" -#include "runtime/define_primitive_type.h" -#include "runtime/primitive_type.h" -#include "runtime/types.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/string_ref.h" +#include "exprs/aggregate/aggregate_function.h" +#include "runtime/runtime_profile.h" +#include "storage/olap_scan_common.h" +#include "storage/olap_utils.h" #include "util/jni-util.h" #include "util/profile_collector.h" -#include "util/runtime_profile.h" #include "util/string_util.h" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/common/string_ref.h" -#include "vec/data_types/data_type.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace vectorized { class Block; template class ColumnDecimal; template class ColumnVector; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { /** * Connector to java jni scanner, which should extend org.apache.doris.common.jni.JniScanner @@ -482,4 +479,4 @@ class JniConnector : public ProfileCollector { } }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/skewed_partition_rebalancer.cpp b/be/src/exec/connector/skewed_partition_rebalancer.cpp similarity index 99% rename from be/src/vec/exec/skewed_partition_rebalancer.cpp rename to be/src/exec/connector/skewed_partition_rebalancer.cpp index ce85d271e9acbc..12eaf05896353f 100644 --- a/be/src/vec/exec/skewed_partition_rebalancer.cpp +++ b/be/src/exec/connector/skewed_partition_rebalancer.cpp @@ -18,11 +18,11 @@ // https://github.com/trinodb/trino/blob/master/core/trino-main/src/main/java/io/trino/operator/output/SkewedPartitionRebalancer.java // to cpp and modified by Doris -#include "vec/exec/skewed_partition_rebalancer.h" +#include "exec/connector/skewed_partition_rebalancer.h" #include -namespace doris::vectorized { +namespace doris { #include "common/compile_check_avoid_begin.h" SkewedPartitionRebalancer::SkewedPartitionRebalancer( @@ -276,4 +276,4 @@ void SkewedPartitionRebalancer::_rebalance_partitions(long data_processed) { _data_processed_at_last_rebalance = data_processed; } #include "common/compile_check_avoid_end.h" -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/exec/skewed_partition_rebalancer.h b/be/src/exec/connector/skewed_partition_rebalancer.h similarity index 98% rename from be/src/vec/exec/skewed_partition_rebalancer.h rename to be/src/exec/connector/skewed_partition_rebalancer.h index 0490b236d3891e..f8120d2b10f25b 100644 --- a/be/src/vec/exec/skewed_partition_rebalancer.h +++ b/be/src/exec/connector/skewed_partition_rebalancer.h @@ -51,7 +51,7 @@ #include "util/indexed_priority_queue.hpp" -namespace doris::vectorized { +namespace doris { class SkewedPartitionRebalancer { private: struct TaskBucket { @@ -127,4 +127,4 @@ class SkewedPartitionRebalancer { std::vector> _partition_assignments; }; -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/exec/vjdbc_connector.cpp b/be/src/exec/connector/vjdbc_connector.cpp similarity index 96% rename from be/src/vec/exec/vjdbc_connector.cpp rename to be/src/exec/connector/vjdbc_connector.cpp index 2878a7969df33d..0d9c95c3d33675 100644 --- a/be/src/vec/exec/vjdbc_connector.cpp +++ b/be/src/exec/connector/vjdbc_connector.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/vjdbc_connector.h" +#include "exec/connector/vjdbc_connector.h" #include @@ -30,24 +30,23 @@ #include "cloud/config.h" #include "common/logging.h" #include "common/status.h" +#include "core/block/block.h" +#include "core/column/column_nullable.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/data_type_string.h" +#include "exec/connector/jni_connector.h" #include "exec/table_connector.h" +#include "exprs/function/simple_function_factory.h" +#include "exprs/vexpr.h" #include "jni.h" #include "runtime/descriptors.h" #include "runtime/plugin/cloud_plugin_downloader.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" -#include "runtime/types.h" #include "runtime/user_function_cache.h" #include "util/jni-util.h" -#include "util/runtime_profile.h" -#include "vec/columns/column_nullable.h" -#include "vec/core/block.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/data_types/data_type_string.h" -#include "vec/exec/jni_connector.h" -#include "vec/exprs/vexpr.h" -#include "vec/functions/simple_function_factory.h" - -namespace doris::vectorized { + +namespace doris { #include "common/compile_check_begin.h" const char* JDBC_EXECUTOR_FACTORY_CLASS = "org/apache/doris/jdbc/JdbcExecutorFactory"; const char* JDBC_EXECUTOR_CTOR_SIGNATURE = "([B)V"; @@ -297,8 +296,7 @@ Status JdbcConnector::get_next(bool* eos, Block* block, int batch_size) { return Status::OK(); } -Status JdbcConnector::append(vectorized::Block* block, - const vectorized::VExprContextSPtrs& output_vexpr_ctxs, +Status JdbcConnector::append(Block* block, const VExprContextSPtrs& output_vexpr_ctxs, uint32_t start_send_row, uint32_t* num_rows_sent, TOdbcTableType::type table_type) { RETURN_IF_ERROR(exec_stmt_write(block, output_vexpr_ctxs, num_rows_sent)); @@ -519,8 +517,8 @@ Status JdbcConnector::_cast_string_to_hll(const SlotDescriptor* slot_desc, Block if (_target_data_type->is_nullable()) { block->replace_by_position(column_index, res_col); } else { - auto nested_ptr = reinterpret_cast(res_col.get()) - ->get_nested_column_ptr(); + auto nested_ptr = + reinterpret_cast(res_col.get())->get_nested_column_ptr(); block->replace_by_position(column_index, nested_ptr); } @@ -564,8 +562,8 @@ Status JdbcConnector::_cast_string_to_bitmap(const SlotDescriptor* slot_desc, Bl if (_target_data_type->is_nullable()) { block->replace_by_position(column_index, res_col); } else { - auto nested_ptr = reinterpret_cast(res_col.get()) - ->get_nested_column_ptr(); + auto nested_ptr = + reinterpret_cast(res_col.get())->get_nested_column_ptr(); block->replace_by_position(column_index, nested_ptr); } @@ -610,8 +608,8 @@ Status JdbcConnector::_cast_string_to_json(const SlotDescriptor* slot_desc, Bloc if (_target_data_type->is_nullable()) { block->replace_by_position(column_index, res_col); } else { - auto nested_ptr = reinterpret_cast(res_col.get()) - ->get_nested_column_ptr(); + auto nested_ptr = + reinterpret_cast(res_col.get())->get_nested_column_ptr(); block->replace_by_position(column_index, nested_ptr); } @@ -686,4 +684,4 @@ Status JdbcConnector::_check_and_return_default_driver_url(const std::string& ur return Status::OK(); } #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/vjdbc_connector.h b/be/src/exec/connector/vjdbc_connector.h similarity index 95% rename from be/src/vec/exec/vjdbc_connector.h rename to be/src/exec/connector/vjdbc_connector.h index 738cae8795c51c..b51e153f761cef 100644 --- a/be/src/vec/exec/vjdbc_connector.h +++ b/be/src/exec/connector/vjdbc_connector.h @@ -21,24 +21,22 @@ #include #include #include -#include #include #include #include #include "common/status.h" +#include "core/data_type/data_type.h" #include "exec/table_connector.h" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/data_types/data_type.h" +#include "exprs/aggregate/aggregate_function.h" +#include "util/jni-util.h" namespace doris { class RuntimeState; class SlotDescriptor; class TupleDescriptor; -namespace vectorized { - class Block; class IColumn; class VExprContext; @@ -94,7 +92,7 @@ class JdbcConnector : public TableConnector { Status get_next(bool* eos, Block* block, int batch_size); - Status append(vectorized::Block* block, const vectorized::VExprContextSPtrs& _output_vexpr_ctxs, + Status append(Block* block, const VExprContextSPtrs& _output_vexpr_ctxs, uint32_t start_send_row, uint32_t* num_rows_sent, TOdbcTableType::type table_type = TOdbcTableType::MYSQL) override; @@ -171,5 +169,4 @@ class JdbcConnector : public TableConnector { JdbcStatistic _jdbc_statistic; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/exec/es/es_scan_reader.cpp b/be/src/exec/es/es_scan_reader.cpp index 13175dc21f121d..18ffade1c29a31 100644 --- a/be/src/exec/es/es_scan_reader.cpp +++ b/be/src/exec/es/es_scan_reader.cpp @@ -28,7 +28,7 @@ #include "common/status.h" #include "exec/es/es_scroll_parser.h" #include "exec/es/es_scroll_query.h" -#include "http/http_method.h" +#include "service/http/http_method.h" namespace doris { diff --git a/be/src/exec/es/es_scan_reader.h b/be/src/exec/es/es_scan_reader.h index a29dced15fe093..1c8bd844f46dba 100644 --- a/be/src/exec/es/es_scan_reader.h +++ b/be/src/exec/es/es_scan_reader.h @@ -21,7 +21,7 @@ #include #include -#include "http/http_client.h" +#include "service/http/http_client.h" namespace doris { class ScrollParser; diff --git a/be/src/exec/es/es_scroll_parser.cpp b/be/src/exec/es/es_scroll_parser.cpp index 6c3ead474b1e0a..e2821a40ff11d7 100644 --- a/be/src/exec/es/es_scroll_parser.cpp +++ b/be/src/exec/es/es_scroll_parser.cpp @@ -32,24 +32,23 @@ #include #include "common/status.h" +#include "core/binary_cast.hpp" +#include "core/column/column.h" +#include "core/column/column_nullable.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/field.h" +#include "core/value/decimalv2_value.h" +#include "core/value/jsonb_value.h" +#include "core/value/vdatetime_value.h" #include "rapidjson/document.h" #include "rapidjson/rapidjson.h" #include "rapidjson/stringbuffer.h" #include "rapidjson/writer.h" -#include "runtime/decimalv2_value.h" -#include "runtime/define_primitive_type.h" #include "runtime/descriptors.h" -#include "runtime/jsonb_value.h" -#include "runtime/primitive_type.h" -#include "runtime/types.h" -#include "util/binary_cast.hpp" #include "util/string_parser.hpp" -#include "vec/columns/column.h" -#include "vec/columns/column_nullable.h" -#include "vec/core/field.h" -#include "vec/data_types/data_type_array.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/runtime/vdatetime_value.h" namespace doris { #include "common/compile_check_begin.h" @@ -305,7 +304,7 @@ Status get_date_int(const rapidjson::Value& col, PrimitiveType type, bool pure_d } template Status fill_date_int(const rapidjson::Value& col, PrimitiveType type, bool pure_doc_value, - vectorized::IColumn* col_ptr, const cctz::time_zone& time_zone) { + IColumn* col_ptr, const cctz::time_zone& time_zone) { typename PrimitiveTypeTraits::CppType data; RETURN_IF_ERROR((get_date_int(col, type, pure_doc_value, &data, time_zone))); col_ptr->insert_data(const_cast(reinterpret_cast(&data)), 0); @@ -340,8 +339,8 @@ Status get_float_value(const rapidjson::Value& col, PrimitiveType type, void* sl } template -Status insert_float_value(const rapidjson::Value& col, PrimitiveType type, - vectorized::IColumn* col_ptr, bool pure_doc_value, bool nullable) { +Status insert_float_value(const rapidjson::Value& col, PrimitiveType type, IColumn* col_ptr, + bool pure_doc_value, bool nullable) { static_assert(sizeof(T) == 4 || sizeof(T) == 8); if (col.IsNumber() && nullable) { T value = (T)(sizeof(T) == 4 ? col.GetFloat() : col.GetDouble()); @@ -370,8 +369,8 @@ Status insert_float_value(const rapidjson::Value& col, PrimitiveType type, } template -Status insert_int_value(const rapidjson::Value& col, PrimitiveType type, - vectorized::IColumn* col_ptr, bool pure_doc_value, bool nullable) { +Status insert_int_value(const rapidjson::Value& col, PrimitiveType type, IColumn* col_ptr, + bool pure_doc_value, bool nullable) { if (col.IsNumber()) { T value; // ES allows inserting float and double in int/long types. @@ -485,16 +484,16 @@ Status handle_value(const rapidjson::Value& col, PrimitiveType sub_type, bool pu template Status process_single_column(const rapidjson::Value& col, PrimitiveType sub_type, - bool pure_doc_value, vectorized::Array& array) { + bool pure_doc_value, Array& array) { typename PrimitiveTypeTraits::CppType val; RETURN_IF_ERROR(handle_value(col, sub_type, pure_doc_value, val)); - array.push_back(vectorized::Field::create_field(val)); + array.push_back(Field::create_field(val)); return Status::OK(); } template Status process_column_array(const rapidjson::Value& col, PrimitiveType sub_type, - bool pure_doc_value, vectorized::Array& array) { + bool pure_doc_value, Array& array) { for (const auto& sub_col : col.GetArray()) { RETURN_IF_ERROR(process_single_column(sub_col, sub_type, pure_doc_value, array)); } @@ -503,7 +502,7 @@ Status process_column_array(const rapidjson::Value& col, PrimitiveType sub_type, template Status process_column(const rapidjson::Value& col, PrimitiveType sub_type, bool pure_doc_value, - vectorized::Array& array) { + Array& array) { if (!col.IsArray()) { return process_single_column(col, sub_type, pure_doc_value, array); } else { @@ -513,41 +512,41 @@ Status process_column(const rapidjson::Value& col, PrimitiveType sub_type, bool template Status process_date_column(const rapidjson::Value& col, PrimitiveType sub_type, bool pure_doc_value, - vectorized::Array& array, const cctz::time_zone& time_zone) { + Array& array, const cctz::time_zone& time_zone) { if (!col.IsArray()) { typename PrimitiveTypeTraits::CppType data; RETURN_IF_ERROR((get_date_int(col, sub_type, pure_doc_value, &data, time_zone))); - array.push_back(vectorized::Field::create_field(data)); + array.push_back(Field::create_field(data)); } else { for (const auto& sub_col : col.GetArray()) { typename PrimitiveTypeTraits::CppType data; RETURN_IF_ERROR((get_date_int(sub_col, sub_type, pure_doc_value, &data, time_zone))); - array.push_back(vectorized::Field::create_field(data)); + array.push_back(Field::create_field(data)); } } return Status::OK(); } Status process_jsonb_column(const rapidjson::Value& col, PrimitiveType sub_type, - bool pure_doc_value, vectorized::Array& array) { + bool pure_doc_value, Array& array) { if (!col.IsArray()) { JsonBinaryValue jsonb_value; RETURN_IF_ERROR(jsonb_value.from_json_string(json_value_to_string(col))); - vectorized::JsonbField json(jsonb_value.value(), jsonb_value.size()); - array.push_back(vectorized::Field::create_field(std::move(json))); + JsonbField json(jsonb_value.value(), jsonb_value.size()); + array.push_back(Field::create_field(std::move(json))); } else { for (const auto& sub_col : col.GetArray()) { JsonBinaryValue jsonb_value; RETURN_IF_ERROR(jsonb_value.from_json_string(json_value_to_string(sub_col))); - vectorized::JsonbField json(jsonb_value.value(), jsonb_value.size()); - array.push_back(vectorized::Field::create_field(json)); + JsonbField json(jsonb_value.value(), jsonb_value.size()); + array.push_back(Field::create_field(json)); } } return Status::OK(); } Status ScrollParser::parse_column(const rapidjson::Value& col, PrimitiveType sub_type, - bool pure_doc_value, vectorized::Array& array, + bool pure_doc_value, Array& array, const cctz::time_zone& time_zone) { switch (sub_type) { case TYPE_CHAR: @@ -636,8 +635,7 @@ const std::string& ScrollParser::get_scroll_id() { } Status ScrollParser::fill_columns(const TupleDescriptor* tuple_desc, - std::vector& columns, - bool* line_eof, + std::vector& columns, bool* line_eof, const std::map& docvalue_context, const cctz::time_zone& time_zone) { *line_eof = true; @@ -681,7 +679,7 @@ Status ScrollParser::fill_columns(const TupleDescriptor* tuple_desc, if (line == nullptr || line->FindMember(col_name) == line->MemberEnd()) { if (slot_desc->is_nullable()) { - auto* nullable_column = reinterpret_cast(col_ptr); + auto* nullable_column = reinterpret_cast(col_ptr); nullable_column->insert_data(nullptr, 0); continue; } else { @@ -864,21 +862,20 @@ Status ScrollParser::fill_columns(const TupleDescriptor* tuple_desc, break; } case TYPE_ARRAY: { - vectorized::Array array; - const auto& sub_type = - assert_cast( - vectorized::remove_nullable(tuple_desc->slots()[i]->type()).get()) - ->get_nested_type() - ->get_primitive_type(); + Array array; + const auto& sub_type = assert_cast( + remove_nullable(tuple_desc->slots()[i]->type()).get()) + ->get_nested_type() + ->get_primitive_type(); RETURN_IF_ERROR(parse_column(col, sub_type, pure_doc_value, array, time_zone)); - col_ptr->insert(vectorized::Field::create_field(array)); + col_ptr->insert(Field::create_field(array)); break; } case TYPE_JSONB: { JsonBinaryValue jsonb_value; RETURN_IF_ERROR(jsonb_value.from_json_string(json_value_to_string(col))); - vectorized::JsonbField json(jsonb_value.value(), jsonb_value.size()); - col_ptr->insert(vectorized::Field::create_field(json)); + JsonbField json(jsonb_value.value(), jsonb_value.size()); + col_ptr->insert(Field::create_field(json)); break; } default: { diff --git a/be/src/exec/es/es_scroll_parser.h b/be/src/exec/es/es_scroll_parser.h index 06188833824881..b605bc2bddd5ab 100644 --- a/be/src/exec/es/es_scroll_parser.h +++ b/be/src/exec/es/es_scroll_parser.h @@ -23,8 +23,8 @@ #include #include +#include "core/data_type/data_type.h" #include "rapidjson/document.h" -#include "vec/data_types/data_type.h" namespace doris { @@ -38,9 +38,8 @@ class ScrollParser { Status parse(const std::string& scroll_result, bool exactly_once = false); // Add time_zone info to convert time field of ES to local time zone of Doris - Status fill_columns(const TupleDescriptor* _tuple_desc, - std::vector& columns, bool* line_eof, - const std::map& docvalue_context, + Status fill_columns(const TupleDescriptor* _tuple_desc, std::vector& columns, + bool* line_eof, const std::map& docvalue_context, const cctz::time_zone& time_zone); const std::string& get_scroll_id(); @@ -48,7 +47,7 @@ class ScrollParser { private: Status parse_column(const rapidjson::Value& col, PrimitiveType sub_type, bool pure_doc_value, - vectorized::Array& array, const cctz::time_zone& time_zone); + Array& array, const cctz::time_zone& time_zone); std::string _scroll_id; int _size; rapidjson::SizeType _line_index; diff --git a/be/src/pipeline/shuffle/exchange_writer.cpp b/be/src/exec/exchange/exchange_writer.cpp similarity index 78% rename from be/src/pipeline/shuffle/exchange_writer.cpp rename to be/src/exec/exchange/exchange_writer.cpp index 441b51dc4c40be..98437f74102a9c 100644 --- a/be/src/pipeline/shuffle/exchange_writer.cpp +++ b/be/src/exec/exchange/exchange_writer.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "exchange_writer.h" +#include "exec/exchange/exchange_writer.h" #include @@ -25,12 +25,12 @@ #include "common/logging.h" #include "common/status.h" -#include "pipeline/exec/exchange_sink_operator.h" -#include "vec/common/assert_cast.h" -#include "vec/core/block.h" -#include "vec/sink/tablet_sink_hash_partitioner.h" +#include "core/assert_cast.h" +#include "core/block/block.h" +#include "exec/operator/exchange_sink_operator.h" +#include "exec/sink/tablet_sink_hash_partitioner.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" ExchangeWriterBase::ExchangeWriterBase(ExchangeSinkLocalState& local_state) @@ -45,9 +45,9 @@ Status ExchangeWriterBase::_handle_eof_channel(RuntimeState* state, ChannelPtrTy } // NOLINTBEGIN(readability-function-cognitive-complexity) -Status ExchangeWriterBase::_add_rows_impl( - RuntimeState* state, std::vector>& channels, - size_t channel_count, vectorized::Block* block, bool eos) { +Status ExchangeWriterBase::_add_rows_impl(RuntimeState* state, + std::vector>& channels, + size_t channel_count, Block* block, bool eos) { Status status = Status::OK(); uint32_t offset = 0; for (size_t i = 0; i < channel_count; ++i) { @@ -74,9 +74,9 @@ Status ExchangeWriterBase::_add_rows_impl( } // NOLINTEND(readability-function-cognitive-complexity) -Status ExchangeOlapWriter::write(RuntimeState* state, vectorized::Block* block, bool eos) { - vectorized::Block prior_block; - auto* tablet_partitioner = assert_cast(_partitioner); +Status ExchangeOlapWriter::write(RuntimeState* state, Block* block, bool eos) { + Block prior_block; + auto* tablet_partitioner = assert_cast(_partitioner); RETURN_IF_ERROR(tablet_partitioner->try_cut_in_line(prior_block)); if (!prior_block.empty()) { // prior_block (batching rows) cuts in line, deal it first. @@ -90,22 +90,22 @@ Status ExchangeOlapWriter::write(RuntimeState* state, vectorized::Block* block, if (eos) { // get all batched rows tablet_partitioner->mark_last_block(); - vectorized::Block final_batching_block; + Block final_batching_block; RETURN_IF_ERROR(tablet_partitioner->try_cut_in_line(final_batching_block)); if (!final_batching_block.empty()) { RETURN_IF_ERROR(_write_impl(state, &final_batching_block, true)); } else { // No batched rows, send empty block with eos signal. - vectorized::Block empty_block = block->clone_empty(); + Block empty_block = block->clone_empty(); RETURN_IF_ERROR(_write_impl(state, &empty_block, true)); } } return Status::OK(); } -Status ExchangeOlapWriter::_write_impl(RuntimeState* state, vectorized::Block* block, bool eos) { +Status ExchangeOlapWriter::_write_impl(RuntimeState* state, Block* block, bool eos) { auto rows = block->rows(); - auto* tablet_partitioner = assert_cast(_partitioner); + auto* tablet_partitioner = assert_cast(_partitioner); { SCOPED_TIMER(_local_state.split_block_hash_compute_timer()); RETURN_IF_ERROR(tablet_partitioner->do_partitioning(state, block)); @@ -127,7 +127,7 @@ Status ExchangeOlapWriter::_write_impl(RuntimeState* state, vectorized::Block* b return Status::OK(); } -Status ExchangeTrivialWriter::write(RuntimeState* state, vectorized::Block* block, bool eos) { +Status ExchangeTrivialWriter::write(RuntimeState* state, Block* block, bool eos) { auto rows = block->rows(); { SCOPED_TIMER(_local_state.split_block_hash_compute_timer()); @@ -145,10 +145,12 @@ Status ExchangeTrivialWriter::write(RuntimeState* state, vectorized::Block* bloc return Status::OK(); } -Status ExchangeOlapWriter::_channel_add_rows( - RuntimeState* state, std::vector>& channels, - size_t channel_count, const std::vector& channel_ids, size_t rows, - vectorized::Block* block, bool eos, HashValType invalid_val) { +Status ExchangeOlapWriter::_channel_add_rows(RuntimeState* state, + std::vector>& channels, + size_t channel_count, + const std::vector& channel_ids, + size_t rows, Block* block, bool eos, + HashValType invalid_val) { size_t effective_rows = 0; effective_rows = std::ranges::count_if(channel_ids, [=](int64_t cid) { return cid != invalid_val; }); @@ -180,10 +182,11 @@ Status ExchangeOlapWriter::_channel_add_rows( return _add_rows_impl(state, channels, channel_count, block, eos); } -Status ExchangeTrivialWriter::_channel_add_rows( - RuntimeState* state, std::vector>& channels, - size_t channel_count, const std::vector& channel_ids, size_t rows, - vectorized::Block* block, bool eos) { +Status ExchangeTrivialWriter::_channel_add_rows(RuntimeState* state, + std::vector>& channels, + size_t channel_count, + const std::vector& channel_ids, + size_t rows, Block* block, bool eos) { _origin_row_idx.resize(rows); _channel_rows_histogram.assign(channel_count, 0U); _channel_pos_offsets.resize(channel_count); @@ -203,4 +206,4 @@ Status ExchangeTrivialWriter::_channel_add_rows( return _add_rows_impl(state, channels, channel_count, block, eos); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/shuffle/exchange_writer.h b/be/src/exec/exchange/exchange_writer.h similarity index 61% rename from be/src/pipeline/shuffle/exchange_writer.h rename to be/src/exec/exchange/exchange_writer.h index 34c3c7a90ed007..8488b860adf195 100644 --- a/be/src/pipeline/shuffle/exchange_writer.h +++ b/be/src/exec/exchange/exchange_writer.h @@ -19,64 +19,59 @@ #include -#include "vec/runtime/partitioner.h" -#include "vec/sink/vdata_stream_sender.h" +#include "exec/exchange/vdata_stream_sender.h" +#include "exec/partitioner/partitioner.h" namespace doris { class RuntimeState; class Status; -namespace vectorized { class Block; class Channel; class PartitionerBase; class TabletSinkHashPartitioner; -} // namespace vectorized -namespace pipeline { #include "common/compile_check_begin.h" class ExchangeSinkLocalState; class ExchangeWriterBase { public: - using HashValType = vectorized::PartitionerBase::HashValType; + using HashValType = PartitionerBase::HashValType; ExchangeWriterBase(ExchangeSinkLocalState& local_state); - virtual Status write(RuntimeState* state, vectorized::Block* block, bool eos) = 0; + virtual Status write(RuntimeState* state, Block* block, bool eos) = 0; virtual ~ExchangeWriterBase() = default; protected: template Status _handle_eof_channel(RuntimeState* state, ChannelPtrType channel, Status st) const; - Status _add_rows_impl(RuntimeState* state, - std::vector>& channels, - size_t channel_count, vectorized::Block* block, bool eos); + Status _add_rows_impl(RuntimeState* state, std::vector>& channels, + size_t channel_count, Block* block, bool eos); // myself as a visitor of local state ExchangeSinkLocalState& _local_state; - vectorized::PartitionerBase* _partitioner; + PartitionerBase* _partitioner; // _origin_row_idx[i]: row id in original block for the i-th's data we send. - vectorized::PaddedPODArray _origin_row_idx; + PaddedPODArray _origin_row_idx; // _channel_rows_histogram[i]: number of rows for channel i in current batch - vectorized::PaddedPODArray _channel_rows_histogram; + PaddedPODArray _channel_rows_histogram; // _channel_start_offsets[i]: the start offset of channel i in _row_idx // its value equals to prefix sum of _channel_rows_histogram // after calculation, it will be end offset for channel i. - vectorized::PaddedPODArray _channel_pos_offsets; + PaddedPODArray _channel_pos_offsets; }; class ExchangeTrivialWriter final : public ExchangeWriterBase { public: ExchangeTrivialWriter(ExchangeSinkLocalState& local_state) : ExchangeWriterBase(local_state) {} - Status write(RuntimeState* state, vectorized::Block* block, bool eos) override; + Status write(RuntimeState* state, Block* block, bool eos) override; private: - Status _channel_add_rows(RuntimeState* state, - std::vector>& channels, + Status _channel_add_rows(RuntimeState* state, std::vector>& channels, size_t channel_count, const std::vector& channel_ids, - size_t rows, vectorized::Block* block, bool eos); + size_t rows, Block* block, bool eos); }; // maybe auto partition @@ -84,16 +79,13 @@ class ExchangeOlapWriter final : public ExchangeWriterBase { public: ExchangeOlapWriter(ExchangeSinkLocalState& local_state) : ExchangeWriterBase(local_state) {} - Status write(RuntimeState* state, vectorized::Block* block, bool eos) override; + Status write(RuntimeState* state, Block* block, bool eos) override; private: - Status _write_impl(RuntimeState* state, vectorized::Block* block, bool eos = false); - Status _channel_add_rows(RuntimeState* state, - std::vector>& channels, + Status _write_impl(RuntimeState* state, Block* block, bool eos = false); + Status _channel_add_rows(RuntimeState* state, std::vector>& channels, size_t channel_count, const std::vector& channel_ids, - size_t rows, vectorized::Block* block, bool eos, - HashValType invalid_val); + size_t rows, Block* block, bool eos, HashValType invalid_val); }; #include "common/compile_check_end.h" -} // namespace pipeline } // namespace doris diff --git a/be/src/pipeline/local_exchange/local_exchange_sink_operator.cpp b/be/src/exec/exchange/local_exchange_sink_operator.cpp similarity index 89% rename from be/src/pipeline/local_exchange/local_exchange_sink_operator.cpp rename to be/src/exec/exchange/local_exchange_sink_operator.cpp index 1937b111975cf2..0a11596cfeea9a 100644 --- a/be/src/pipeline/local_exchange/local_exchange_sink_operator.cpp +++ b/be/src/exec/exchange/local_exchange_sink_operator.cpp @@ -15,15 +15,15 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/local_exchange/local_exchange_sink_operator.h" +#include "exec/exchange/local_exchange_sink_operator.h" #include -#include "pipeline/local_exchange/local_exchanger.h" -#include "vec/runtime/partitioner.h" -#include "vec/sink/vdata_stream_sender.h" +#include "exec/exchange/local_exchanger.h" +#include "exec/exchange/vdata_stream_sender.h" +#include "exec/partitioner/partitioner.h" -namespace doris::pipeline { +namespace doris { LocalExchangeSinkLocalState::~LocalExchangeSinkLocalState() = default; @@ -58,18 +58,15 @@ Status LocalExchangeSinkOperatorX::init(RuntimeState* state, ExchangeType type, } if (state->query_options().__isset.enable_new_shuffle_hash_method && state->query_options().enable_new_shuffle_hash_method) { - _partitioner = std::make_unique(_num_partitions); + _partitioner = std::make_unique(_num_partitions); } else { - _partitioner = std::make_unique< - vectorized::Crc32HashPartitioner>( - _num_partitions); + _partitioner = + std::make_unique>(_num_partitions); } RETURN_IF_ERROR(_partitioner->init(_texprs)); } else if (_type == ExchangeType::BUCKET_HASH_SHUFFLE) { DCHECK_GT(num_buckets, 0); - _partitioner = - std::make_unique>( - num_buckets); + _partitioner = std::make_unique>(num_buckets); RETURN_IF_ERROR(_partitioner->init(_texprs)); } return Status::OK(); @@ -144,8 +141,7 @@ std::string LocalExchangeSinkLocalState::debug_string(int indentation_level) con return fmt::to_string(debug_string_buffer); } -Status LocalExchangeSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block, - bool eos) { +Status LocalExchangeSinkOperatorX::sink(RuntimeState* state, Block* in_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)in_block->rows()); @@ -169,4 +165,4 @@ Status LocalExchangeSinkOperatorX::sink(RuntimeState* state, vectorized::Block* return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/local_exchange/local_exchange_sink_operator.h b/be/src/exec/exchange/local_exchange_sink_operator.h similarity index 92% rename from be/src/pipeline/local_exchange/local_exchange_sink_operator.h rename to be/src/exec/exchange/local_exchange_sink_operator.h index c4723a9f5127b7..01b958645d32fa 100644 --- a/be/src/pipeline/local_exchange/local_exchange_sink_operator.h +++ b/be/src/exec/exchange/local_exchange_sink_operator.h @@ -17,13 +17,13 @@ #pragma once -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" -namespace doris::vectorized { +namespace doris { class PartitionerBase; } -namespace doris::pipeline { +namespace doris { class ExchangerBase; class ShuffleExchanger; @@ -62,7 +62,7 @@ class LocalExchangeSinkLocalState final : public PipelineXSinkLocalState _partitioner = nullptr; + std::unique_ptr _partitioner = nullptr; // Used by random passthrough exchanger int _channel_id = 0; @@ -103,7 +103,7 @@ class LocalExchangeSinkOperatorX final : public DataSinkOperatorX& _texprs; const size_t _partitioned_exprs_num; - std::unique_ptr _partitioner; + std::unique_ptr _partitioner; std::map _shuffle_idx_to_instance_idx; bool _use_global_shuffle = false; }; -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/local_exchange/local_exchange_source_operator.cpp b/be/src/exec/exchange/local_exchange_source_operator.cpp similarity index 93% rename from be/src/pipeline/local_exchange/local_exchange_source_operator.cpp rename to be/src/exec/exchange/local_exchange_source_operator.cpp index 81f34d30c9bd8e..ad092656f21793 100644 --- a/be/src/pipeline/local_exchange/local_exchange_source_operator.cpp +++ b/be/src/exec/exchange/local_exchange_source_operator.cpp @@ -15,11 +15,11 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/local_exchange/local_exchange_source_operator.h" +#include "exec/exchange/local_exchange_source_operator.h" -#include "pipeline/local_exchange/local_exchanger.h" +#include "exec/exchange/local_exchanger.h" -namespace doris::pipeline { +namespace doris { Status LocalExchangeSourceLocalState::init(RuntimeState* state, LocalStateInfo& info) { RETURN_IF_ERROR(Base::init(state, info)); @@ -89,8 +89,7 @@ std::string LocalExchangeSourceLocalState::debug_string(int indentation_level) c return fmt::to_string(debug_string_buffer); } -Status LocalExchangeSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* block, - bool* eos) { +Status LocalExchangeSourceOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); RETURN_IF_ERROR(local_state._exchanger->get_block( @@ -100,4 +99,4 @@ Status LocalExchangeSourceOperatorX::get_block(RuntimeState* state, vectorized:: return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/local_exchange/local_exchange_source_operator.h b/be/src/exec/exchange/local_exchange_source_operator.h similarity index 94% rename from be/src/pipeline/local_exchange/local_exchange_source_operator.h rename to be/src/exec/exchange/local_exchange_source_operator.h index c9541e69ab5ad5..58252b24ec2c23 100644 --- a/be/src/pipeline/local_exchange/local_exchange_source_operator.h +++ b/be/src/exec/exchange/local_exchange_source_operator.h @@ -17,9 +17,9 @@ #pragma once -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { class ExchangerBase; class ShuffleExchanger; @@ -78,7 +78,7 @@ class LocalExchangeSourceOperatorX final : public OperatorXrow_descriptor(); } const RowDescriptor& row_desc() const override { return _child->row_desc(); } - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override; + Status get_block(RuntimeState* state, Block* block, bool* eos) override; bool is_source() const override { return true; } @@ -88,4 +88,4 @@ class LocalExchangeSourceOperatorX final : public OperatorX void Exchanger::_enqueue_data_and_set_ready(int channel_id, @@ -52,7 +52,7 @@ void Exchanger::_enqueue_data_and_set_ready(int channel_id, template bool Exchanger::_dequeue_data(LocalExchangeSourceLocalState* local_state, - BlockType& block, bool* eos, vectorized::Block* data_block, + BlockType& block, bool* eos, Block* data_block, int channel_id) { if (local_state == nullptr) { return _dequeue_data(block, eos, data_block, channel_id); @@ -100,7 +100,7 @@ void Exchanger::_enqueue_data_and_set_ready(int channel_id, BlockType } template -bool Exchanger::_dequeue_data(BlockType& block, bool* eos, vectorized::Block* data_block, +bool Exchanger::_dequeue_data(BlockType& block, bool* eos, Block* data_block, int channel_id) { if (_data_queue[channel_id].try_dequeue(block)) { if constexpr (!std::is_same_v && @@ -112,8 +112,8 @@ bool Exchanger::_dequeue_data(BlockType& block, bool* eos, vectorized return false; } -Status ShuffleExchanger::sink(RuntimeState* state, vectorized::Block* in_block, bool eos, - Profile&& profile, SinkInfo& sink_info) { +Status ShuffleExchanger::sink(RuntimeState* state, Block* in_block, bool eos, Profile&& profile, + SinkInfo& sink_info) { if (in_block->empty()) { return Status::OK(); } @@ -136,7 +136,7 @@ Status ShuffleExchanger::sink(RuntimeState* state, vectorized::Block* in_block, void ShuffleExchanger::close(SourceInfo&& source_info) { PartitionedBlock partitioned_block; bool eos; - vectorized::Block block; + Block block; _data_queue[source_info.channel_id].set_eos(); while (_dequeue_data(source_info.local_state, partitioned_block, &eos, &block, source_info.channel_id)) { @@ -144,10 +144,10 @@ void ShuffleExchanger::close(SourceInfo&& source_info) { } } -Status ShuffleExchanger::get_block(RuntimeState* state, vectorized::Block* block, bool* eos, - Profile&& profile, SourceInfo&& source_info) { +Status ShuffleExchanger::get_block(RuntimeState* state, Block* block, bool* eos, Profile&& profile, + SourceInfo&& source_info) { PartitionedBlock partitioned_block; - vectorized::MutableBlock mutable_block; + MutableBlock mutable_block; auto get_data = [&]() -> Status { do { @@ -165,7 +165,7 @@ Status ShuffleExchanger::get_block(RuntimeState* state, vectorized::Block* block if (_dequeue_data(source_info.local_state, partitioned_block, eos, block, source_info.channel_id)) { SCOPED_TIMER(profile.copy_data_timer); - mutable_block = vectorized::VectorizedUtils::build_mutable_mem_reuse_block( + mutable_block = VectorizedUtils::build_mutable_mem_reuse_block( block, partitioned_block.first->_data_block); RETURN_IF_ERROR(get_data()); } @@ -173,14 +173,14 @@ Status ShuffleExchanger::get_block(RuntimeState* state, vectorized::Block* block } Status ShuffleExchanger::_split_rows(RuntimeState* state, const std::vector& channel_ids, - vectorized::Block* block, int channel_id, + Block* block, int channel_id, LocalExchangeSinkLocalState* local_state, std::map* shuffle_idx_to_instance_idx) { if (local_state == nullptr) { return _split_rows(state, channel_ids, block, channel_id); } const auto rows = cast_set(block->rows()); - auto row_idx = std::make_shared>(rows); + auto row_idx = std::make_shared>(rows); auto& partition_rows_histogram = _partition_rows_histogram[channel_id]; { partition_rows_histogram.assign(_num_partitions + 1, 0); @@ -196,7 +196,7 @@ Status ShuffleExchanger::_split_rows(RuntimeState* state, const std::vector new_block_wrapper; if (!_free_blocks.try_dequeue(data_block)) { data_block = block->clone_empty(); @@ -246,9 +246,9 @@ Status ShuffleExchanger::_split_rows(RuntimeState* state, const std::vector& channel_ids, - vectorized::Block* block, int channel_id) { + Block* block, int channel_id) { const auto rows = cast_set(block->rows()); - auto row_idx = std::make_shared>(rows); + auto row_idx = std::make_shared>(rows); auto& partition_rows_histogram = _partition_rows_histogram[channel_id]; { partition_rows_histogram.assign(_num_partitions + 1, 0); @@ -264,7 +264,7 @@ Status ShuffleExchanger::_split_rows(RuntimeState* state, const std::vector new_block_wrapper; if (!_free_blocks.try_dequeue(data_block)) { data_block = block->clone_empty(); @@ -287,12 +287,12 @@ Status ShuffleExchanger::_split_rows(RuntimeState* state, const std::vectorempty()) { return Status::OK(); } - vectorized::Block new_block; + Block new_block; if (!_free_blocks.try_dequeue(new_block)) { new_block = {in_block->clone_empty()}; } @@ -311,7 +311,7 @@ Status PassthroughExchanger::sink(RuntimeState* state, vectorized::Block* in_blo } void PassthroughExchanger::close(SourceInfo&& source_info) { - vectorized::Block next_block; + Block next_block; BlockWrapperSPtr wrapper; bool eos; _data_queue[source_info.channel_id].set_eos(); @@ -322,7 +322,7 @@ void PassthroughExchanger::close(SourceInfo&& source_info) { } void PassToOneExchanger::close(SourceInfo&& source_info) { - vectorized::Block next_block; + Block next_block; BlockWrapperSPtr wrapper; bool eos; _data_queue[source_info.channel_id].set_eos(); @@ -332,19 +332,19 @@ void PassToOneExchanger::close(SourceInfo&& source_info) { } } -Status PassthroughExchanger::get_block(RuntimeState* state, vectorized::Block* block, bool* eos, +Status PassthroughExchanger::get_block(RuntimeState* state, Block* block, bool* eos, Profile&& profile, SourceInfo&& source_info) { BlockWrapperSPtr next_block; _dequeue_data(source_info.local_state, next_block, eos, block, source_info.channel_id); return Status::OK(); } -Status PassToOneExchanger::sink(RuntimeState* state, vectorized::Block* in_block, bool eos, - Profile&& profile, SinkInfo& sink_info) { +Status PassToOneExchanger::sink(RuntimeState* state, Block* in_block, bool eos, Profile&& profile, + SinkInfo& sink_info) { if (in_block->empty()) { return Status::OK(); } - vectorized::Block new_block; + Block new_block; if (!_free_blocks.try_dequeue(new_block)) { new_block = {in_block->clone_empty()}; } @@ -361,7 +361,7 @@ Status PassToOneExchanger::sink(RuntimeState* state, vectorized::Block* in_block return Status::OK(); } -Status PassToOneExchanger::get_block(RuntimeState* state, vectorized::Block* block, bool* eos, +Status PassToOneExchanger::get_block(RuntimeState* state, Block* block, bool* eos, Profile&& profile, SourceInfo&& source_info) { if (source_info.channel_id != 0) { *eos = true; @@ -374,18 +374,18 @@ Status PassToOneExchanger::get_block(RuntimeState* state, vectorized::Block* blo void ExchangerBase::finalize() { DCHECK(_running_source_operators == 0); - vectorized::Block block; + Block block; while (_free_blocks.try_dequeue(block)) { // do nothing } } -Status BroadcastExchanger::sink(RuntimeState* state, vectorized::Block* in_block, bool eos, - Profile&& profile, SinkInfo& sink_info) { +Status BroadcastExchanger::sink(RuntimeState* state, Block* in_block, bool eos, Profile&& profile, + SinkInfo& sink_info) { if (in_block->empty()) { return Status::OK(); } - vectorized::Block new_block; + Block new_block; if (!_free_blocks.try_dequeue(new_block)) { new_block = {in_block->clone_empty()}; } @@ -405,7 +405,7 @@ Status BroadcastExchanger::sink(RuntimeState* state, vectorized::Block* in_block void BroadcastExchanger::close(SourceInfo&& source_info) { BroadcastBlock partitioned_block; bool eos; - vectorized::Block block; + Block block; _data_queue[source_info.channel_id].set_eos(); while (_dequeue_data(source_info.local_state, partitioned_block, &eos, &block, source_info.channel_id)) { @@ -413,16 +413,15 @@ void BroadcastExchanger::close(SourceInfo&& source_info) { } } -Status BroadcastExchanger::get_block(RuntimeState* state, vectorized::Block* block, bool* eos, +Status BroadcastExchanger::get_block(RuntimeState* state, Block* block, bool* eos, Profile&& profile, SourceInfo&& source_info) { BroadcastBlock partitioned_block; if (_dequeue_data(source_info.local_state, partitioned_block, eos, block, source_info.channel_id)) { SCOPED_TIMER(profile.copy_data_timer); - vectorized::MutableBlock mutable_block = - vectorized::VectorizedUtils::build_mutable_mem_reuse_block( - block, partitioned_block.first->_data_block); + MutableBlock mutable_block = VectorizedUtils::build_mutable_mem_reuse_block( + block, partitioned_block.first->_data_block); auto block_wrapper = partitioned_block.first; RETURN_IF_ERROR(mutable_block.add_rows(&block_wrapper->_data_block, partitioned_block.second.offset_start, @@ -432,10 +431,9 @@ Status BroadcastExchanger::get_block(RuntimeState* state, vectorized::Block* blo return Status::OK(); } -Status AdaptivePassthroughExchanger::_passthrough_sink(RuntimeState* state, - vectorized::Block* in_block, +Status AdaptivePassthroughExchanger::_passthrough_sink(RuntimeState* state, Block* in_block, SinkInfo& sink_info) { - vectorized::Block new_block; + Block new_block; if (!_free_blocks.try_dequeue(new_block)) { new_block = {in_block->clone_empty()}; } @@ -453,7 +451,7 @@ Status AdaptivePassthroughExchanger::_passthrough_sink(RuntimeState* state, return Status::OK(); } -Status AdaptivePassthroughExchanger::_shuffle_sink(RuntimeState* state, vectorized::Block* block, +Status AdaptivePassthroughExchanger::_shuffle_sink(RuntimeState* state, Block* block, SinkInfo& sink_info) { std::vector channel_ids; const auto num_rows = block->rows(); @@ -478,7 +476,7 @@ Status AdaptivePassthroughExchanger::_shuffle_sink(RuntimeState* state, vectoriz Status AdaptivePassthroughExchanger::_split_rows(RuntimeState* state, const std::vector& channel_ids, - vectorized::Block* block, SinkInfo& sink_info) { + Block* block, SinkInfo& sink_info) { const auto rows = cast_set(block->rows()); auto row_idx = std::make_shared>(rows); auto& partition_rows_histogram = _partition_rows_histogram[*sink_info.channel_id]; @@ -500,8 +498,8 @@ Status AdaptivePassthroughExchanger::_split_rows(RuntimeState* state, const size_t start = partition_rows_histogram[i]; const size_t size = partition_rows_histogram[i + 1] - start; if (size > 0) { - std::unique_ptr mutable_block = - vectorized::MutableBlock::create_unique(block->clone_empty()); + std::unique_ptr mutable_block = + MutableBlock::create_unique(block->clone_empty()); RETURN_IF_ERROR(mutable_block->add_rows(block, start, size)); auto new_block = mutable_block->to_block(); @@ -516,8 +514,8 @@ Status AdaptivePassthroughExchanger::_split_rows(RuntimeState* state, return Status::OK(); } -Status AdaptivePassthroughExchanger::sink(RuntimeState* state, vectorized::Block* in_block, - bool eos, Profile&& profile, SinkInfo& sink_info) { +Status AdaptivePassthroughExchanger::sink(RuntimeState* state, Block* in_block, bool eos, + Profile&& profile, SinkInfo& sink_info) { if (in_block->empty()) { return Status::OK(); } @@ -531,16 +529,15 @@ Status AdaptivePassthroughExchanger::sink(RuntimeState* state, vectorized::Block } } -Status AdaptivePassthroughExchanger::get_block(RuntimeState* state, vectorized::Block* block, - bool* eos, Profile&& profile, - SourceInfo&& source_info) { +Status AdaptivePassthroughExchanger::get_block(RuntimeState* state, Block* block, bool* eos, + Profile&& profile, SourceInfo&& source_info) { BlockWrapperSPtr next_block; _dequeue_data(source_info.local_state, next_block, eos, block, source_info.channel_id); return Status::OK(); } void AdaptivePassthroughExchanger::close(SourceInfo&& source_info) { - vectorized::Block next_block; + Block next_block; bool eos; BlockWrapperSPtr wrapper; _data_queue[source_info.channel_id].set_eos(); @@ -550,4 +547,4 @@ void AdaptivePassthroughExchanger::close(SourceInfo&& source_info) { } } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/local_exchange/local_exchanger.h b/be/src/exec/exchange/local_exchanger.h similarity index 85% rename from be/src/pipeline/local_exchange/local_exchanger.h rename to be/src/exec/exchange/local_exchanger.h index 08fff542f3be04..f1c784a9be67bc 100644 --- a/be/src/pipeline/local_exchange/local_exchanger.h +++ b/be/src/exec/exchange/local_exchanger.h @@ -17,19 +17,16 @@ #pragma once -#include "pipeline/dependency.h" -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" +#include "exec/pipeline/dependency.h" namespace doris { #include "common/compile_check_begin.h" -namespace vectorized { template void clear_blocks(moodycamel::ConcurrentQueue& blocks, RuntimeProfile::Counter* memory_used_counter = nullptr); class PartitionerBase; -} // namespace vectorized -namespace pipeline { class LocalExchangeSourceLocalState; class LocalExchangeSinkLocalState; @@ -41,7 +38,7 @@ struct Profile { struct SinkInfo { int* channel_id; - vectorized::PartitionerBase* partitioner; + PartitionerBase* partitioner; LocalExchangeSinkLocalState* local_state; std::map* shuffle_idx_to_instance_idx; }; @@ -78,8 +75,7 @@ class ExchangerBase { class BlockWrapper { public: ENABLE_FACTORY_CREATOR(BlockWrapper); - BlockWrapper(vectorized::Block&& data_block, LocalExchangeSharedState* shared_state, - int channel_id) + BlockWrapper(Block&& data_block, LocalExchangeSharedState* shared_state, int channel_id) : _data_block(std::move(data_block)), _shared_state(shared_state), _allocated_bytes(_data_block.allocated_bytes()) { @@ -121,7 +117,7 @@ class ExchangerBase { template friend class Exchanger; - vectorized::Block _data_block; + Block _data_block; LocalExchangeSharedState* _shared_state; std::vector _channel_ids; const size_t _allocated_bytes; @@ -142,10 +138,10 @@ class ExchangerBase { _num_sources(num_sources), _free_block_limit(free_block_limit) {} virtual ~ExchangerBase() = default; - virtual Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos, - Profile&& profile, SourceInfo&& source_info) = 0; - virtual Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos, - Profile&& profile, SinkInfo& sink_info) = 0; + virtual Status get_block(RuntimeState* state, Block* block, bool* eos, Profile&& profile, + SourceInfo&& source_info) = 0; + virtual Status sink(RuntimeState* state, Block* in_block, bool eos, Profile&& profile, + SinkInfo& sink_info) = 0; virtual ExchangeType get_type() const = 0; // Called if a local exchanger source operator are closed. Free the unused data block in data_queue. virtual void close(SourceInfo&& source_info) = 0; @@ -171,11 +167,11 @@ class ExchangerBase { const int _num_senders; const int _num_sources; std::atomic_int _free_block_limit = 0; - moodycamel::ConcurrentQueue _free_blocks; + moodycamel::ConcurrentQueue _free_blocks; }; struct PartitionedRowIdxs { - std::shared_ptr> row_idxs; + std::shared_ptr> row_idxs; uint32_t offset_start; uint32_t length; }; @@ -183,11 +179,11 @@ struct PartitionedRowIdxs { using PartitionedBlock = std::pair, PartitionedRowIdxs>; -struct RowRange { +struct BroadcastRowRange { uint32_t offset_start; size_t length; }; -using BroadcastBlock = std::pair, RowRange>; +using BroadcastBlock = std::pair, BroadcastRowRange>; template struct BlockQueue { @@ -258,10 +254,10 @@ class Exchanger : public ExchangerBase { void _enqueue_data_and_set_ready(int channel_id, LocalExchangeSinkLocalState* local_state, BlockType&& block); bool _dequeue_data(LocalExchangeSourceLocalState* local_state, BlockType& block, bool* eos, - vectorized::Block* data_block, int channel_id); + Block* data_block, int channel_id); void _enqueue_data_and_set_ready(int channel_id, BlockType&& block); - bool _dequeue_data(BlockType& block, bool* eos, vectorized::Block* data_block, int channel_id); + bool _dequeue_data(BlockType& block, bool* eos, Block* data_block, int channel_id); std::vector> _data_queue; std::vector> _m; }; @@ -281,21 +277,20 @@ class ShuffleExchanger : public Exchanger { _partition_rows_histogram.resize(running_sink_operators); } ~ShuffleExchanger() override = default; - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos, Profile&& profile, + Status sink(RuntimeState* state, Block* in_block, bool eos, Profile&& profile, SinkInfo& sink_info) override; - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos, Profile&& profile, + Status get_block(RuntimeState* state, Block* block, bool* eos, Profile&& profile, SourceInfo&& source_info) override; void close(SourceInfo&& source_info) override; ExchangeType get_type() const override { return ExchangeType::HASH_SHUFFLE; } protected: - Status _split_rows(RuntimeState* state, const std::vector& channel_ids, - vectorized::Block* block, int channel_id, - LocalExchangeSinkLocalState* local_state, + Status _split_rows(RuntimeState* state, const std::vector& channel_ids, Block* block, + int channel_id, LocalExchangeSinkLocalState* local_state, std::map* shuffle_idx_to_instance_idx); - Status _split_rows(RuntimeState* state, const std::vector& channel_ids, - vectorized::Block* block, int channel_id); + Status _split_rows(RuntimeState* state, const std::vector& channel_ids, Block* block, + int channel_id); std::vector> _partition_rows_histogram; }; @@ -316,10 +311,10 @@ class PassthroughExchanger final : public Exchanger { : Exchanger(running_sink_operators, num_partitions, free_block_limit) {} ~PassthroughExchanger() override = default; - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos, Profile&& profile, + Status sink(RuntimeState* state, Block* in_block, bool eos, Profile&& profile, SinkInfo& sink_info) override; - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos, Profile&& profile, + Status get_block(RuntimeState* state, Block* block, bool* eos, Profile&& profile, SourceInfo&& source_info) override; ExchangeType get_type() const override { return ExchangeType::PASSTHROUGH; } void close(SourceInfo&& source_info) override; @@ -332,10 +327,10 @@ class PassToOneExchanger final : public Exchanger { : Exchanger(running_sink_operators, num_partitions, free_block_limit) {} ~PassToOneExchanger() override = default; - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos, Profile&& profile, + Status sink(RuntimeState* state, Block* in_block, bool eos, Profile&& profile, SinkInfo& sink_info) override; - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos, Profile&& profile, + Status get_block(RuntimeState* state, Block* block, bool* eos, Profile&& profile, SourceInfo&& source_info) override; ExchangeType get_type() const override { return ExchangeType::PASS_TO_ONE; } void close(SourceInfo&& source_info) override; @@ -346,10 +341,10 @@ class BroadcastExchanger final : public Exchanger { BroadcastExchanger(int running_sink_operators, int num_partitions, int free_block_limit) : Exchanger(running_sink_operators, num_partitions, free_block_limit) {} ~BroadcastExchanger() override = default; - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos, Profile&& profile, + Status sink(RuntimeState* state, Block* in_block, bool eos, Profile&& profile, SinkInfo& sink_info) override; - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos, Profile&& profile, + Status get_block(RuntimeState* state, Block* block, bool* eos, Profile&& profile, SourceInfo&& source_info) override; ExchangeType get_type() const override { return ExchangeType::BROADCAST; } void close(SourceInfo&& source_info) override; @@ -366,25 +361,24 @@ class AdaptivePassthroughExchanger : public Exchanger { free_block_limit) { _partition_rows_histogram.resize(running_sink_operators); } - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos, Profile&& profile, + Status sink(RuntimeState* state, Block* in_block, bool eos, Profile&& profile, SinkInfo& sink_info) override; - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos, Profile&& profile, + Status get_block(RuntimeState* state, Block* block, bool* eos, Profile&& profile, SourceInfo&& source_info) override; ExchangeType get_type() const override { return ExchangeType::ADAPTIVE_PASSTHROUGH; } void close(SourceInfo&& source_info) override; private: - Status _passthrough_sink(RuntimeState* state, vectorized::Block* in_block, SinkInfo& sink_info); - Status _shuffle_sink(RuntimeState* state, vectorized::Block* in_block, SinkInfo& sink_info); - Status _split_rows(RuntimeState* state, const std::vector& channel_ids, - vectorized::Block* block, SinkInfo& sink_info); + Status _passthrough_sink(RuntimeState* state, Block* in_block, SinkInfo& sink_info); + Status _shuffle_sink(RuntimeState* state, Block* in_block, SinkInfo& sink_info); + Status _split_rows(RuntimeState* state, const std::vector& channel_ids, Block* block, + SinkInfo& sink_info); std::atomic_bool _is_pass_through = false; std::atomic_int32_t _total_block = 0; std::vector> _partition_rows_histogram; }; #include "common/compile_check_end.h" -} // namespace pipeline } // namespace doris \ No newline at end of file diff --git a/be/src/vec/runtime/vdata_stream_mgr.cpp b/be/src/exec/exchange/vdata_stream_mgr.cpp similarity index 98% rename from be/src/vec/runtime/vdata_stream_mgr.cpp rename to be/src/exec/exchange/vdata_stream_mgr.cpp index 00fa25bbcc088f..17bab298c432c8 100644 --- a/be/src/vec/runtime/vdata_stream_mgr.cpp +++ b/be/src/exec/exchange/vdata_stream_mgr.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/runtime/vdata_stream_mgr.h" +#include "exec/exchange/vdata_stream_mgr.h" #include #include @@ -29,12 +29,11 @@ #include #include "common/logging.h" +#include "exec/exchange/vdata_stream_recvr.h" #include "util/hash_util.hpp" -#include "vec/runtime/vdata_stream_recvr.h" namespace doris { #include "common/compile_check_begin.h" -namespace vectorized { VDataStreamMgr::VDataStreamMgr() { // TODO: metric @@ -256,5 +255,4 @@ void VDataStreamMgr::cancel(const TUniqueId& fragment_instance_id, Status exec_s } } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/runtime/vdata_stream_mgr.h b/be/src/exec/exchange/vdata_stream_mgr.h similarity index 96% rename from be/src/vec/runtime/vdata_stream_mgr.h rename to be/src/exec/exchange/vdata_stream_mgr.h index a9266d02d969ac..7bde8f3b4c0c9b 100644 --- a/be/src/vec/runtime/vdata_stream_mgr.h +++ b/be/src/exec/exchange/vdata_stream_mgr.h @@ -30,7 +30,7 @@ #include "common/be_mock_util.h" #include "common/global_types.h" #include "common/status.h" -#include "util/runtime_profile.h" +#include "runtime/runtime_profile.h" namespace google { #include "common/compile_check_begin.h" @@ -43,11 +43,8 @@ namespace doris { class RuntimeState; class RowDescriptor; class PTransmitDataParams; -namespace pipeline { class ExchangeLocalState; -} -namespace vectorized { class VDataStreamRecvr; class VDataStreamMgr { @@ -96,7 +93,6 @@ class VDataStreamMgr { uint32_t get_hash_value(const TUniqueId& fragment_instance_id, PlanNodeId node_id); }; -} // namespace vectorized } // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/runtime/vdata_stream_recvr.cpp b/be/src/exec/exchange/vdata_stream_recvr.cpp similarity index 96% rename from be/src/vec/runtime/vdata_stream_recvr.cpp rename to be/src/exec/exchange/vdata_stream_recvr.cpp index e6ff6f1a8a8f38..d98b49a9e09500 100644 --- a/be/src/vec/runtime/vdata_stream_recvr.cpp +++ b/be/src/exec/exchange/vdata_stream_recvr.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/runtime/vdata_stream_recvr.h" +#include "exec/exchange/vdata_stream_recvr.h" #include #include @@ -27,25 +27,24 @@ #include #include "common/logging.h" -#include "pipeline/exec/exchange_sink_operator.h" -#include "pipeline/exec/exchange_source_operator.h" +#include "core/block/block.h" +#include "core/block/materialize_block.h" +#include "exec/exchange/vdata_stream_mgr.h" +#include "exec/operator/exchange_sink_operator.h" +#include "exec/operator/exchange_source_operator.h" +#include "exec/sort/sort_cursor.h" +#include "exec/sort/vsorted_run_merger.h" #include "runtime/memory/mem_tracker.h" #include "runtime/runtime_state.h" #include "runtime/thread_context.h" #include "util/defer_op.h" #include "util/uid_util.h" -#include "vec/core/block.h" -#include "vec/core/materialize_block.h" -#include "vec/core/sort_cursor.h" -#include "vec/runtime/vdata_stream_mgr.h" -#include "vec/runtime/vsorted_run_merger.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" -VDataStreamRecvr::SenderQueue::SenderQueue( - VDataStreamRecvr* parent_recvr, int num_senders, - std::shared_ptr local_channel_dependency) +VDataStreamRecvr::SenderQueue::SenderQueue(VDataStreamRecvr* parent_recvr, int num_senders, + std::shared_ptr local_channel_dependency) : _recvr(parent_recvr), _is_cancelled(false), _num_remaining_senders(num_senders), @@ -352,7 +351,7 @@ VDataStreamRecvr::VDataStreamRecvr(VDataStreamMgr* stream_mgr, int num_queues = is_merging ? num_senders : 1; _sender_to_local_channel_dependency.resize(num_queues); for (size_t i = 0; i < num_queues; i++) { - _sender_to_local_channel_dependency[i] = pipeline::Dependency::create_shared( + _sender_to_local_channel_dependency[i] = Dependency::create_shared( _dest_node_id, _dest_node_id, fmt::format("LocalExchangeChannelDependency_{}", i), true); } @@ -439,8 +438,7 @@ std::string VDataStreamRecvr::debug_string() { return fmt::to_string(debug_string_buffer); } -std::shared_ptr VDataStreamRecvr::get_local_channel_dependency( - int sender_id) { +std::shared_ptr VDataStreamRecvr::get_local_channel_dependency(int sender_id) { DCHECK(_sender_to_local_channel_dependency[_is_merging ? sender_id : 0] != nullptr); return _sender_to_local_channel_dependency[_is_merging ? sender_id : 0]; } @@ -530,4 +528,4 @@ void VDataStreamRecvr::set_sink_dep_always_ready() const { } } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/runtime/vdata_stream_recvr.h b/be/src/exec/exchange/vdata_stream_recvr.h similarity index 93% rename from be/src/vec/runtime/vdata_stream_recvr.h rename to be/src/exec/exchange/vdata_stream_recvr.h index 1a1c84f3e67265..88e2604a601d92 100644 --- a/be/src/vec/runtime/vdata_stream_recvr.h +++ b/be/src/exec/exchange/vdata_stream_recvr.h @@ -42,14 +42,14 @@ #include "common/global_types.h" #include "common/object_pool.h" #include "common/status.h" +#include "core/block/block.h" +#include "exprs/vexpr_fwd.h" #include "runtime/descriptors.h" +#include "runtime/runtime_profile.h" #include "runtime/task_execution_context.h" #include "runtime/thread_context.h" #include "runtime/workload_group/workload_group.h" -#include "util/runtime_profile.h" #include "util/stopwatch.hpp" -#include "vec/core/block.h" -#include "vec/exprs/vexpr_fwd.h" namespace doris { #include "common/compile_check_begin.h" @@ -58,12 +58,9 @@ class PBlock; class MemTrackerLimiter; class RuntimeState; -namespace pipeline { class Dependency; class ExchangeLocalState; -} // namespace pipeline -namespace vectorized { class VDataStreamMgr; class VSortedRunMerger; @@ -116,7 +113,7 @@ class VDataStreamRecvr : public HasTaskExecutionCtx { bool queue_exceeds_limit(size_t byte_size) const; bool is_closed() const { return _is_closed; } - std::shared_ptr get_local_channel_dependency(int sender_id); + std::shared_ptr get_local_channel_dependency(int sender_id); void set_low_memory_mode() { _sender_queue_mem_limit = 1012 * 1024; } @@ -170,13 +167,13 @@ class VDataStreamRecvr : public HasTaskExecutionCtx { RuntimeProfile::Counter* _max_wait_to_process_time = nullptr; RuntimeProfile::Counter* _max_find_recvr_time = nullptr; - std::vector> _sender_to_local_channel_dependency; + std::vector> _sender_to_local_channel_dependency; }; class VDataStreamRecvr::SenderQueue { public: SenderQueue(VDataStreamRecvr* parent_recvr, int num_senders, - std::shared_ptr local_channel_dependency); + std::shared_ptr local_channel_dependency); ~SenderQueue(); @@ -195,9 +192,7 @@ class VDataStreamRecvr::SenderQueue { void close(); - void set_dependency(std::shared_ptr dependency) { - _source_dependency = dependency; - } + void set_dependency(std::shared_ptr dependency) { _source_dependency = dependency; } protected: void add_blocks_memory_usage(int64_t size); @@ -205,7 +200,7 @@ class VDataStreamRecvr::SenderQueue { void sub_blocks_memory_usage(int64_t size); bool exceeds_limit(); - friend class pipeline::ExchangeLocalState; + friend class ExchangeLocalState; void set_source_ready(std::lock_guard&); @@ -307,11 +302,10 @@ class VDataStreamRecvr::SenderQueue { std::unordered_map _packet_seq_map; std::deque> _pending_closures; - std::shared_ptr _source_dependency; - std::shared_ptr _local_channel_dependency; + std::shared_ptr _source_dependency; + std::shared_ptr _local_channel_dependency; }; -} // namespace vectorized } // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/sink/vdata_stream_sender.cpp b/be/src/exec/exchange/vdata_stream_sender.cpp similarity index 93% rename from be/src/vec/sink/vdata_stream_sender.cpp rename to be/src/exec/exchange/vdata_stream_sender.cpp index ab960fb96ce45b..213a2aec59c9c8 100644 --- a/be/src/vec/sink/vdata_stream_sender.cpp +++ b/be/src/exec/exchange/vdata_stream_sender.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/vdata_stream_sender.h" +#include "exec/exchange/vdata_stream_sender.h" #include #include // IWYU pragma: keep @@ -36,23 +36,22 @@ #include "common/object_pool.h" #include "common/status.h" -#include "exec/tablet_info.h" -#include "pipeline/exec/exchange_sink_operator.h" -#include "pipeline/exec/result_file_sink_operator.h" +#include "core/column/column_const.h" +#include "exec/common/sip_hash.h" +#include "exec/exchange/vdata_stream_mgr.h" +#include "exec/exchange/vdata_stream_recvr.h" +#include "exec/operator/exchange_sink_operator.h" +#include "exec/operator/result_file_sink_operator.h" +#include "exec/sink/vrow_distribution.h" +#include "exec/sink/writer/vtablet_writer_v2.h" +#include "exprs/vexpr.h" #include "runtime/descriptors.h" #include "runtime/runtime_state.h" #include "runtime/thread_context.h" -#include "runtime/types.h" +#include "storage/tablet_info.h" #include "util/proto_util.h" -#include "vec/columns/column_const.h" -#include "vec/common/sip_hash.h" -#include "vec/exprs/vexpr.h" -#include "vec/runtime/vdata_stream_mgr.h" -#include "vec/runtime/vdata_stream_recvr.h" -#include "vec/sink/vrow_distribution.h" -#include "vec/sink/writer/vtablet_writer_v2.h" - -namespace doris::vectorized { + +namespace doris { #include "common/compile_check_begin.h" Status Channel::init(RuntimeState* state) { @@ -147,7 +146,7 @@ Status Channel::add_rows(Block* block, const uint32_t* data, const uint32_t offs return Status::OK(); } -std::shared_ptr Channel::get_local_channel_dependency() { +std::shared_ptr Channel::get_local_channel_dependency() { if (!_local_recvr) { return nullptr; } @@ -224,7 +223,7 @@ Status Channel::send_local_block(Block* block, bool eos, bool can_be_moved) { return _receiver_status; } auto receiver_status = _recvr_status(); - // _local_recvr depdend on pipeline::ExchangeLocalState* _parent to do some memory counter settings + // _local_recvr depdend on ExchangeLocalState* _parent to do some memory counter settings // but it only owns a raw pointer, so that the ExchangeLocalState object may be deconstructed. // Lock the fragment context to ensure the runtime state and other objects are not deconstructed TaskExecutionContextSPtr ctx_lock = nullptr; @@ -290,7 +289,7 @@ Status Channel::close(RuntimeState* state) { } } -BlockSerializer::BlockSerializer(pipeline::ExchangeSinkLocalState* parent, bool is_local) +BlockSerializer::BlockSerializer(ExchangeSinkLocalState* parent, bool is_local) : _parent(parent), _is_local(is_local), _batch_size(parent->state()->batch_size()) {} Status BlockSerializer::next_serialized_block(Block* block, PBlock* dest, size_t num_receivers, @@ -360,4 +359,4 @@ Status BlockSerializer::serialize_block(const Block* src, PBlock* dest, size_t n return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/sink/vdata_stream_sender.h b/be/src/exec/exchange/vdata_stream_sender.h similarity index 84% rename from be/src/vec/sink/vdata_stream_sender.h rename to be/src/exec/exchange/vdata_stream_sender.h index 5b3cde6c3d0d27..29b6f400235ebd 100644 --- a/be/src/vec/sink/vdata_stream_sender.h +++ b/be/src/exec/exchange/vdata_stream_sender.h @@ -39,18 +39,18 @@ #include "common/global_types.h" #include "common/logging.h" #include "common/status.h" -#include "exec/tablet_info.h" -#include "pipeline/exec/exchange_sink_buffer.h" +#include "core/block/block.h" +#include "exec/exchange/vdata_stream_recvr.h" +#include "exec/operator/exchange_sink_buffer.h" +#include "exec/partitioner/partitioner.h" +#include "exec/sink/vrow_distribution.h" +#include "exec/sink/vtablet_finder.h" +#include "exprs/vexpr_context.h" +#include "runtime/runtime_profile.h" #include "service/backend_options.h" +#include "storage/tablet_info.h" #include "util/brpc_closure.h" -#include "util/runtime_profile.h" #include "util/uid_util.h" -#include "vec/core/block.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/runtime/partitioner.h" -#include "vec/runtime/vdata_stream_recvr.h" -#include "vec/sink/vrow_distribution.h" -#include "vec/sink/vtablet_finder.h" namespace doris { #include "common/compile_check_begin.h" @@ -65,17 +65,13 @@ namespace segment_v2 { enum CompressionTypePB : int; } // namespace segment_v2 -namespace pipeline { class ExchangeSinkOperatorX; class Dependency; class ExchangeSinkLocalState; -} // namespace pipeline - -namespace vectorized { class BlockSerializer { public: - BlockSerializer(pipeline::ExchangeSinkLocalState* parent, bool is_local = true); + BlockSerializer(ExchangeSinkLocalState* parent, bool is_local = true); #ifdef BE_TEST BlockSerializer() : _batch_size(0) {}; #endif @@ -98,7 +94,7 @@ class BlockSerializer { private: Status _serialize_block(PBlock* dest, size_t num_receivers = 1); - pipeline::ExchangeSinkLocalState* _parent; + ExchangeSinkLocalState* _parent; std::unique_ptr _mutable_block; bool _is_local; @@ -108,12 +104,12 @@ class BlockSerializer { class Channel { public: - friend class pipeline::ExchangeSinkBuffer; + friend class ExchangeSinkBuffer; // Create channel to send data to particular ipaddress/port/query/node // combination. buffer_size is specified in bytes and a soft limit on // how much tuple data is getting accumulated before being sent; it only applies // when data is added via add_row() and not sent directly via send_batch(). - Channel(pipeline::ExchangeSinkLocalState* parent, TNetworkAddress brpc_dest, + Channel(ExchangeSinkLocalState* parent, TNetworkAddress brpc_dest, TUniqueId fragment_instance_id, PlanNodeId dest_node_id) : _parent(parent), _fragment_instance_id(std::move(fragment_instance_id)), @@ -162,14 +158,14 @@ class Channel { Status add_rows(Block* block, const uint32_t* data, const uint32_t offset, const uint32_t size, bool eos); - void set_exchange_buffer(pipeline::ExchangeSinkBuffer* buffer) { _buffer = buffer; } + void set_exchange_buffer(ExchangeSinkBuffer* buffer) { _buffer = buffer; } InstanceLoId dest_ins_id() const { return _fragment_instance_id.lo; } - std::shared_ptr> get_send_callback( - pipeline::RpcInstance* ins, bool eos) { + std::shared_ptr> get_send_callback(RpcInstance* ins, + bool eos) { if (!_send_callback) { - _send_callback = pipeline::ExchangeSendCallback::create_shared(); + _send_callback = ExchangeSendCallback::create_shared(); } else { _send_callback->cntl_->Reset(); } @@ -177,7 +173,7 @@ class Channel { return _send_callback; } - std::shared_ptr get_local_channel_dependency(); + std::shared_ptr get_local_channel_dependency(); void set_low_memory_mode(RuntimeState* state) { _serializer.set_low_memory_mode(state); } @@ -196,7 +192,7 @@ class Channel { "local data stream receiver closed"); // local data stream receiver closed } - pipeline::ExchangeSinkLocalState* _parent = nullptr; + ExchangeSinkLocalState* _parent = nullptr; const TUniqueId _fragment_instance_id; PlanNodeId _dest_node_id; @@ -215,9 +211,9 @@ class Channel { BlockSerializer _serializer; - pipeline::ExchangeSinkBuffer* _buffer = nullptr; + ExchangeSinkBuffer* _buffer = nullptr; bool _eos_send = false; - std::shared_ptr> _send_callback; + std::shared_ptr> _send_callback; std::unique_ptr _pblock; }; @@ -230,7 +226,6 @@ class Channel { } \ } while (0) -} // namespace vectorized } // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/pipeline/exec/aggregation_sink_operator.cpp b/be/src/exec/operator/aggregation_sink_operator.cpp similarity index 92% rename from be/src/pipeline/exec/aggregation_sink_operator.cpp rename to be/src/exec/operator/aggregation_sink_operator.cpp index fee0f4c879c55f..69ad10a88d2a5b 100644 --- a/be/src/pipeline/exec/aggregation_sink_operator.cpp +++ b/be/src/exec/operator/aggregation_sink_operator.cpp @@ -15,22 +15,22 @@ // specific language governing permissions and limitations // under the License. -#include "aggregation_sink_operator.h" +#include "exec/operator/aggregation_sink_operator.h" #include #include #include "common/cast_set.h" #include "common/status.h" -#include "pipeline/exec/operator.h" -#include "runtime/primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "exec/common/hash_table/hash.h" +#include "exec/operator/operator.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/vectorized_agg_fn.h" +#include "runtime/runtime_profile.h" #include "runtime/thread_context.h" -#include "util/runtime_profile.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/common/hash_table/hash.h" -#include "vec/exprs/vectorized_agg_fn.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" /// The minimum reduction factor (input rows divided by output rows) to grow hash tables /// in a streaming preaggregation, given that the hash tables are currently the given @@ -102,7 +102,7 @@ Status AggSinkLocalState::open(RuntimeState* state) { } if (Base::_shared_state->probe_expr_ctxs.empty()) { - _agg_data->without_key = reinterpret_cast( + _agg_data->without_key = reinterpret_cast( Base::_shared_state->agg_profile_arena.aligned_alloc( p._total_size_of_aggregate_states, p._align_aggregate_states)); @@ -114,7 +114,7 @@ Status AggSinkLocalState::open(RuntimeState* state) { } else { RETURN_IF_ERROR(_init_hash_method(Base::_shared_state->probe_expr_ctxs)); - std::visit(vectorized::Overload {[&](std::monostate& arg) { + std::visit(Overload {[&](std::monostate& arg) { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -160,7 +160,7 @@ Status AggSinkLocalState::open(RuntimeState* state) { return Status::OK(); } -Status AggSinkLocalState::_create_agg_status(vectorized::AggregateDataPtr data) { +Status AggSinkLocalState::_create_agg_status(AggregateDataPtr data) { auto& shared_state = *Base::_shared_state; for (int i = 0; i < shared_state.aggregate_evaluators.size(); ++i) { try { @@ -177,7 +177,7 @@ Status AggSinkLocalState::_create_agg_status(vectorized::AggregateDataPtr data) return Status::OK(); } -Status AggSinkLocalState::_execute_without_key(vectorized::Block* block) { +Status AggSinkLocalState::_execute_without_key(Block* block) { DCHECK(_agg_data->without_key != nullptr); SCOPED_TIMER(_build_timer); _memory_usage_last_executing = 0; @@ -192,7 +192,7 @@ Status AggSinkLocalState::_execute_without_key(vectorized::Block* block) { return Status::OK(); } -Status AggSinkLocalState::_merge_with_serialized_key(vectorized::Block* block) { +Status AggSinkLocalState::_merge_with_serialized_key(Block* block) { _memory_usage_last_executing = 0; SCOPED_PEAK_MEM(&_memory_usage_last_executing); if (_shared_state->reach_limit) { @@ -213,7 +213,7 @@ size_t AggSinkLocalState::_memory_usage() const { usage += Base::_shared_state->aggregate_data_container->memory_usage(); } - std::visit(vectorized::Overload {[&](std::monostate& arg) -> void { + std::visit(Overload {[&](std::monostate& arg) -> void { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -230,11 +230,11 @@ bool AggSinkLocalState::is_blockable() const { return std::any_of( Base::_shared_state->aggregate_evaluators.begin(), Base::_shared_state->aggregate_evaluators.end(), - [](const vectorized::AggFnEvaluator* evaluator) { return evaluator->is_blockable(); }); + [](const AggFnEvaluator* evaluator) { return evaluator->is_blockable(); }); } void AggSinkLocalState::_update_memusage_with_serialized_key() { - std::visit(vectorized::Overload { + std::visit(Overload { [&](std::monostate& arg) -> void { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -258,7 +258,7 @@ void AggSinkLocalState::_update_memusage_with_serialized_key() { _agg_data->method_variant); } -Status AggSinkLocalState::_destroy_agg_status(vectorized::AggregateDataPtr data) { +Status AggSinkLocalState::_destroy_agg_status(AggregateDataPtr data) { auto& shared_state = *Base::_shared_state; for (int i = 0; i < shared_state.aggregate_evaluators.size(); ++i) { shared_state.aggregate_evaluators[i]->function()->destroy( @@ -268,11 +268,11 @@ Status AggSinkLocalState::_destroy_agg_status(vectorized::AggregateDataPtr data) } template -Status AggSinkLocalState::_merge_with_serialized_key_helper(vectorized::Block* block) { +Status AggSinkLocalState::_merge_with_serialized_key_helper(Block* block) { SCOPED_TIMER(_merge_timer); size_t key_size = Base::_shared_state->probe_expr_ctxs.size(); - vectorized::ColumnRawPtrs key_columns(key_size); + ColumnRawPtrs key_columns(key_size); std::vector key_locs(key_size); for (int i = 0; i < key_size; ++i) { @@ -394,7 +394,7 @@ Status AggSinkLocalState::_merge_with_serialized_key_helper(vectorized::Block* b return Status::OK(); } -Status AggSinkLocalState::_merge_without_key(vectorized::Block* block) { +Status AggSinkLocalState::_merge_without_key(Block* block) { SCOPED_TIMER(_merge_timer); DCHECK(_agg_data->without_key != nullptr); @@ -431,7 +431,7 @@ void AggSinkLocalState::_update_memusage_without_key() { COUNTER_SET(_serialize_key_arena_memory_usage, arena_memory_usage); } -Status AggSinkLocalState::_execute_with_serialized_key(vectorized::Block* block) { +Status AggSinkLocalState::_execute_with_serialized_key(Block* block) { _memory_usage_last_executing = 0; SCOPED_PEAK_MEM(&_memory_usage_last_executing); if (_shared_state->reach_limit) { @@ -442,12 +442,12 @@ Status AggSinkLocalState::_execute_with_serialized_key(vectorized::Block* block) } template -Status AggSinkLocalState::_execute_with_serialized_key_helper(vectorized::Block* block) { +Status AggSinkLocalState::_execute_with_serialized_key_helper(Block* block) { SCOPED_TIMER(_build_timer); DCHECK(!Base::_shared_state->probe_expr_ctxs.empty()); size_t key_size = Base::_shared_state->probe_expr_ctxs.size(); - vectorized::ColumnRawPtrs key_columns(key_size); + ColumnRawPtrs key_columns(key_size); std::vector key_locs(key_size); { SCOPED_TIMER(_expr_timer); @@ -520,15 +520,15 @@ Status AggSinkLocalState::_execute_with_serialized_key_helper(vectorized::Block* size_t AggSinkLocalState::_get_hash_table_size() const { return std::visit( - vectorized::Overload {[&](std::monostate& arg) -> size_t { return 0; }, + Overload {[&](std::monostate& arg) -> size_t { return 0; }, [&](auto& agg_method) { return agg_method.hash_table->size(); }}, _agg_data->method_variant); } -void AggSinkLocalState::_emplace_into_hash_table(vectorized::AggregateDataPtr* places, - vectorized::ColumnRawPtrs& key_columns, +void AggSinkLocalState::_emplace_into_hash_table(AggregateDataPtr* places, + ColumnRawPtrs& key_columns, uint32_t num_rows) { - std::visit(vectorized::Overload { + std::visit(Overload { [&](std::monostate& arg) -> void { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -565,7 +565,7 @@ void AggSinkLocalState::_emplace_into_hash_table(vectorized::AggregateDataPtr* p }; SCOPED_TIMER(_hash_table_emplace_timer); - vectorized::lazy_emplace_batch( + lazy_emplace_batch( agg_method, state, num_rows, creator, creator_for_null_key, [&](uint32_t row, auto& mapped) { places[row] = mapped; }); @@ -574,13 +574,13 @@ void AggSinkLocalState::_emplace_into_hash_table(vectorized::AggregateDataPtr* p _agg_data->method_variant); } -bool AggSinkLocalState::_emplace_into_hash_table_limit(vectorized::AggregateDataPtr* places, - vectorized::Block* block, +bool AggSinkLocalState::_emplace_into_hash_table_limit(AggregateDataPtr* places, + Block* block, const std::vector& key_locs, - vectorized::ColumnRawPtrs& key_columns, + ColumnRawPtrs& key_columns, uint32_t num_rows) { return std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); return true; @@ -602,7 +602,7 @@ bool AggSinkLocalState::_emplace_into_hash_table_limit(vectorized::AggregateData std::find(need_computes.begin(), need_computes.end(), 1); need_agg != need_computes.end()) { if (need_filter) { - vectorized::Block::filter_block_internal(block, need_computes); + Block::filter_block_internal(block, need_computes); for (int i = 0; i < key_locs.size(); ++i) { key_columns[i] = block->get_by_position(key_locs[i]).column.get(); @@ -649,7 +649,7 @@ bool AggSinkLocalState::_emplace_into_hash_table_limit(vectorized::AggregateData }; SCOPED_TIMER(_hash_table_emplace_timer); - vectorized::lazy_emplace_batch( + lazy_emplace_batch( agg_method, state, num_rows, creator, creator_for_null_key, [&](uint32_t row) { i = row; }, [&](uint32_t row, auto& mapped) { places[row] = mapped; }); @@ -661,10 +661,10 @@ bool AggSinkLocalState::_emplace_into_hash_table_limit(vectorized::AggregateData _agg_data->method_variant); } -void AggSinkLocalState::_find_in_hash_table(vectorized::AggregateDataPtr* places, - vectorized::ColumnRawPtrs& key_columns, +void AggSinkLocalState::_find_in_hash_table(AggregateDataPtr* places, + ColumnRawPtrs& key_columns, uint32_t num_rows) { - std::visit(vectorized::Overload { + std::visit(Overload { [&](std::monostate& arg) -> void { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -675,7 +675,7 @@ void AggSinkLocalState::_find_in_hash_table(vectorized::AggregateDataPtr* places agg_method.init_serialized_keys(key_columns, num_rows); /// For all rows. - vectorized::find_batch(agg_method, state, num_rows, + find_batch(agg_method, state, num_rows, [&](uint32_t row, auto& find_result) { if (find_result.is_found()) { places[row] = find_result.get_mapped(); @@ -687,7 +687,7 @@ void AggSinkLocalState::_find_in_hash_table(vectorized::AggregateDataPtr* places _agg_data->method_variant); } -Status AggSinkLocalState::_init_hash_method(const vectorized::VExprContextSPtrs& probe_exprs) { +Status AggSinkLocalState::_init_hash_method(const VExprContextSPtrs& probe_exprs) { RETURN_IF_ERROR(init_hash_method( _agg_data, get_data_types(probe_exprs), Base::_parent->template cast()._is_first_phase)); @@ -737,7 +737,7 @@ void AggSinkOperatorX::update_operator(const TPlanNode& tnode, bool followed_by_ tnode.agg_node.aggregate_functions.end(), [](const TExpr& texpr) -> bool { return texpr.nodes[0].fn.name.function_name.starts_with( - vectorized::DISTINCT_FUNCTION_PREFIX); + DISTINCT_FUNCTION_PREFIX); })) ? tnode.distribute_expr_lists[0] : tnode.agg_node.grouping_exprs; @@ -747,15 +747,15 @@ Status AggSinkOperatorX::init(const TPlanNode& tnode, RuntimeState* state) { RETURN_IF_ERROR(DataSinkOperatorX::init(tnode, state)); // ignore return status for now , so we need to introduce ExecNode::init() RETURN_IF_ERROR( - vectorized::VExpr::create_expr_trees(tnode.agg_node.grouping_exprs, _probe_expr_ctxs)); + VExpr::create_expr_trees(tnode.agg_node.grouping_exprs, _probe_expr_ctxs)); // init aggregate functions _aggregate_evaluators.reserve(tnode.agg_node.aggregate_functions.size()); TSortInfo dummy; for (int i = 0; i < tnode.agg_node.aggregate_functions.size(); ++i) { - vectorized::AggFnEvaluator* evaluator = nullptr; - RETURN_IF_ERROR(vectorized::AggFnEvaluator::create( + AggFnEvaluator* evaluator = nullptr; + RETURN_IF_ERROR(AggFnEvaluator::create( _pool, tnode.agg_node.aggregate_functions[i], tnode.agg_node.__isset.agg_sort_infos ? tnode.agg_node.agg_sort_infos[i] : dummy, tnode.agg_node.grouping_exprs.empty(), false, &evaluator)); @@ -798,10 +798,10 @@ Status AggSinkOperatorX::_init_probe_expr_ctx(RuntimeState* state) { _intermediate_tuple_desc = state->desc_tbl().get_tuple_descriptor(_intermediate_tuple_id); _output_tuple_desc = state->desc_tbl().get_tuple_descriptor(_output_tuple_id); DCHECK_EQ(_intermediate_tuple_desc->slots().size(), _output_tuple_desc->slots().size()); - RETURN_IF_ERROR(vectorized::VExpr::prepare( + RETURN_IF_ERROR(VExpr::prepare( _probe_expr_ctxs, state, DataSinkOperatorX::_child->row_desc())); - RETURN_IF_ERROR(vectorized::VExpr::open(_probe_expr_ctxs, state)); + RETURN_IF_ERROR(VExpr::open(_probe_expr_ctxs, state)); return Status::OK(); } @@ -864,14 +864,14 @@ Status AggSinkOperatorX::_calc_aggregate_evaluators() { Status AggSinkOperatorX::_check_agg_fn_output() { if (_needs_finalize) { - RETURN_IF_ERROR(vectorized::AggFnEvaluator::check_agg_fn_output( + RETURN_IF_ERROR(AggFnEvaluator::check_agg_fn_output( cast_set(_probe_expr_ctxs.size()), _aggregate_evaluators, _agg_fn_output_row_descriptor)); } return Status::OK(); } -Status AggSinkOperatorX::sink(doris::RuntimeState* state, vectorized::Block* in_block, bool eos) { +Status AggSinkOperatorX::sink(doris::RuntimeState* state, Block* in_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)in_block->rows()); @@ -914,7 +914,7 @@ Status AggSinkLocalState::close(RuntimeState* state, Status exec_status) { return Status::OK(); } _preagg_block.clear(); - vectorized::PODArray tmp_places; + PODArray tmp_places; _places.swap(tmp_places); std::vector tmp_deserialize_buffer; @@ -922,4 +922,4 @@ Status AggSinkLocalState::close(RuntimeState* state, Status exec_status) { return Base::close(state, exec_status); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/aggregation_sink_operator.h b/be/src/exec/operator/aggregation_sink_operator.h similarity index 80% rename from be/src/pipeline/exec/aggregation_sink_operator.h rename to be/src/exec/operator/aggregation_sink_operator.h index 996daf90149d8f..f90671cb465e2d 100644 --- a/be/src/pipeline/exec/aggregation_sink_operator.h +++ b/be/src/exec/operator/aggregation_sink_operator.h @@ -19,11 +19,11 @@ #include -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" #include "runtime/exec_env.h" -#include "util/runtime_profile.h" +#include "runtime/runtime_profile.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class AggSinkOperatorX; @@ -43,13 +43,13 @@ class AggSinkLocalState : public PipelineXSinkLocalState { friend class AggSinkOperatorX; struct ExecutorBase { - virtual Status execute(AggSinkLocalState* local_state, vectorized::Block* block) = 0; + virtual Status execute(AggSinkLocalState* local_state, Block* block) = 0; virtual void update_memusage(AggSinkLocalState* local_state) = 0; virtual ~ExecutorBase() = default; }; template struct Executor final : public ExecutorBase { - Status execute(AggSinkLocalState* local_state, vectorized::Block* block) override { + Status execute(AggSinkLocalState* local_state, Block* block) override { if constexpr (WithoutKey) { if constexpr (NeedToMerge) { return local_state->_merge_without_key(block); @@ -73,29 +73,29 @@ class AggSinkLocalState : public PipelineXSinkLocalState { } }; - Status _execute_without_key(vectorized::Block* block); - Status _merge_without_key(vectorized::Block* block); + Status _execute_without_key(Block* block); + Status _merge_without_key(Block* block); void _update_memusage_without_key(); - Status _init_hash_method(const vectorized::VExprContextSPtrs& probe_exprs); - Status _execute_with_serialized_key(vectorized::Block* block); - Status _merge_with_serialized_key(vectorized::Block* block); + Status _init_hash_method(const VExprContextSPtrs& probe_exprs); + Status _execute_with_serialized_key(Block* block); + Status _merge_with_serialized_key(Block* block); void _update_memusage_with_serialized_key(); template - Status _execute_with_serialized_key_helper(vectorized::Block* block); - void _find_in_hash_table(vectorized::AggregateDataPtr* places, - vectorized::ColumnRawPtrs& key_columns, uint32_t num_rows); - void _emplace_into_hash_table(vectorized::AggregateDataPtr* places, - vectorized::ColumnRawPtrs& key_columns, uint32_t num_rows); - bool _emplace_into_hash_table_limit(vectorized::AggregateDataPtr* places, - vectorized::Block* block, const std::vector& key_locs, - vectorized::ColumnRawPtrs& key_columns, uint32_t num_rows); + Status _execute_with_serialized_key_helper(Block* block); + void _find_in_hash_table(AggregateDataPtr* places, ColumnRawPtrs& key_columns, + uint32_t num_rows); + void _emplace_into_hash_table(AggregateDataPtr* places, ColumnRawPtrs& key_columns, + uint32_t num_rows); + bool _emplace_into_hash_table_limit(AggregateDataPtr* places, Block* block, + const std::vector& key_locs, + ColumnRawPtrs& key_columns, uint32_t num_rows); size_t _get_hash_table_size() const; template - Status _merge_with_serialized_key_helper(vectorized::Block* block); + Status _merge_with_serialized_key_helper(Block* block); - Status _destroy_agg_status(vectorized::AggregateDataPtr data); - Status _create_agg_status(vectorized::AggregateDataPtr data); + Status _destroy_agg_status(AggregateDataPtr data); + Status _create_agg_status(AggregateDataPtr data); size_t _memory_usage() const; size_t get_reserve_mem_size(RuntimeState* state, bool eos) const; @@ -116,10 +116,10 @@ class AggSinkLocalState : public PipelineXSinkLocalState { bool _should_limit_output = false; - vectorized::PODArray _places; + PODArray _places; std::vector _deserialize_buffer; - vectorized::Block _preagg_block = vectorized::Block(); + Block _preagg_block = Block(); AggregatedDataVariants* _agg_data = nullptr; @@ -150,7 +150,7 @@ class AggSinkOperatorX MOCK_REMOVE(final) : public DataSinkOperatorX _aggregate_evaluators; + std::vector _aggregate_evaluators; // may be we don't have to know the tuple id TupleId _intermediate_tuple_id; @@ -208,12 +208,12 @@ class AggSinkOperatorX MOCK_REMOVE(final) : public DataSinkOperatorX _make_nullable_keys; int64_t _limit; // -1: no limit @@ -228,5 +228,5 @@ class AggSinkOperatorX MOCK_REMOVE(final) : public DataSinkOperatorX #include #include "common/exception.h" -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" +#include "exprs/vectorized_agg_fn.h" +#include "exprs/vexpr_fwd.h" +#include "runtime/runtime_profile.h" #include "runtime/thread_context.h" -#include "util/runtime_profile.h" -#include "vec/exprs/vectorized_agg_fn.h" -#include "vec/exprs/vexpr_fwd.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" AggLocalState::AggLocalState(RuntimeState* state, OperatorXBase* parent) : Base(state, parent) {} @@ -58,24 +58,24 @@ Status AggLocalState::init(RuntimeState* state, LocalStateInfo& info) { auto& p = _parent->template cast(); if (p._without_key) { if (p._needs_finalize) { - _executor.get_result = [this](RuntimeState* state, vectorized::Block* block, + _executor.get_result = [this](RuntimeState* state, Block* block, bool* eos) { return _get_without_key_result(state, block, eos); }; } else { - _executor.get_result = [this](RuntimeState* state, vectorized::Block* block, + _executor.get_result = [this](RuntimeState* state, Block* block, bool* eos) { return _get_results_without_key(state, block, eos); }; } } else { if (p._needs_finalize) { - _executor.get_result = [this](RuntimeState* state, vectorized::Block* block, + _executor.get_result = [this](RuntimeState* state, Block* block, bool* eos) { return _get_with_serialized_key_result(state, block, eos); }; } else { - _executor.get_result = [this](RuntimeState* state, vectorized::Block* block, + _executor.get_result = [this](RuntimeState* state, Block* block, bool* eos) { return _get_results_with_serialized_key(state, block, eos); }; @@ -85,7 +85,7 @@ Status AggLocalState::init(RuntimeState* state, LocalStateInfo& info) { return Status::OK(); } -Status AggLocalState::_create_agg_status(vectorized::AggregateDataPtr data) { +Status AggLocalState::_create_agg_status(AggregateDataPtr data) { auto& shared_state = *Base::_shared_state; for (int i = 0; i < shared_state.aggregate_evaluators.size(); ++i) { try { @@ -103,18 +103,18 @@ Status AggLocalState::_create_agg_status(vectorized::AggregateDataPtr data) { } Status AggLocalState::_get_results_with_serialized_key(RuntimeState* state, - vectorized::Block* block, bool* eos) { + Block* block, bool* eos) { SCOPED_TIMER(_get_results_timer); auto& shared_state = *_shared_state; size_t key_size = _shared_state->probe_expr_ctxs.size(); size_t agg_size = _shared_state->aggregate_evaluators.size(); - vectorized::MutableColumns value_columns(agg_size); - vectorized::DataTypes value_data_types(agg_size); + MutableColumns value_columns(agg_size); + DataTypes value_data_types(agg_size); // non-nullable column(id in `_make_nullable_keys`) will be converted to nullable. bool mem_reuse = shared_state.make_nullable_keys.empty() && block->mem_reuse(); - vectorized::MutableColumns key_columns; + MutableColumns key_columns; for (int i = 0; i < key_size; ++i) { if (mem_reuse) { key_columns.emplace_back(std::move(*block->get_by_position(i).column).mutate()); @@ -125,7 +125,7 @@ Status AggLocalState::_get_results_with_serialized_key(RuntimeState* state, } std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) -> void { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -169,7 +169,7 @@ Status AggLocalState::_get_results_with_serialized_key(RuntimeState* state, key_columns[0]->insert_data(nullptr, 0); shared_state.values[num_rows] = agg_method.hash_table->template get_null_key_data< - vectorized::AggregateDataPtr>(); + AggregateDataPtr>(); ++num_rows; *eos = true; } @@ -205,7 +205,7 @@ Status AggLocalState::_get_results_with_serialized_key(RuntimeState* state, shared_state.agg_data->method_variant); if (!mem_reuse) { - vectorized::ColumnsWithTypeAndName columns_with_schema; + ColumnsWithTypeAndName columns_with_schema; for (int i = 0; i < key_size; ++i) { columns_with_schema.emplace_back(std::move(key_columns[i]), shared_state.probe_expr_ctxs[i]->root()->data_type(), @@ -214,23 +214,23 @@ Status AggLocalState::_get_results_with_serialized_key(RuntimeState* state, for (int i = 0; i < agg_size; ++i) { columns_with_schema.emplace_back(std::move(value_columns[i]), value_data_types[i], ""); } - *block = vectorized::Block(columns_with_schema); + *block = Block(columns_with_schema); } return Status::OK(); } -Status AggLocalState::_get_with_serialized_key_result(RuntimeState* state, vectorized::Block* block, +Status AggLocalState::_get_with_serialized_key_result(RuntimeState* state, Block* block, bool* eos) { auto& shared_state = *_shared_state; // non-nullable column(id in `_make_nullable_keys`) will be converted to nullable. bool mem_reuse = shared_state.make_nullable_keys.empty() && block->mem_reuse(); - auto columns_with_schema = vectorized::VectorizedUtils::create_columns_with_type_and_name( + auto columns_with_schema = VectorizedUtils::create_columns_with_type_and_name( _parent->cast().row_descriptor()); size_t key_size = shared_state.probe_expr_ctxs.size(); - vectorized::MutableColumns key_columns; + MutableColumns key_columns; for (int i = 0; i < key_size; ++i) { if (!mem_reuse) { key_columns.emplace_back(columns_with_schema[i].type->create_column()); @@ -238,7 +238,7 @@ Status AggLocalState::_get_with_serialized_key_result(RuntimeState* state, vecto key_columns.emplace_back(std::move(*block->get_by_position(i).column).mutate()); } } - vectorized::MutableColumns value_columns; + MutableColumns value_columns; for (size_t i = key_size; i < columns_with_schema.size(); ++i) { if (!mem_reuse) { value_columns.emplace_back(columns_with_schema[i].type->create_column()); @@ -249,7 +249,7 @@ Status AggLocalState::_get_with_serialized_key_result(RuntimeState* state, vecto SCOPED_TIMER(_get_results_timer); std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) -> void { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -299,7 +299,7 @@ Status AggLocalState::_get_with_serialized_key_result(RuntimeState* state, vecto if (key_columns[0]->size() < state->batch_size()) { key_columns[0]->insert_data(nullptr, 0); auto mapped = agg_method.hash_table->template get_null_key_data< - vectorized::AggregateDataPtr>(); + AggregateDataPtr>(); for (size_t i = 0; i < shared_state.aggregate_evaluators.size(); ++i) shared_state.aggregate_evaluators[i]->insert_result_info( @@ -317,7 +317,7 @@ Status AggLocalState::_get_with_serialized_key_result(RuntimeState* state, vecto if (!mem_reuse) { *block = columns_with_schema; - vectorized::MutableColumns columns(block->columns()); + MutableColumns columns(block->columns()); for (int i = 0; i < block->columns(); ++i) { if (i < key_size) { columns[i] = std::move(key_columns[i]); @@ -331,7 +331,7 @@ Status AggLocalState::_get_with_serialized_key_result(RuntimeState* state, vecto return Status::OK(); } -Status AggLocalState::_get_results_without_key(RuntimeState* state, vectorized::Block* block, +Status AggLocalState::_get_results_without_key(RuntimeState* state, Block* block, bool* eos) { SCOPED_TIMER(_get_results_timer); auto& shared_state = *_shared_state; @@ -347,8 +347,8 @@ Status AggLocalState::_get_results_without_key(RuntimeState* state, vectorized:: DCHECK(shared_state.agg_data->without_key != nullptr); size_t agg_size = shared_state.aggregate_evaluators.size(); - vectorized::MutableColumns value_columns(agg_size); - std::vector data_types(agg_size); + MutableColumns value_columns(agg_size); + std::vector data_types(agg_size); // will serialize data to string column for (int i = 0; i < shared_state.aggregate_evaluators.size(); ++i) { data_types[i] = shared_state.aggregate_evaluators[i]->function()->get_serialized_type(); @@ -363,12 +363,12 @@ Status AggLocalState::_get_results_without_key(RuntimeState* state, vectorized:: } { - vectorized::ColumnsWithTypeAndName data_with_schema; + ColumnsWithTypeAndName data_with_schema; for (int i = 0; i < shared_state.aggregate_evaluators.size(); ++i) { - vectorized::ColumnWithTypeAndName column_with_schema = {nullptr, data_types[i], ""}; + ColumnWithTypeAndName column_with_schema = {nullptr, data_types[i], ""}; data_with_schema.push_back(std::move(column_with_schema)); } - *block = vectorized::Block(data_with_schema); + *block = Block(data_with_schema); } block->set_columns(std::move(value_columns)); @@ -376,18 +376,18 @@ Status AggLocalState::_get_results_without_key(RuntimeState* state, vectorized:: return Status::OK(); } -Status AggLocalState::_get_without_key_result(RuntimeState* state, vectorized::Block* block, +Status AggLocalState::_get_without_key_result(RuntimeState* state, Block* block, bool* eos) { auto& shared_state = *_shared_state; DCHECK(_shared_state->agg_data->without_key != nullptr); block->clear(); auto& p = _parent->cast(); - *block = vectorized::VectorizedUtils::create_empty_columnswithtypename(p.row_descriptor()); + *block = VectorizedUtils::create_empty_columnswithtypename(p.row_descriptor()); size_t agg_size = shared_state.aggregate_evaluators.size(); - vectorized::MutableColumns columns(agg_size); - std::vector data_types(agg_size); + MutableColumns columns(agg_size); + std::vector data_types(agg_size); for (int i = 0; i < shared_state.aggregate_evaluators.size(); ++i) { data_types[i] = shared_state.aggregate_evaluators[i]->function()->get_return_type(); columns[i] = data_types[i]->create_column(); @@ -421,7 +421,7 @@ Status AggLocalState::_get_without_key_result(RuntimeState* state, vectorized::B // 2. input of aggregate function is empty // 3. all of input columns are not nullable if (column_type->is_nullable() && !data_types[i]->is_nullable()) { - vectorized::ColumnPtr ptr = std::move(columns[i]); + ColumnPtr ptr = std::move(columns[i]); // unless `count`, other aggregate function dispose empty set should be null // so here check the children row return ptr = make_nullable(ptr, shared_state.input_num_rows == 0); @@ -441,7 +441,7 @@ AggSourceOperatorX::AggSourceOperatorX(ObjectPool* pool, const TPlanNode& tnode, _needs_finalize(tnode.agg_node.need_finalize), _without_key(tnode.agg_node.grouping_exprs.empty()) {} -Status AggSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* block, bool* eos) { +Status AggSourceOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); SCOPED_PEAK_MEM(&local_state._estimate_memory_usage); @@ -453,10 +453,10 @@ Status AggSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* blo return Status::OK(); } -void AggLocalState::do_agg_limit(vectorized::Block* block, bool* eos) { +void AggLocalState::do_agg_limit(Block* block, bool* eos) { if (_shared_state->reach_limit) { if (_shared_state->do_sort_limit && _shared_state->do_limit_filter(block, block->rows())) { - vectorized::Block::filter_block_internal(block, _shared_state->need_computes); + Block::filter_block_internal(block, _shared_state->need_computes); if (auto rows = block->rows()) { _num_rows_returned += rows; } @@ -470,7 +470,7 @@ void AggLocalState::do_agg_limit(vectorized::Block* block, bool* eos) { } } -void AggLocalState::make_nullable_output_key(vectorized::Block* block) { +void AggLocalState::make_nullable_output_key(Block* block) { if (block->rows() != 0) { for (auto cid : _shared_state->make_nullable_keys) { block->get_by_position(cid).column = make_nullable(block->get_by_position(cid).column); @@ -479,12 +479,12 @@ void AggLocalState::make_nullable_output_key(vectorized::Block* block) { } } -Status AggLocalState::merge_with_serialized_key_helper(vectorized::Block* block) { +Status AggLocalState::merge_with_serialized_key_helper(Block* block) { SCOPED_TIMER(_merge_timer); SCOPED_PEAK_MEM(&_estimate_memory_usage); size_t key_size = Base::_shared_state->probe_expr_ctxs.size(); - vectorized::ColumnRawPtrs key_columns(key_size); + ColumnRawPtrs key_columns(key_size); for (size_t i = 0; i < key_size; ++i) { key_columns[i] = block->get_by_position(i).column.get(); @@ -520,7 +520,7 @@ Status AggLocalState::merge_with_serialized_key_helper(vectorized::Block* block) } Status AggSourceOperatorX::merge_with_serialized_key_helper(RuntimeState* state, - vectorized::Block* block) { + Block* block) { auto& local_state = get_local_state(state); return local_state.merge_with_serialized_key_helper(block); } @@ -529,7 +529,7 @@ size_t AggSourceOperatorX::get_estimated_memory_size_for_merging(RuntimeState* s size_t rows) const { auto& local_state = get_local_state(state); size_t size = std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) -> size_t { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); return 0; @@ -548,11 +548,11 @@ Status AggSourceOperatorX::reset_hash_table(RuntimeState* state) { return Status::OK(); } -void AggLocalState::_emplace_into_hash_table(vectorized::AggregateDataPtr* places, - vectorized::ColumnRawPtrs& key_columns, +void AggLocalState::_emplace_into_hash_table(AggregateDataPtr* places, + ColumnRawPtrs& key_columns, uint32_t num_rows) { std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) -> void { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -587,7 +587,7 @@ void AggLocalState::_emplace_into_hash_table(vectorized::AggregateDataPtr* place }; SCOPED_TIMER(_hash_table_emplace_timer); - vectorized::lazy_emplace_batch( + lazy_emplace_batch( agg_method, state, num_rows, creator, creator_for_null_key, [&](uint32_t row, auto& mapped) { places[row] = mapped; }); @@ -615,7 +615,7 @@ Status AggLocalState::close(RuntimeState* state) { return Status::OK(); } - vectorized::PODArray tmp_places; + PODArray tmp_places; _places.swap(tmp_places); std::vector tmp_deserialize_buffer; @@ -623,4 +623,4 @@ Status AggLocalState::close(RuntimeState* state) { return Base::close(state); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/aggregation_source_operator.h b/be/src/exec/operator/aggregation_source_operator.h similarity index 77% rename from be/src/pipeline/exec/aggregation_source_operator.h rename to be/src/exec/operator/aggregation_source_operator.h index 9273be7caed389..e2306a2a081f47 100644 --- a/be/src/pipeline/exec/aggregation_source_operator.h +++ b/be/src/exec/operator/aggregation_source_operator.h @@ -20,12 +20,11 @@ #include "common/be_mock_util.h" #include "common/status.h" -#include "operator.h" +#include "exec/operator/operator.h" namespace doris { class RuntimeState; -namespace pipeline { #include "common/compile_check_begin.h" class AggSourceOperatorX; @@ -39,21 +38,19 @@ class AggLocalState MOCK_REMOVE(final) : public PipelineXLocalStaterows() != 0) { auto& shared_state = *Base ::_shared_state; for (auto cid : shared_state.make_nullable_keys) { @@ -64,10 +61,10 @@ class AggLocalState MOCK_REMOVE(final) : public PipelineXLocalState _places; + PODArray _places; std::vector _deserialize_buffer; RuntimeProfile::Counter* _get_results_timer = nullptr; @@ -86,7 +83,7 @@ class AggLocalState MOCK_REMOVE(final) : public PipelineXLocalState; + std::function; struct executor { vectorized_get_result get_result; @@ -106,11 +103,11 @@ class AggSourceOperatorX : public OperatorX { AggSourceOperatorX() = default; #endif - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override; + Status get_block(RuntimeState* state, Block* block, bool* eos) override; bool is_source() const override { return true; } - Status merge_with_serialized_key_helper(RuntimeState* state, vectorized::Block* block); + Status merge_with_serialized_key_helper(RuntimeState* state, Block* block); size_t get_estimated_memory_size_for_merging(RuntimeState* state, size_t rows) const; @@ -127,6 +124,5 @@ class AggSourceOperatorX : public OperatorX { std::vector _make_nullable_keys; }; -} // namespace pipeline } // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/pipeline/exec/analytic_sink_operator.cpp b/be/src/exec/operator/analytic_sink_operator.cpp similarity index 92% rename from be/src/pipeline/exec/analytic_sink_operator.cpp rename to be/src/exec/operator/analytic_sink_operator.cpp index 6bf24b1daf65b3..db5ac2ecd37e15 100644 --- a/be/src/pipeline/exec/analytic_sink_operator.cpp +++ b/be/src/exec/operator/analytic_sink_operator.cpp @@ -16,7 +16,7 @@ // specific language governing permissions and limitations // under the License. -#include "analytic_sink_operator.h" +#include "exec/operator/analytic_sink_operator.h" #include @@ -24,11 +24,11 @@ #include #include -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" +#include "exprs/vectorized_agg_fn.h" #include "runtime/runtime_state.h" -#include "vec/exprs/vectorized_agg_fn.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" Status AnalyticSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& info) { @@ -363,7 +363,7 @@ Status AnalyticSinkLocalState::_execute_impl() { } if (should_output) { - vectorized::Block block; + Block block; _output_current_block(&block); _refresh_buffer_and_dependency_state(&block); } @@ -380,7 +380,7 @@ void AnalyticSinkLocalState::_execute_for_function(int64_t partition_start, int6 int64_t frame_start, int64_t frame_end) { // here is the core function, should not add timer for (size_t i = 0; i < _agg_functions_size; ++i) { - std::vector agg_columns; + std::vector agg_columns; for (int j = 0; j < _agg_input_columns[i].size(); ++j) { agg_columns.push_back(_agg_input_columns[i][j].get()); } @@ -407,8 +407,7 @@ void AnalyticSinkLocalState::_insert_result_info(int64_t start, int64_t end) { if (_use_null_result[i]) { _result_window_columns[i]->insert_many_defaults(end - start); } else { - auto* dst = - assert_cast(_result_window_columns[i].get()); + auto* dst = assert_cast(_result_window_columns[i].get()); dst->get_null_map_data().resize_fill( dst->get_null_map_data().size() + static_cast(end - start), 0); _agg_functions[i]->function()->insert_result_into_range( @@ -423,7 +422,7 @@ void AnalyticSinkLocalState::_insert_result_info(int64_t start, int64_t end) { } } -void AnalyticSinkLocalState::_output_current_block(vectorized::Block* block) { +void AnalyticSinkLocalState::_output_current_block(Block* block) { block->swap(std::move(_input_blocks[_output_block_index])); _blocks_memory_usage->add(-block->allocated_bytes()); DCHECK(_parent->cast()._change_to_nullable_flags.size() == @@ -459,7 +458,7 @@ void AnalyticSinkLocalState::_init_result_columns() { } } -void AnalyticSinkLocalState::_refresh_buffer_and_dependency_state(vectorized::Block* block) { +void AnalyticSinkLocalState::_refresh_buffer_and_dependency_state(Block* block) { size_t buffer_size = 0; { std::unique_lock lc(_shared_state->buffer_mutex); @@ -614,9 +613,9 @@ void AnalyticSinkLocalState::_find_next_order_by_ends() { } // Compares (*this)[n] and rhs[m] -int64_t AnalyticSinkLocalState::find_first_not_equal(vectorized::IColumn* reference_column, - vectorized::IColumn* compared_column, - int64_t target, int64_t start, int64_t end) { +int64_t AnalyticSinkLocalState::find_first_not_equal(IColumn* reference_column, + IColumn* compared_column, int64_t target, + int64_t start, int64_t end) { while (start + 1 < end) { int64_t mid = start + (end - start) / 2; if (reference_column->compare_at(target, mid, *compared_column, 1) == 0) { @@ -655,39 +654,37 @@ Status AnalyticSinkOperatorX::init(const TPlanNode& tnode, RuntimeState* state) _num_agg_input.resize(_agg_functions_size); for (int i = 0; i < _agg_functions_size; ++i) { const TExpr& desc = analytic_node.analytic_functions[i]; - vectorized::AggFnEvaluator* evaluator = nullptr; + AggFnEvaluator* evaluator = nullptr; // Window function treats all NullableAggregateFunction as AlwaysNullable. // Its behavior is same with executed without group by key. // https://github.com/apache/doris/pull/40693 - RETURN_IF_ERROR(vectorized::AggFnEvaluator::create(_pool, desc, {}, /*without_key*/ true, - true, &evaluator)); + RETURN_IF_ERROR( + AggFnEvaluator::create(_pool, desc, {}, /*without_key*/ true, true, &evaluator)); _agg_functions.emplace_back(evaluator); int node_idx = 0; _num_agg_input[i] = desc.nodes[0].num_children; for (int j = 0; j < desc.nodes[0].num_children; ++j) { ++node_idx; - vectorized::VExprSPtr expr; - vectorized::VExprContextSPtr ctx; - RETURN_IF_ERROR( - vectorized::VExpr::create_tree_from_thrift(desc.nodes, &node_idx, expr, ctx)); + VExprSPtr expr; + VExprContextSPtr ctx; + RETURN_IF_ERROR(VExpr::create_tree_from_thrift(desc.nodes, &node_idx, expr, ctx)); _agg_expr_ctxs[i].emplace_back(ctx); } } - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(analytic_node.partition_exprs, - _partition_by_eq_expr_ctxs)); - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(analytic_node.order_by_exprs, - _order_by_eq_expr_ctxs)); - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(analytic_node.range_between_offset_exprs, - _range_between_expr_ctxs)); + RETURN_IF_ERROR( + VExpr::create_expr_trees(analytic_node.partition_exprs, _partition_by_eq_expr_ctxs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(analytic_node.order_by_exprs, _order_by_eq_expr_ctxs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(analytic_node.range_between_offset_exprs, + _range_between_expr_ctxs)); return Status::OK(); } Status AnalyticSinkOperatorX::prepare(RuntimeState* state) { RETURN_IF_ERROR(DataSinkOperatorX::prepare(state)); for (const auto& ctx : _agg_expr_ctxs) { - RETURN_IF_ERROR(vectorized::VExpr::prepare(ctx, state, _child->row_desc())); + RETURN_IF_ERROR(VExpr::prepare(ctx, state, _child->row_desc())); } _intermediate_tuple_desc = state->desc_tbl().get_tuple_descriptor(_intermediate_tuple_id); _output_tuple_desc = state->desc_tbl().get_tuple_descriptor(_output_tuple_id); @@ -707,25 +704,22 @@ Status AnalyticSinkOperatorX::prepare(RuntimeState* state) { tuple_ids.push_back(_buffered_tuple_id); RowDescriptor cmp_row_desc(state->desc_tbl(), tuple_ids, std::vector(2, false)); if (!_partition_by_eq_expr_ctxs.empty()) { - RETURN_IF_ERROR( - vectorized::VExpr::prepare(_partition_by_eq_expr_ctxs, state, cmp_row_desc)); + RETURN_IF_ERROR(VExpr::prepare(_partition_by_eq_expr_ctxs, state, cmp_row_desc)); } if (!_order_by_eq_expr_ctxs.empty()) { - RETURN_IF_ERROR( - vectorized::VExpr::prepare(_order_by_eq_expr_ctxs, state, cmp_row_desc)); + RETURN_IF_ERROR(VExpr::prepare(_order_by_eq_expr_ctxs, state, cmp_row_desc)); } } if (!_range_between_expr_ctxs.empty()) { DCHECK(_range_between_expr_ctxs.size() == 2); - RETURN_IF_ERROR( - vectorized::VExpr::prepare(_range_between_expr_ctxs, state, _child->row_desc())); + RETURN_IF_ERROR(VExpr::prepare(_range_between_expr_ctxs, state, _child->row_desc())); } - RETURN_IF_ERROR(vectorized::VExpr::open(_range_between_expr_ctxs, state)); - RETURN_IF_ERROR(vectorized::VExpr::open(_partition_by_eq_expr_ctxs, state)); - RETURN_IF_ERROR(vectorized::VExpr::open(_order_by_eq_expr_ctxs, state)); + RETURN_IF_ERROR(VExpr::open(_range_between_expr_ctxs, state)); + RETURN_IF_ERROR(VExpr::open(_partition_by_eq_expr_ctxs, state)); + RETURN_IF_ERROR(VExpr::open(_order_by_eq_expr_ctxs, state)); for (size_t i = 0; i < _agg_functions_size; ++i) { RETURN_IF_ERROR(_agg_functions[i]->open(state)); - RETURN_IF_ERROR(vectorized::VExpr::open(_agg_expr_ctxs[i], state)); + RETURN_IF_ERROR(VExpr::open(_agg_expr_ctxs[i], state)); } _offsets_of_aggregate_states.resize(_agg_functions_size); @@ -751,8 +745,7 @@ Status AnalyticSinkOperatorX::prepare(RuntimeState* state) { return Status::OK(); } -Status AnalyticSinkOperatorX::sink(doris::RuntimeState* state, vectorized::Block* input_block, - bool eos) { +Status AnalyticSinkOperatorX::sink(doris::RuntimeState* state, Block* input_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)input_block->rows()); @@ -770,8 +763,7 @@ Status AnalyticSinkOperatorX::sink(doris::RuntimeState* state, vectorized::Block return Status::OK(); } -Status AnalyticSinkOperatorX::_add_input_block(doris::RuntimeState* state, - vectorized::Block* input_block) { +Status AnalyticSinkOperatorX::_add_input_block(doris::RuntimeState* state, Block* input_block) { if (input_block->rows() <= 0) { return Status::OK(); } @@ -817,7 +809,7 @@ Status AnalyticSinkOperatorX::_add_input_block(doris::RuntimeState* state, local_state._range_result_columns[i].get(), block_rows)); } } - vectorized::Block::erase_useless_column(input_block, column_to_keep); + Block::erase_useless_column(input_block, column_to_keep); COUNTER_UPDATE(local_state._memory_used_counter, input_block->allocated_bytes()); COUNTER_UPDATE(local_state._blocks_memory_usage, input_block->allocated_bytes()); local_state._input_blocks.emplace_back(std::move(*input_block)); @@ -894,10 +886,9 @@ size_t AnalyticSinkOperatorX::get_reserve_mem_size(RuntimeState* state, bool eos return local_state._reserve_mem_size; } -Status AnalyticSinkOperatorX::_insert_range_column(vectorized::Block* block, - const vectorized::VExprContextSPtr& expr, - vectorized::IColumn* dst_column, size_t length) { - vectorized::ColumnPtr column; +Status AnalyticSinkOperatorX::_insert_range_column(Block* block, const VExprContextSPtr& expr, + IColumn* dst_column, size_t length) { + ColumnPtr column; RETURN_IF_ERROR(expr->execute(block, column)); column = column->convert_to_full_column_if_const(); // iff dst_column is string, maybe overflow of 4G, so need ignore overflow @@ -939,4 +930,4 @@ void AnalyticSinkLocalState::_destroy_agg_status() { template class DataSinkOperatorX; -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/analytic_sink_operator.h b/be/src/exec/operator/analytic_sink_operator.h similarity index 83% rename from be/src/pipeline/exec/analytic_sink_operator.h rename to be/src/exec/operator/analytic_sink_operator.h index c4168a33c4acb2..7b6975e5e68331 100644 --- a/be/src/pipeline/exec/analytic_sink_operator.h +++ b/be/src/exec/operator/analytic_sink_operator.h @@ -20,12 +20,11 @@ #include -#include "operator.h" -#include "pipeline/dependency.h" +#include "exec/operator/operator.h" +#include "exec/pipeline/dependency.h" namespace doris { #include "common/compile_check_begin.h" -namespace pipeline { class AnalyticSinkOperatorX; struct BoundaryPose { @@ -96,9 +95,9 @@ class AnalyticSinkLocalState : public PipelineXSinkLocalState _agg_expr_ctxs; - vectorized::VExprContextSPtrs _partition_by_eq_expr_ctxs; - vectorized::VExprContextSPtrs _order_by_eq_expr_ctxs; - vectorized::VExprContextSPtrs _range_between_expr_ctxs; - std::vector> _agg_input_columns; - std::vector _partition_by_columns; - std::vector _order_by_columns; - std::vector _range_result_columns; + int64_t find_first_not_equal(IColumn* reference_column, IColumn* compared_column, + int64_t target, int64_t start, int64_t end); + + std::vector _agg_expr_ctxs; + VExprContextSPtrs _partition_by_eq_expr_ctxs; + VExprContextSPtrs _order_by_eq_expr_ctxs; + VExprContextSPtrs _range_between_expr_ctxs; + std::vector> _agg_input_columns; + std::vector _partition_by_columns; + std::vector _order_by_columns; + std::vector _range_result_columns; size_t _partition_exprs_size = 0; size_t _order_by_exprs_size = 0; BoundaryPose _partition_by_pose; @@ -132,8 +130,8 @@ class AnalyticSinkLocalState : public PipelineXSinkLocalState _agg_functions; + AggregateDataPtr _fn_place_ptr = nullptr; + std::vector _agg_functions; std::vector _offsets_of_aggregate_states; std::vector _result_column_nullable_flags; std::vector _result_column_could_resize; @@ -151,13 +149,13 @@ class AnalyticSinkLocalState : public PipelineXSinkLocalState _result_window_columns; + std::vector _result_window_columns; int64_t _rows_start_offset = 0; int64_t _rows_end_offset = 0; int64_t _input_total_rows = 0; bool _input_eos = false; - std::vector _input_blocks; + std::vector _input_blocks; std::vector _input_block_first_row_positions; int64_t _removed_block_index = 0; int64_t _have_removed_rows = 0; @@ -212,7 +210,7 @@ class AnalyticSinkOperatorX final : public DataSinkOperatorX _agg_expr_ctxs; - vectorized::VExprContextSPtrs _partition_by_eq_expr_ctxs; - vectorized::VExprContextSPtrs _order_by_eq_expr_ctxs; - vectorized::VExprContextSPtrs _range_between_expr_ctxs; + std::vector _agg_expr_ctxs; + VExprContextSPtrs _partition_by_eq_expr_ctxs; + VExprContextSPtrs _order_by_eq_expr_ctxs; + VExprContextSPtrs _range_between_expr_ctxs; size_t _agg_functions_size = 0; std::vector _num_agg_input; - std::vector _agg_functions; + std::vector _agg_functions; TupleId _intermediate_tuple_id; TupleId _output_tuple_id; @@ -268,6 +266,5 @@ class AnalyticSinkOperatorX final : public DataSinkOperatorX _change_to_nullable_flags; }; -} // namespace pipeline } // namespace doris #include "common/compile_check_end.h" \ No newline at end of file diff --git a/be/src/pipeline/exec/analytic_source_operator.cpp b/be/src/exec/operator/analytic_source_operator.cpp similarity index 91% rename from be/src/pipeline/exec/analytic_source_operator.cpp rename to be/src/exec/operator/analytic_source_operator.cpp index 5170711acc3220..de385e3dedee24 100644 --- a/be/src/pipeline/exec/analytic_source_operator.cpp +++ b/be/src/exec/operator/analytic_source_operator.cpp @@ -15,16 +15,16 @@ // specific language governing permissions and limitations // under the License. -#include "analytic_source_operator.h" +#include "exec/operator/analytic_source_operator.h" #include #include -#include "pipeline/exec/operator.h" -#include "vec/columns/column_nullable.h" -#include "vec/exprs/vectorized_agg_fn.h" +#include "core/column/column_nullable.h" +#include "exec/operator/operator.h" +#include "exprs/vectorized_agg_fn.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" AnalyticLocalState::AnalyticLocalState(RuntimeState* state, OperatorXBase* parent) @@ -43,8 +43,7 @@ AnalyticSourceOperatorX::AnalyticSourceOperatorX(ObjectPool* pool, const TPlanNo int operator_id, const DescriptorTbl& descs) : OperatorX(pool, tnode, operator_id, descs) {} -Status AnalyticSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* output_block, - bool* eos) { +Status AnalyticSourceOperatorX::get_block(RuntimeState* state, Block* output_block, bool* eos) { RETURN_IF_CANCELLED(state); auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); @@ -92,4 +91,4 @@ Status AnalyticSourceOperatorX::prepare(RuntimeState* state) { return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/analytic_source_operator.h b/be/src/exec/operator/analytic_source_operator.h similarity index 92% rename from be/src/pipeline/exec/analytic_source_operator.h rename to be/src/exec/operator/analytic_source_operator.h index f59545fbf66da0..e4d9cb2c2b69d0 100644 --- a/be/src/pipeline/exec/analytic_source_operator.h +++ b/be/src/exec/operator/analytic_source_operator.h @@ -20,12 +20,11 @@ #include #include "common/status.h" -#include "operator.h" +#include "exec/operator/operator.h" namespace doris { class RuntimeState; -namespace pipeline { #include "common/compile_check_begin.h" class AnalyticSourceOperatorX; @@ -49,7 +48,7 @@ class AnalyticSourceOperatorX final : public OperatorX { #ifdef BE_TEST AnalyticSourceOperatorX() = default; #endif - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override; + Status get_block(RuntimeState* state, Block* block, bool* eos) override; bool is_source() const override { return true; } @@ -59,6 +58,5 @@ class AnalyticSourceOperatorX final : public OperatorX { friend class AnalyticLocalState; }; -} // namespace pipeline } // namespace doris #include "common/compile_check_end.h" \ No newline at end of file diff --git a/be/src/pipeline/exec/assert_num_rows_operator.cpp b/be/src/exec/operator/assert_num_rows_operator.cpp similarity index 89% rename from be/src/pipeline/exec/assert_num_rows_operator.cpp rename to be/src/exec/operator/assert_num_rows_operator.cpp index 47a97e0af649bf..c8097a1800ce43 100644 --- a/be/src/pipeline/exec/assert_num_rows_operator.cpp +++ b/be/src/exec/operator/assert_num_rows_operator.cpp @@ -15,12 +15,12 @@ // specific language governing permissions and limitations // under the License. -#include "assert_num_rows_operator.h" +#include "exec/operator/assert_num_rows_operator.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/utils/util.hpp" +#include "exec/common/util.hpp" +#include "exprs/vexpr_context.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" AssertNumRowsOperatorX::AssertNumRowsOperatorX(ObjectPool* pool, const TPlanNode& tnode, int operator_id, const DescriptorTbl& descs) @@ -38,8 +38,7 @@ AssertNumRowsOperatorX::AssertNumRowsOperatorX(ObjectPool* pool, const TPlanNode tnode.assert_num_rows_node.should_convert_output_to_nullable; } -Status AssertNumRowsOperatorX::pull(doris::RuntimeState* state, vectorized::Block* block, - bool* eos) { +Status AssertNumRowsOperatorX::pull(doris::RuntimeState* state, Block* block, bool* eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); SCOPED_PEAK_MEM(&local_state.estimate_memory_usage()); @@ -81,18 +80,17 @@ Status AssertNumRowsOperatorX::pull(doris::RuntimeState* state, vectorized::Bloc if (block->rows() > 0) { for (size_t i = 0; i != block->columns(); ++i) { auto& data = block->get_by_position(i); - data.type = vectorized::make_nullable(data.type); - data.column = vectorized::make_nullable(data.column); + data.type = make_nullable(data.type); + data.column = make_nullable(data.column); } } else if (!has_more_rows && _assertion == TAssertion::EQ && num_rows_returned == 0 && _desired_num_rows == 1) { - auto new_block = - vectorized::VectorizedUtils::create_columns_with_type_and_name(_row_descriptor); + auto new_block = VectorizedUtils::create_columns_with_type_and_name(_row_descriptor); block->swap(new_block); for (size_t i = 0; i != block->columns(); ++i) { auto& column = block->get_by_position(i).column; auto& type = block->get_by_position(i).type; - type = vectorized::make_nullable(type); + type = make_nullable(type); column = type->create_column(); column->assume_mutable()->insert_default(); } @@ -124,4 +122,4 @@ Status AssertNumRowsOperatorX::pull(doris::RuntimeState* state, vectorized::Bloc return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/assert_num_rows_operator.h b/be/src/exec/operator/assert_num_rows_operator.h similarity index 92% rename from be/src/pipeline/exec/assert_num_rows_operator.h rename to be/src/exec/operator/assert_num_rows_operator.h index c9a56c58004678..2639dae29d19ba 100644 --- a/be/src/pipeline/exec/assert_num_rows_operator.h +++ b/be/src/exec/operator/assert_num_rows_operator.h @@ -17,9 +17,9 @@ #pragma once -#include "operator.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class AssertNumRowsLocalState final : public PipelineXLocalState { @@ -43,7 +43,7 @@ class AssertNumRowsOperatorX final : public StreamingOperatorX #include @@ -24,14 +24,13 @@ #include "common/logging.h" #include "common/status.h" -#include "pipeline/dependency.h" +#include "core/block/block.h" +#include "exec/pipeline/dependency.h" #include "runtime/exec_env.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" -#include "util/runtime_profile.h" -#include "vec/core/block.h" namespace doris { -namespace pipeline { BlackholeSinkOperatorX::BlackholeSinkOperatorX(int operator_id) : Base(operator_id, 0, 0) {} @@ -45,7 +44,7 @@ Status BlackholeSinkOperatorX::init(const TDataSink& tsink) { return Status::OK(); } -Status BlackholeSinkOperatorX::sink(RuntimeState* state, vectorized::Block* block, bool eos) { +Status BlackholeSinkOperatorX::sink(RuntimeState* state, Block* block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)block->rows()); @@ -57,7 +56,7 @@ Status BlackholeSinkOperatorX::sink(RuntimeState* state, vectorized::Block* bloc return Status::OK(); } -Status BlackholeSinkOperatorX::_process_block(RuntimeState* state, vectorized::Block* block) { +Status BlackholeSinkOperatorX::_process_block(RuntimeState* state, Block* block) { auto& local_state = get_local_state(state); // Update metrics - count rows and bytes processed @@ -108,5 +107,4 @@ Status BlackholeSinkOperatorX::close(RuntimeState* state) { return Status::OK(); } -} // namespace pipeline } // namespace doris diff --git a/be/src/pipeline/exec/blackhole_sink_operator.h b/be/src/exec/operator/blackhole_sink_operator.h similarity index 89% rename from be/src/pipeline/exec/blackhole_sink_operator.h rename to be/src/exec/operator/blackhole_sink_operator.h index 1acf6074d3e2f8..23a2e9953063b0 100644 --- a/be/src/pipeline/exec/blackhole_sink_operator.h +++ b/be/src/exec/operator/blackhole_sink_operator.h @@ -23,18 +23,14 @@ #include -#include "operator.h" -#include "vec/core/block.h" +#include "core/block/block.h" +#include "exec/operator/operator.h" namespace doris { class TDataSink; -namespace vectorized { class Block; -} - -namespace pipeline { // Forward declaration class BlackholeSinkOperatorX; @@ -72,7 +68,7 @@ class BlackholeSinkOperatorX final : public DataSinkOperatorX #include "common/compiler_util.h" // IWYU pragma: keep #include "common/status.h" -#include "pipeline/exec/data_queue.h" -#include "pipeline/exec/operator.h" +#include "exec/operator/data_queue.h" +#include "exec/operator/operator.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" -#include "util/runtime_profile.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" Status CacheSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& info) { RETURN_IF_ERROR(Base::init(state, info)); @@ -50,14 +50,14 @@ CacheSinkOperatorX::CacheSinkOperatorX(int sink_id, int child_id, int dest_id) _name = "CACHE_SINK_OPERATOR"; } -Status CacheSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block, bool eos) { +Status CacheSinkOperatorX::sink(RuntimeState* state, Block* in_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)in_block->rows()); if (in_block->rows() > 0) { RETURN_IF_ERROR(local_state._shared_state->data_queue.push_block( - vectorized::Block::create_unique(std::move(*in_block)), 0)); + Block::create_unique(std::move(*in_block)), 0)); } if (UNLIKELY(eos)) { local_state._shared_state->data_queue.set_finish(0); @@ -65,4 +65,4 @@ Status CacheSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/cache_sink_operator.h b/be/src/exec/operator/cache_sink_operator.h similarity index 93% rename from be/src/pipeline/exec/cache_sink_operator.h rename to be/src/exec/operator/cache_sink_operator.h index 117e5864e78f52..084cc5249137c3 100644 --- a/be/src/pipeline/exec/cache_sink_operator.h +++ b/be/src/exec/operator/cache_sink_operator.h @@ -22,14 +22,13 @@ #include #include "common/status.h" -#include "operator.h" -#include "vec/core/block.h" +#include "core/block/block.h" +#include "exec/operator/operator.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace pipeline { class DataQueue; class CacheSinkOperatorX; @@ -59,7 +58,7 @@ class CacheSinkOperatorX final : public DataSinkOperatorX { DataSinkOperatorX::_name); } - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos) override; + Status sink(RuntimeState* state, Block* in_block, bool eos) override; std::shared_ptr create_shared_state() const override { std::shared_ptr ss = std::make_shared(); @@ -71,6 +70,5 @@ class CacheSinkOperatorX final : public DataSinkOperatorX { } }; -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/exec/cache_source_operator.cpp b/be/src/exec/operator/cache_source_operator.cpp similarity index 93% rename from be/src/pipeline/exec/cache_source_operator.cpp rename to be/src/exec/operator/cache_source_operator.cpp index 3adb97d969f05d..91d48d77470ec6 100644 --- a/be/src/pipeline/exec/cache_source_operator.cpp +++ b/be/src/exec/operator/cache_source_operator.cpp @@ -15,20 +15,19 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/exec/cache_source_operator.h" +#include "exec/operator/cache_source_operator.h" #include #include #include "common/status.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/operator.h" -#include "vec/core/block.h" +#include "core/block/block.h" +#include "exec/operator/operator.h" +#include "exec/pipeline/dependency.h" namespace doris { class RuntimeState; -namespace pipeline { #include "common/compile_check_begin.h" Status CacheSourceLocalState::init(RuntimeState* state, LocalStateInfo& info) { RETURN_IF_ERROR(Base::init(state, info)); @@ -118,7 +117,7 @@ std::string CacheSourceLocalState::debug_string(int indentation_level) const { return fmt::to_string(debug_string_buffer); } -Status CacheSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* block, bool* eos) { +Status CacheSourceOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); @@ -140,7 +139,7 @@ Status CacheSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* b } }); - std::unique_ptr output_block; + std::unique_ptr output_block; int child_idx = 0; RETURN_IF_ERROR(local_state._shared_state->data_queue.get_block_from_queue(&output_block, &child_idx)); @@ -156,8 +155,7 @@ Status CacheSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* b if (need_clone_empty) { *block = output_block->clone_empty(); } - RETURN_IF_ERROR( - vectorized::MutableBlock::build_mutable_block(block).merge(*output_block)); + RETURN_IF_ERROR(MutableBlock::build_mutable_block(block).merge(*output_block)); local_state._current_query_cache_rows += output_block->rows(); auto mem_consume = output_block->allocated_bytes(); local_state._current_query_cache_bytes += mem_consume; @@ -180,8 +178,7 @@ Status CacheSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* b if (need_clone_empty) { *block = hit_cache_block->clone_empty(); } - RETURN_IF_ERROR( - vectorized::MutableBlock::build_mutable_block(block).merge(*hit_cache_block)); + RETURN_IF_ERROR(MutableBlock::build_mutable_block(block).merge(*hit_cache_block)); if (!local_state._hit_cache_column_orders.empty()) { auto datas = block->get_columns_with_type_and_name(); block->clear(); @@ -198,5 +195,4 @@ Status CacheSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* b return Status::OK(); } -} // namespace pipeline } // namespace doris diff --git a/be/src/pipeline/exec/cache_source_operator.h b/be/src/exec/operator/cache_source_operator.h similarity index 89% rename from be/src/pipeline/exec/cache_source_operator.h rename to be/src/exec/operator/cache_source_operator.h index 49f0c376c47cbe..dca13774cf405b 100644 --- a/be/src/pipeline/exec/cache_source_operator.h +++ b/be/src/exec/operator/cache_source_operator.h @@ -21,18 +21,15 @@ #include #include "common/status.h" -#include "operator.h" -#include "pipeline/query_cache/query_cache.h" +#include "exec/operator/operator.h" +#include "runtime/query_cache/query_cache.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace vectorized { class Block; -} // namespace vectorized -namespace pipeline { class DataQueue; class CacheSourceOperatorX; @@ -56,14 +53,14 @@ class CacheSourceLocalState final : public PipelineXLocalState _local_cache_blocks; + std::vector _local_cache_blocks; std::vector _slot_orders; size_t _current_query_cache_bytes = 0; size_t _current_query_cache_rows = 0; bool _need_insert_cache = true; QueryCacheHandle _query_cache_handle; - std::vector* _hit_cache_results = nullptr; + std::vector* _hit_cache_results = nullptr; std::vector _hit_cache_column_orders; int _hit_cache_pos = 0; }; @@ -82,7 +79,7 @@ class CacheSourceOperatorX final : public OperatorX { #endif ~CacheSourceOperatorX() override = default; - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override; + Status get_block(RuntimeState* state, Block* block, bool* eos) override; bool is_source() const override { return true; } @@ -101,6 +98,5 @@ class CacheSourceOperatorX final : public OperatorX { friend class CacheSourceLocalState; }; -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/pipeline/exec/data_queue.cpp b/be/src/exec/operator/data_queue.cpp similarity index 91% rename from be/src/pipeline/exec/data_queue.cpp rename to be/src/exec/operator/data_queue.cpp index 155988582b2ee6..84ba08f309f983 100644 --- a/be/src/pipeline/exec/data_queue.cpp +++ b/be/src/exec/operator/data_queue.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "data_queue.h" +#include "exec/operator/data_queue.h" #include @@ -23,11 +23,10 @@ #include #include -#include "pipeline/dependency.h" -#include "vec/core/block.h" +#include "core/block/block.h" +#include "exec/pipeline/dependency.h" namespace doris { -namespace pipeline { #include "common/compile_check_begin.h" DataQueue::DataQueue(int child_count) : _queue_blocks_lock(child_count), @@ -52,7 +51,7 @@ DataQueue::DataQueue(int child_count) _sink_dependencies.resize(child_count, nullptr); } -std::unique_ptr DataQueue::get_free_block(int child_idx) { +std::unique_ptr DataQueue::get_free_block(int child_idx) { { INJECT_MOCK_SLEEP(std::lock_guard l(*_free_blocks_lock[child_idx])); if (!_free_blocks[child_idx].empty()) { @@ -62,10 +61,10 @@ std::unique_ptr DataQueue::get_free_block(int child_idx) { } } - return vectorized::Block::create_unique(); + return Block::create_unique(); } -void DataQueue::push_free_block(std::unique_ptr block, int child_idx) { +void DataQueue::push_free_block(std::unique_ptr block, int child_idx) { DCHECK(block->rows() == 0); if (!_is_low_memory_mode) { @@ -77,7 +76,7 @@ void DataQueue::push_free_block(std::unique_ptr block, int ch void DataQueue::clear_free_blocks() { for (size_t child_idx = 0; child_idx < _free_blocks.size(); ++child_idx) { std::lock_guard l(*_free_blocks_lock[child_idx]); - std::deque> tmp_queue; + std::deque> tmp_queue; _free_blocks[child_idx].swap(tmp_queue); } } @@ -115,8 +114,7 @@ bool DataQueue::remaining_has_data() { //the _flag_queue_idx indicate which queue has data, and in check can_read //will be set idx in remaining_has_data function -Status DataQueue::get_block_from_queue(std::unique_ptr* output_block, - int* child_idx) { +Status DataQueue::get_block_from_queue(std::unique_ptr* output_block, int* child_idx) { if (_is_canceled[_flag_queue_idx]) { return Status::InternalError("Current queue of idx {} have beed canceled: ", _flag_queue_idx); @@ -144,7 +142,7 @@ Status DataQueue::get_block_from_queue(std::unique_ptr* outpu return Status::OK(); } -Status DataQueue::push_block(std::unique_ptr block, int child_idx) { +Status DataQueue::push_block(std::unique_ptr block, int child_idx) { if (!block) { return Status::OK(); } @@ -215,5 +213,4 @@ void DataQueue::set_source_block() { } } -} // namespace pipeline } // namespace doris diff --git a/be/src/pipeline/exec/data_queue.h b/be/src/exec/operator/data_queue.h similarity index 85% rename from be/src/pipeline/exec/data_queue.h rename to be/src/exec/operator/data_queue.h index de56438faf441b..a3c34d86a1e90b 100644 --- a/be/src/pipeline/exec/data_queue.h +++ b/be/src/exec/operator/data_queue.h @@ -24,9 +24,9 @@ #include #include "common/status.h" -#include "vec/core/block.h" +#include "core/block/block.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class Dependency; @@ -37,14 +37,13 @@ class DataQueue { DataQueue(int child_count = 1); ~DataQueue() = default; - Status get_block_from_queue(std::unique_ptr* block, - int* child_idx = nullptr); + Status get_block_from_queue(std::unique_ptr* block, int* child_idx = nullptr); - Status push_block(std::unique_ptr block, int child_idx = 0); + Status push_block(std::unique_ptr block, int child_idx = 0); - std::unique_ptr get_free_block(int child_idx = 0); + std::unique_ptr get_free_block(int child_idx = 0); - void push_free_block(std::unique_ptr output_block, int child_idx = 0); + void push_free_block(std::unique_ptr output_block, int child_idx = 0); void clear_free_blocks(); @@ -83,10 +82,10 @@ class DataQueue { private: std::vector> _queue_blocks_lock; - std::vector>> _queue_blocks; + std::vector>> _queue_blocks; std::vector> _free_blocks_lock; - std::vector>> _free_blocks; + std::vector>> _free_blocks; //how many deque will be init, always will be one int _child_count = 0; @@ -118,4 +117,4 @@ class DataQueue { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/datagen_operator.cpp b/be/src/exec/operator/datagen_operator.cpp similarity index 86% rename from be/src/pipeline/exec/datagen_operator.cpp rename to be/src/exec/operator/datagen_operator.cpp index 2fd8a40586b8db..457675666194ee 100644 --- a/be/src/pipeline/exec/datagen_operator.cpp +++ b/be/src/exec/operator/datagen_operator.cpp @@ -15,21 +15,21 @@ // specific language governing permissions and limitations // under the License. -#include "datagen_operator.h" +#include "exec/operator/datagen_operator.h" #include -#include "pipeline/common/data_gen_functions/vdata_gen_function_inf.h" -#include "pipeline/common/data_gen_functions/vnumbers_tvf.h" -#include "pipeline/exec/operator.h" -#include "runtime_filter/runtime_filter_consumer.h" -#include "util/runtime_profile.h" +#include "exec/common/data_gen_functions/vdata_gen_function_inf.h" +#include "exec/common/data_gen_functions/vnumbers_tvf.h" +#include "exec/operator/operator.h" +#include "exec/runtime_filter/runtime_filter_consumer.h" +#include "runtime/runtime_profile.h" namespace doris { class RuntimeState; } // namespace doris -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" DataGenSourceOperatorX::DataGenSourceOperatorX(ObjectPool* pool, const TPlanNode& tnode, int operator_id, const DescriptorTbl& descs) @@ -61,7 +61,7 @@ Status DataGenSourceOperatorX::prepare(RuntimeState* state) { return Status::OK(); } -Status DataGenSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* block, bool* eos) { +Status DataGenSourceOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { if (state == nullptr || block == nullptr) { return Status::InternalError("input is NULL pointer"); } @@ -75,8 +75,8 @@ Status DataGenSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* } { SCOPED_TIMER(local_state._filter_timer); - RETURN_IF_ERROR(vectorized::VExprContext::filter_block(local_state._conjuncts, block, - block->columns())); + RETURN_IF_ERROR( + VExprContext::filter_block(local_state._conjuncts, block, block->columns())); } local_state.reached_limit(block, eos); return Status::OK(); @@ -112,4 +112,4 @@ Status DataGenLocalState::close(RuntimeState* state) { return PipelineXLocalState<>::close(state); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/datagen_operator.h b/be/src/exec/operator/datagen_operator.h similarity index 90% rename from be/src/pipeline/exec/datagen_operator.h rename to be/src/exec/operator/datagen_operator.h index a45f7381f57364..7950725fde09b1 100644 --- a/be/src/pipeline/exec/datagen_operator.h +++ b/be/src/exec/operator/datagen_operator.h @@ -20,15 +20,15 @@ #include #include "common/status.h" -#include "pipeline/common/data_gen_functions/vdata_gen_function_inf.h" -#include "pipeline/exec/operator.h" +#include "exec/common/data_gen_functions/vdata_gen_function_inf.h" +#include "exec/operator/operator.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; } // namespace doris -namespace doris::pipeline { +namespace doris { class DataGenSourceOperatorX; class DataGenLocalState final : public PipelineXLocalState<> { @@ -59,7 +59,7 @@ class DataGenSourceOperatorX final : public OperatorX { Status init(const TPlanNode& tnode, RuntimeState* state) override; Status prepare(RuntimeState* state) override; - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override; + Status get_block(RuntimeState* state, Block* block, bool* eos) override; [[nodiscard]] bool is_source() const override { return true; } @@ -75,4 +75,4 @@ class DataGenSourceOperatorX final : public OperatorX { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/exec/dict_sink_operator.cpp b/be/src/exec/operator/dict_sink_operator.cpp similarity index 85% rename from be/src/pipeline/exec/dict_sink_operator.cpp rename to be/src/exec/operator/dict_sink_operator.cpp index 277ac3a6444fb4..c529c4ced25598 100644 --- a/be/src/pipeline/exec/dict_sink_operator.cpp +++ b/be/src/exec/operator/dict_sink_operator.cpp @@ -15,17 +15,17 @@ // specific language governing permissions and limitations // under the License. -#include "dict_sink_operator.h" +#include "exec/operator/dict_sink_operator.h" #include "common/status.h" -#include "vec/core/block.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/functions/complex_hash_map_dictionary.h" -#include "vec/functions/dictionary_factory.h" -#include "vec/functions/dictionary_util.h" -#include "vec/functions/ip_address_dictionary.h" - -namespace doris::pipeline { +#include "core/block/block.h" +#include "core/block/column_with_type_and_name.h" +#include "exprs/function/complex_hash_map_dictionary.h" +#include "exprs/function/dictionary_factory.h" +#include "exprs/function/dictionary_util.h" +#include "exprs/function/ip_address_dictionary.h" + +namespace doris { #include "common/compile_check_begin.h" Status DictSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& info) { @@ -48,13 +48,13 @@ Status DictSinkLocalState::load_dict(RuntimeState* state) { data.column = std::move(*data.column).mutate()->convert_column_if_overflow(); } - vectorized::ColumnsWithTypeAndName key_data; + ColumnsWithTypeAndName key_data; - vectorized::ColumnsWithTypeAndName value_data; + ColumnsWithTypeAndName value_data; for (long key_expr_id : p._key_output_expr_slots) { auto key_expr_ctx = _output_vexpr_ctxs[key_expr_id]; - vectorized::ColumnWithTypeAndName key_exec_data; + ColumnWithTypeAndName key_exec_data; RETURN_IF_ERROR(key_expr_ctx->execute(&input_block, key_exec_data)); key_data.push_back(key_exec_data); @@ -65,7 +65,7 @@ Status DictSinkLocalState::load_dict(RuntimeState* state) { auto value_name = p._value_names[i]; auto value_expr_ctx = _output_vexpr_ctxs[value_expr_id]; - vectorized::ColumnPtr value_column; + ColumnPtr value_column; RETURN_IF_ERROR(value_expr_ctx->execute(&input_block, value_column)); auto value_type = value_expr_ctx->execute_type(&input_block); value_data.push_back({value_column, value_type, value_name}); @@ -74,7 +74,7 @@ Status DictSinkLocalState::load_dict(RuntimeState* state) { RETURN_IF_ERROR(check_dict_input_data(key_data, value_data, p._skip_null_key)); const auto& dict_name = p._dictionary_name; - vectorized::DictionaryPtr dict = nullptr; + DictionaryPtr dict = nullptr; switch (p._layout_type) { case TDictLayoutType::type::IP_TRIE: { @@ -133,10 +133,10 @@ Status DictSinkOperatorX::prepare(RuntimeState* state) { } // prepare output_expr // From the thrift expressions create the real exprs. - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(_t_output_expr, _output_vexpr_ctxs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(_t_output_expr, _output_vexpr_ctxs)); // Prepare the exprs to run. - RETURN_IF_ERROR(vectorized::VExpr::prepare(_output_vexpr_ctxs, state, _row_desc)); - RETURN_IF_ERROR(vectorized::VExpr::open(_output_vexpr_ctxs, state)); + RETURN_IF_ERROR(VExpr::prepare(_output_vexpr_ctxs, state, _row_desc)); + RETURN_IF_ERROR(VExpr::open(_output_vexpr_ctxs, state)); for (auto key_expr_id : _key_output_expr_slots) { auto key_expr = _output_vexpr_ctxs[key_expr_id]->root(); @@ -159,7 +159,7 @@ Status DictSinkOperatorX::prepare(RuntimeState* state) { return Status::OK(); } -Status DictSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block, bool eos) { +Status DictSinkOperatorX::sink(RuntimeState* state, Block* in_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)in_block->rows()); @@ -167,8 +167,7 @@ Status DictSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block, SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(ExecEnv::GetInstance()->dict_factory()->mem_tracker()); if (local_state._dict_input_block.columns() == 0) { - local_state._dict_input_block = - vectorized::Block(vectorized::VectorizedUtils::create_empty_block(_row_desc)); + local_state._dict_input_block = Block(VectorizedUtils::create_empty_block(_row_desc)); } if (in_block->rows() != 0) { @@ -182,5 +181,5 @@ Status DictSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block, return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/pipeline/exec/dict_sink_operator.h b/be/src/exec/operator/dict_sink_operator.h similarity index 90% rename from be/src/pipeline/exec/dict_sink_operator.h rename to be/src/exec/operator/dict_sink_operator.h index 7dbe919cc6fd5f..252136b33085c1 100644 --- a/be/src/pipeline/exec/dict_sink_operator.h +++ b/be/src/exec/operator/dict_sink_operator.h @@ -21,9 +21,9 @@ #include -#include "operator.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class DictSinkLocalState final : public PipelineXSinkLocalState { ENABLE_FACTORY_CREATOR(DictSinkLocalState); @@ -38,9 +38,9 @@ class DictSinkLocalState final : public PipelineXSinkLocalState { @@ -50,7 +50,7 @@ class DictSinkOperatorX final : public DataSinkOperatorX { const std::vector& dict_input_expr, const TDictionarySink& dict_sink); Status prepare(RuntimeState* state) override; - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos) override; + Status sink(RuntimeState* state, Block* in_block, bool eos) override; private: friend class DictSinkLocalState; @@ -81,7 +81,7 @@ class DictSinkOperatorX final : public DataSinkOperatorX { // Owned by the RuntimeState. const std::vector& _t_output_expr; - vectorized::VExprContextSPtrs _output_vexpr_ctxs; + VExprContextSPtrs _output_vexpr_ctxs; // If true, we will skip the row containing the null key, if false, directly report an error const bool _skip_null_key; @@ -89,5 +89,5 @@ class DictSinkOperatorX final : public DataSinkOperatorX { const int64_t _memory_limit; }; -} // namespace doris::pipeline +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/pipeline/exec/distinct_streaming_aggregation_operator.cpp b/be/src/exec/operator/distinct_streaming_aggregation_operator.cpp similarity index 93% rename from be/src/pipeline/exec/distinct_streaming_aggregation_operator.cpp rename to be/src/exec/operator/distinct_streaming_aggregation_operator.cpp index 3fed13adfbc854..42ef0e9e74e0ba 100644 --- a/be/src/pipeline/exec/distinct_streaming_aggregation_operator.cpp +++ b/be/src/exec/operator/distinct_streaming_aggregation_operator.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "distinct_streaming_aggregation_operator.h" +#include "exec/operator/distinct_streaming_aggregation_operator.h" #include @@ -23,15 +23,15 @@ #include #include "common/compiler_util.h" // IWYU pragma: keep -#include "pipeline/exec/streaming_agg_min_reduction.h" -#include "vec/exprs/vectorized_agg_fn.h" +#include "exec/operator/streaming_agg_min_reduction.h" +#include "exprs/vectorized_agg_fn.h" namespace doris { class ExecNode; class RuntimeState; } // namespace doris -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" DistinctStreamingAggLocalState::DistinctStreamingAggLocalState(RuntimeState* state, @@ -39,8 +39,8 @@ DistinctStreamingAggLocalState::DistinctStreamingAggLocalState(RuntimeState* sta : PipelineXLocalState(state, parent), batch_size(state->batch_size()), _agg_data(std::make_unique()), - _child_block(vectorized::Block::create_unique()), - _aggregated_block(vectorized::Block::create_unique()), + _child_block(Block::create_unique()), + _aggregated_block(Block::create_unique()), _is_single_backend(state->get_query_ctx()->is_single_backend_query()) {} Status DistinctStreamingAggLocalState::init(RuntimeState* state, LocalStateInfo& info) { @@ -77,7 +77,7 @@ bool DistinctStreamingAggLocalState::_should_expand_preagg_hash_tables() { } return std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) -> bool { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); return false; @@ -140,7 +140,7 @@ bool DistinctStreamingAggLocalState::_should_expand_preagg_hash_tables() { } Status DistinctStreamingAggLocalState::_init_hash_method( - const vectorized::VExprContextSPtrs& probe_exprs) { + const VExprContextSPtrs& probe_exprs) { RETURN_IF_ERROR(init_hash_method( _agg_data.get(), get_data_types(probe_exprs), Base::_parent->template cast()._is_first_phase)); @@ -148,12 +148,12 @@ Status DistinctStreamingAggLocalState::_init_hash_method( } Status DistinctStreamingAggLocalState::_distinct_pre_agg_with_serialized_key( - doris::vectorized::Block* in_block, doris::vectorized::Block* out_block) { + doris::Block* in_block, doris::Block* out_block) { SCOPED_TIMER(_build_timer); DCHECK(!_probe_expr_ctxs.empty()); size_t key_size = _probe_expr_ctxs.size(); - vectorized::ColumnRawPtrs key_columns(key_size); + ColumnRawPtrs key_columns(key_size); std::vector result_idxs(key_size); { SCOPED_TIMER(_expr_timer); @@ -229,7 +229,7 @@ Status DistinctStreamingAggLocalState::_distinct_pre_agg_with_serialized_key( } } else { DCHECK(out_block->empty()) << "out_block must be empty , but rows is " << out_block->rows(); - vectorized::ColumnsWithTypeAndName columns_with_schema; + ColumnsWithTypeAndName columns_with_schema; for (int i = 0; i < key_size; ++i) { if (_stop_emplace_flag) { columns_with_schema.emplace_back(key_columns[i]->assume_mutable(), @@ -243,7 +243,7 @@ Status DistinctStreamingAggLocalState::_distinct_pre_agg_with_serialized_key( _probe_expr_ctxs[i]->root()->expr_name()); } } - out_block->swap(vectorized::Block(columns_with_schema)); + out_block->swap(Block(columns_with_schema)); _cache_block = out_block->clone_empty(); if (_stop_emplace_flag) { in_block->clear(); // clear the column ref with stop_emplace_flag = true @@ -252,7 +252,7 @@ Status DistinctStreamingAggLocalState::_distinct_pre_agg_with_serialized_key( return Status::OK(); } -void DistinctStreamingAggLocalState::_make_nullable_output_key(vectorized::Block* block) { +void DistinctStreamingAggLocalState::_make_nullable_output_key(Block* block) { if (block->rows() != 0) { for (auto cid : Base::_parent->cast()._make_nullable_keys) { block->get_by_position(cid).column = make_nullable(block->get_by_position(cid).column); @@ -262,10 +262,10 @@ void DistinctStreamingAggLocalState::_make_nullable_output_key(vectorized::Block } void DistinctStreamingAggLocalState::_emplace_into_hash_table_to_distinct( - vectorized::IColumn::Selector& distinct_row, vectorized::ColumnRawPtrs& key_columns, + IColumn::Selector& distinct_row, ColumnRawPtrs& key_columns, const uint32_t num_rows) { std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) -> void { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -292,7 +292,7 @@ void DistinctStreamingAggLocalState::_emplace_into_hash_table_to_distinct( auto creator_for_null_key = [&]() { distinct_row.push_back(row); }; SCOPED_TIMER(_hash_table_emplace_timer); - vectorized::lazy_emplace_batch_void(agg_method, state, num_rows, creator, + lazy_emplace_batch_void(agg_method, state, num_rows, creator, creator_for_null_key, [&](uint32_t r) { row = r; }); @@ -323,7 +323,7 @@ Status DistinctStreamingAggOperatorX::init(const TPlanNode& tnode, RuntimeState* RETURN_IF_ERROR(StatefulOperatorX::init(tnode, state)); // ignore return status for now , so we need to introduce ExecNode::init() RETURN_IF_ERROR( - vectorized::VExpr::create_expr_trees(tnode.agg_node.grouping_exprs, _probe_expr_ctxs)); + VExpr::create_expr_trees(tnode.agg_node.grouping_exprs, _probe_expr_ctxs)); _op_name = "DISTINCT_STREAMING_AGGREGATION_OPERATOR"; return Status::OK(); @@ -331,8 +331,8 @@ Status DistinctStreamingAggOperatorX::init(const TPlanNode& tnode, RuntimeState* Status DistinctStreamingAggOperatorX::prepare(RuntimeState* state) { RETURN_IF_ERROR(StatefulOperatorX::prepare(state)); - RETURN_IF_ERROR(vectorized::VExpr::prepare(_probe_expr_ctxs, state, _child->row_desc())); - RETURN_IF_ERROR(vectorized::VExpr::open(_probe_expr_ctxs, state)); + RETURN_IF_ERROR(VExpr::prepare(_probe_expr_ctxs, state, _child->row_desc())); + RETURN_IF_ERROR(VExpr::open(_probe_expr_ctxs, state)); init_make_nullable(state); return Status::OK(); } @@ -350,7 +350,7 @@ void DistinctStreamingAggOperatorX::init_make_nullable(RuntimeState* state) { } } -Status DistinctStreamingAggOperatorX::push(RuntimeState* state, vectorized::Block* in_block, +Status DistinctStreamingAggOperatorX::push(RuntimeState* state, Block* in_block, bool eos) const { auto& local_state = get_local_state(state); local_state._input_num_rows += in_block->rows(); @@ -370,7 +370,7 @@ Status DistinctStreamingAggOperatorX::push(RuntimeState* state, vectorized::Bloc return Status::OK(); } -Status DistinctStreamingAggOperatorX::pull(RuntimeState* state, vectorized::Block* block, +Status DistinctStreamingAggOperatorX::pull(RuntimeState* state, Block* block, bool* eos) const { auto& local_state = get_local_state(state); if (!local_state._aggregated_block->empty()) { @@ -412,7 +412,7 @@ Status DistinctStreamingAggLocalState::close(RuntimeState* state) { SCOPED_TIMER(Base::_close_timer); /// _hash_table_size_counter may be null if prepare failed. if (_hash_table_size_counter && !_probe_expr_ctxs.empty()) { - std::visit(vectorized::Overload {[&](std::monostate& arg) { + std::visit(Overload {[&](std::monostate& arg) { // Do nothing }, [&](auto& agg_method) { @@ -439,4 +439,4 @@ Status DistinctStreamingAggLocalState::close(RuntimeState* state) { return Base::close(state); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/distinct_streaming_aggregation_operator.h b/be/src/exec/operator/distinct_streaming_aggregation_operator.h similarity index 80% rename from be/src/pipeline/exec/distinct_streaming_aggregation_operator.h rename to be/src/exec/operator/distinct_streaming_aggregation_operator.h index 8b7898857d66bc..145ad4c79b0676 100644 --- a/be/src/pipeline/exec/distinct_streaming_aggregation_operator.h +++ b/be/src/exec/operator/distinct_streaming_aggregation_operator.h @@ -23,16 +23,15 @@ #include #include "common/status.h" -#include "pipeline/common/distinct_agg_utils.h" -#include "pipeline/exec/operator.h" -#include "util/runtime_profile.h" -#include "vec/core/block.h" +#include "core/block/block.h" +#include "exec/common/distinct_agg_utils.h" +#include "exec/operator/operator.h" +#include "runtime/runtime_profile.h" namespace doris { class ExecNode; class RuntimeState; -namespace pipeline { #include "common/compile_check_begin.h" class DistinctStreamingAggOperatorX; @@ -51,35 +50,33 @@ class DistinctStreamingAggLocalState final : public PipelineXLocalState friend class StatefulOperatorX; - Status _distinct_pre_agg_with_serialized_key(vectorized::Block* in_block, - vectorized::Block* out_block); - Status _init_hash_method(const vectorized::VExprContextSPtrs& probe_exprs); - void _emplace_into_hash_table_to_distinct(vectorized::IColumn::Selector& distinct_row, - vectorized::ColumnRawPtrs& key_columns, - const uint32_t num_rows); - void _make_nullable_output_key(vectorized::Block* block); + Status _distinct_pre_agg_with_serialized_key(Block* in_block, Block* out_block); + Status _init_hash_method(const VExprContextSPtrs& probe_exprs); + void _emplace_into_hash_table_to_distinct(IColumn::Selector& distinct_row, + ColumnRawPtrs& key_columns, const uint32_t num_rows); + void _make_nullable_output_key(Block* block); bool _should_expand_preagg_hash_tables(); - void _swap_cache_block(vectorized::Block* block) { + void _swap_cache_block(Block* block) { DCHECK(!_cache_block.is_empty_column()); block->swap(_cache_block); _cache_block = block->clone_empty(); } - vectorized::IColumn::Selector _distinct_row; - vectorized::Arena _arena; + IColumn::Selector _distinct_row; + Arena _arena; size_t _input_num_rows = 0; bool _should_expand_hash_table = true; bool _stop_emplace_flag = false; const int batch_size; std::unique_ptr _agg_data = nullptr; // group by k1,k2 - vectorized::VExprContextSPtrs _probe_expr_ctxs; - std::unique_ptr _child_block = nullptr; + VExprContextSPtrs _probe_expr_ctxs; + std::unique_ptr _child_block = nullptr; bool _child_eos = false; bool _reach_limit = false; - std::unique_ptr _aggregated_block = nullptr; - vectorized::Block _cache_block; + std::unique_ptr _aggregated_block = nullptr; + Block _cache_block; RuntimeProfile::Counter* _build_timer = nullptr; RuntimeProfile::Counter* _expr_timer = nullptr; RuntimeProfile::Counter* _hash_table_compute_timer = nullptr; @@ -113,8 +110,8 @@ class DistinctStreamingAggOperatorX final : tnode.agg_node.grouping_exprs; } Status prepare(RuntimeState* state) override; - Status pull(RuntimeState* state, vectorized::Block* block, bool* eos) const override; - Status push(RuntimeState* state, vectorized::Block* input_block, bool eos) const override; + Status pull(RuntimeState* state, Block* block, bool* eos) const override; + Status push(RuntimeState* state, Block* input_block, bool eos) const override; bool need_more_input_data(RuntimeState* state) const override; DataDistribution required_data_distribution(RuntimeState* state) const override { @@ -149,13 +146,12 @@ class DistinctStreamingAggOperatorX final std::vector _partition_exprs; const bool _is_colocate; // group by k1,k2 - vectorized::VExprContextSPtrs _probe_expr_ctxs; + VExprContextSPtrs _probe_expr_ctxs; std::vector _make_nullable_keys; // If _is_streaming_preagg = true, deduplication will be abandoned in cases where the deduplication rate is low. bool _is_streaming_preagg = false; }; -} // namespace pipeline } // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/pipeline/exec/empty_set_operator.cpp b/be/src/exec/operator/empty_set_operator.cpp similarity index 77% rename from be/src/pipeline/exec/empty_set_operator.cpp rename to be/src/exec/operator/empty_set_operator.cpp index 2dfe9701558da0..0dd0b66bce340a 100644 --- a/be/src/pipeline/exec/empty_set_operator.cpp +++ b/be/src/exec/operator/empty_set_operator.cpp @@ -15,20 +15,19 @@ // specific language governing permissions and limitations // under the License. -#include "empty_set_operator.h" +#include "exec/operator/empty_set_operator.h" #include -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" -Status EmptySetSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* block, - bool* eos) { +Status EmptySetSourceOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { *eos = true; return Status::OK(); } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/empty_set_operator.h b/be/src/exec/operator/empty_set_operator.h similarity index 90% rename from be/src/pipeline/exec/empty_set_operator.h rename to be/src/exec/operator/empty_set_operator.h index c7916dd1fd60ff..5c8f70071c0edd 100644 --- a/be/src/pipeline/exec/empty_set_operator.h +++ b/be/src/exec/operator/empty_set_operator.h @@ -19,9 +19,9 @@ #include -#include "operator.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class EmptySetLocalState final : public PipelineXLocalState { @@ -43,10 +43,10 @@ class EmptySetSourceOperatorX final : public OperatorX { EmptySetSourceOperatorX() = default; #endif - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override; + Status get_block(RuntimeState* state, Block* block, bool* eos) override; [[nodiscard]] bool is_source() const override { return true; } }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/es_scan_operator.cpp b/be/src/exec/operator/es_scan_operator.cpp similarity index 94% rename from be/src/pipeline/exec/es_scan_operator.cpp rename to be/src/exec/operator/es_scan_operator.cpp index 79f53da66fc924..68eb7747b7ec9f 100644 --- a/be/src/pipeline/exec/es_scan_operator.cpp +++ b/be/src/exec/operator/es_scan_operator.cpp @@ -15,13 +15,13 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/exec/es_scan_operator.h" +#include "exec/operator/es_scan_operator.h" #include "exec/es/es_scan_reader.h" #include "exec/es/es_scroll_query.h" -#include "vec/exec/scan/es_scanner.h" +#include "exec/scan/es_scanner.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" // Prefer to the local host static std::string get_host_and_port(const std::vector& es_hosts) { @@ -62,7 +62,7 @@ Status EsScanLocalState::_process_conjuncts(RuntimeState* state) { return Status::OK(); } -Status EsScanLocalState::_init_scanners(std::list* scanners) { +Status EsScanLocalState::_init_scanners(std::list* scanners) { if (_scan_ranges.empty()) { _eos = true; _scan_dependency->set_ready(); @@ -90,7 +90,7 @@ Status EsScanLocalState::_init_scanners(std::list* scan properties[ESScanReader::KEY_QUERY] = ESScrollQueryBuilder::build( properties, p._column_names, p._docvalue_context, &doc_value_mode); - std::shared_ptr scanner = vectorized::EsScanner::create_shared( + std::shared_ptr scanner = EsScanner::create_shared( _state, this, p._limit, p._tuple_id, properties, p._docvalue_context, doc_value_mode, _state->runtime_profile()); @@ -149,4 +149,4 @@ Status EsScanOperatorX::prepare(RuntimeState* state) { return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/es_scan_operator.h b/be/src/exec/operator/es_scan_operator.h similarity index 91% rename from be/src/pipeline/exec/es_scan_operator.h rename to be/src/exec/operator/es_scan_operator.h index f4bab46cad0ce1..c25efc5508724f 100644 --- a/be/src/pipeline/exec/es_scan_operator.h +++ b/be/src/exec/operator/es_scan_operator.h @@ -22,18 +22,16 @@ #include #include "common/status.h" -#include "operator.h" -#include "pipeline/exec/scan_operator.h" +#include "exec/operator/operator.h" +#include "exec/operator/scan_operator.h" namespace doris { #include "common/compile_check_begin.h" -namespace vectorized { class EsScanner; -} } // namespace doris -namespace doris::pipeline { +namespace doris { class EsScanOperatorX; class EsScanLocalState final : public ScanLocalState { @@ -44,13 +42,13 @@ class EsScanLocalState final : public ScanLocalState { EsScanLocalState(RuntimeState* state, OperatorXBase* parent) : Base(state, parent) {} private: - friend class vectorized::EsScanner; + friend class EsScanner; void set_scan_ranges(RuntimeState* state, const std::vector& scan_ranges) override; Status _init_profile() override; Status _process_conjuncts(RuntimeState* state) override; - Status _init_scanners(std::list* scanners) override; + Status _init_scanners(std::list* scanners) override; std::vector> _scan_ranges; // FIXME: non-static data member '_rows_read_counter' of 'EsScanLocalState' shadows member inherited from type 'ScanLocalStateBase' @@ -88,4 +86,4 @@ class EsScanOperatorX final : public ScanOperatorX { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/exchange_sink_buffer.cpp b/be/src/exec/operator/exchange_sink_buffer.cpp similarity index 94% rename from be/src/pipeline/exec/exchange_sink_buffer.cpp rename to be/src/exec/operator/exchange_sink_buffer.cpp index 0342bfd16c4655..a7ec1092115692 100644 --- a/be/src/pipeline/exec/exchange_sink_buffer.cpp +++ b/be/src/exec/operator/exchange_sink_buffer.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "exchange_sink_buffer.h" +#include "exec/operator/exchange_sink_buffer.h" #include #include @@ -37,20 +37,19 @@ #include #include "common/status.h" -#include "pipeline/exec/exchange_sink_operator.h" -#include "pipeline/pipeline_fragment_context.h" +#include "exec/exchange/vdata_stream_sender.h" +#include "exec/operator/exchange_sink_operator.h" +#include "exec/pipeline/pipeline_fragment_context.h" #include "runtime/exec_env.h" #include "runtime/thread_context.h" #include "service/backend_options.h" #include "util/defer_op.h" #include "util/proto_util.h" #include "util/time.h" -#include "vec/sink/vdata_stream_sender.h" namespace doris { #include "common/compile_check_begin.h" -namespace vectorized { BroadcastPBlockHolder::~BroadcastPBlockHolder() { // lock the parent queue, if the queue could lock success, then return the block // to the queue, to reuse the block @@ -86,9 +85,6 @@ void BroadcastPBlockHolderMemLimiter::release(const BroadcastPBlockHolder& holde } } -} // namespace vectorized - -namespace pipeline { ExchangeSinkBuffer::ExchangeSinkBuffer(PUniqueId query_id, PlanNodeId dest_node_id, PlanNodeId node_id, RuntimeState* state, const std::vector& sender_ins_ids) @@ -130,11 +126,9 @@ void ExchangeSinkBuffer::construct_request(TUniqueId fragment_instance_id) { instance_data->mutex = std::make_unique(); instance_data->seq = 0; instance_data->package_queue = - std::unordered_map>>(); + std::unordered_map>>(); instance_data->broadcast_package_queue = std::unordered_map< - vectorized::Channel*, - std::queue>>(); + Channel*, std::queue>>(); _queue_capacity = config::exchg_buffer_queue_capacity_factor * _rpc_instances.size(); PUniqueId finst_id; @@ -154,7 +148,7 @@ void ExchangeSinkBuffer::construct_request(TUniqueId fragment_instance_id) { _rpc_instances[low_id] = std::move(instance_data); } -Status ExchangeSinkBuffer::add_block(vectorized::Channel* channel, TransmitInfo&& request) { +Status ExchangeSinkBuffer::add_block(Channel* channel, TransmitInfo&& request) { if (_is_failed) { return Status::OK(); } @@ -195,8 +189,7 @@ Status ExchangeSinkBuffer::add_block(vectorized::Channel* channel, TransmitInfo& return Status::OK(); } -Status ExchangeSinkBuffer::add_block(vectorized::Channel* channel, - BroadcastTransmitInfo&& request) { +Status ExchangeSinkBuffer::add_block(Channel* channel, BroadcastTransmitInfo&& request) { if (_is_failed) { return Status::OK(); } @@ -236,7 +229,7 @@ Status ExchangeSinkBuffer::_send_rpc(RpcInstance& instance_data) { auto& q_map = instance_data.package_queue; auto& broadcast_q_map = instance_data.broadcast_package_queue; - auto find_max_size_queue = [](vectorized::Channel*& channel, auto& ptr, auto& map) { + auto find_max_size_queue = [](Channel*& channel, auto& ptr, auto& map) { for (auto& [chan, lists] : map) { if (!ptr) { if (!lists.empty()) { @@ -252,7 +245,7 @@ Status ExchangeSinkBuffer::_send_rpc(RpcInstance& instance_data) { } }; - vectorized::Channel* channel = nullptr; + Channel* channel = nullptr; std::queue>* q_ptr = nullptr; find_max_size_queue(channel, q_ptr, q_map); @@ -360,10 +353,10 @@ Status ExchangeSinkBuffer::_send_rpc(RpcInstance& instance_data) { } }); { - auto send_remote_block_closure = - AutoReleaseClosure>:: - create_unique(brpc_request, send_callback); + auto send_remote_block_closure = AutoReleaseClosure< + PTransmitDataParams, + ExchangeSendCallback>::create_unique(brpc_request, + send_callback); if (enable_http_send_block(*brpc_request)) { RETURN_IF_ERROR(transmit_block_httpv2(_context->exec_env(), std::move(send_remote_block_closure), @@ -489,10 +482,10 @@ Status ExchangeSinkBuffer::_send_rpc(RpcInstance& instance_data) { } }); { - auto send_remote_block_closure = - AutoReleaseClosure>:: - create_unique(brpc_request, send_callback); + auto send_remote_block_closure = AutoReleaseClosure< + PTransmitDataParams, + ExchangeSendCallback>::create_unique(brpc_request, + send_callback); if (enable_http_send_block(*brpc_request)) { RETURN_IF_ERROR(transmit_block_httpv2(_context->exec_env(), std::move(send_remote_block_closure), @@ -690,6 +683,5 @@ std::string ExchangeSinkBuffer::debug_each_instance_queue_size() { return fmt::to_string(debug_string_buffer); } -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/pipeline/exec/exchange_sink_buffer.h b/be/src/exec/operator/exchange_sink_buffer.h similarity index 94% rename from be/src/pipeline/exec/exchange_sink_buffer.h rename to be/src/exec/operator/exchange_sink_buffer.h index eea02e22ac74c7..706067b9115aa5 100644 --- a/be/src/pipeline/exec/exchange_sink_buffer.h +++ b/be/src/exec/operator/exchange_sink_buffer.h @@ -45,12 +45,9 @@ class TUniqueId; using InstanceLoId = int64_t; -namespace pipeline { class Dependency; class ExchangeSinkLocalState; -} // namespace pipeline -namespace vectorized { class Channel; // We use BroadcastPBlockHolder to hold a broadcasted PBlock. For broadcast shuffle, one PBlock @@ -84,7 +81,7 @@ class BroadcastPBlockHolderMemLimiter public: BroadcastPBlockHolderMemLimiter() = delete; - BroadcastPBlockHolderMemLimiter(std::shared_ptr& broadcast_dependency) + BroadcastPBlockHolderMemLimiter(std::shared_ptr& broadcast_dependency) : _total_queue_buffer_size_limit(config::exchg_node_buffer_size_bytes), _total_queue_blocks_count_limit(config::num_broadcast_buffer) { _broadcast_dependency = broadcast_dependency; @@ -103,20 +100,17 @@ class BroadcastPBlockHolderMemLimiter std::atomic_int64_t _total_queue_blocks_count_limit {0}; std::atomic_int64_t _total_queue_buffer_size {0}; std::atomic_int64_t _total_queue_blocks_count {0}; - std::shared_ptr _broadcast_dependency; + std::shared_ptr _broadcast_dependency; std::mutex _holders_lock; }; -} // namespace vectorized - -namespace pipeline { struct TransmitInfo { std::unique_ptr block; bool eos; }; struct BroadcastTransmitInfo { - std::shared_ptr block_holder = nullptr; + std::shared_ptr block_holder = nullptr; bool eos; }; @@ -142,11 +136,10 @@ struct RpcInstance { int64_t seq = 0; // Queue for regular data transmission requests - std::unordered_map>> - package_queue; + std::unordered_map>> package_queue; // Queue for broadcast data transmission requests - std::unordered_map>> broadcast_package_queue; @@ -173,7 +166,7 @@ class ExchangeSendCallback : public ::doris::DummyBrpcCallback { public: ExchangeSendCallback() = default; - void init(pipeline::RpcInstance* ins, bool eos) { + void init(RpcInstance* ins, bool eos) { _ins = ins; _eos = eos; } @@ -276,8 +269,8 @@ class ExchangeSinkBuffer : public HasTaskExecutionCtx { void construct_request(TUniqueId); - Status add_block(vectorized::Channel* channel, TransmitInfo&& request); - Status add_block(vectorized::Channel* channel, BroadcastTransmitInfo&& request); + Status add_block(Channel* channel, TransmitInfo&& request); + Status add_block(Channel* channel, BroadcastTransmitInfo&& request); void close(); void update_rpc_time(RpcInstance& ins, int64_t start_rpc_time, int64_t receive_rpc_time); void update_profile(RuntimeProfile* profile); @@ -347,6 +340,5 @@ class ExchangeSinkBuffer : public HasTaskExecutionCtx { int _send_multi_blocks_byte_size = 256 * 1024; }; -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/pipeline/exec/exchange_sink_operator.cpp b/be/src/exec/operator/exchange_sink_operator.cpp similarity index 93% rename from be/src/pipeline/exec/exchange_sink_operator.cpp rename to be/src/exec/operator/exchange_sink_operator.cpp index 314b42f68761ad..190d60d086dd4e 100644 --- a/be/src/pipeline/exec/exchange_sink_operator.cpp +++ b/be/src/exec/operator/exchange_sink_operator.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "exchange_sink_operator.h" +#include "exec/operator/exchange_sink_operator.h" #include #include @@ -30,21 +30,21 @@ #include #include "common/status.h" -#include "exchange_sink_buffer.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/operator.h" -#include "pipeline/exec/sort_source_operator.h" -#include "pipeline/local_exchange/local_exchange_sink_operator.h" -#include "pipeline/pipeline_fragment_context.h" -#include "pipeline/shuffle/exchange_writer.h" -#include "util/runtime_profile.h" +#include "core/column/column_const.h" +#include "exec/exchange/exchange_writer.h" +#include "exec/exchange/local_exchange_sink_operator.h" +#include "exec/operator/exchange_sink_buffer.h" +#include "exec/operator/operator.h" +#include "exec/operator/sort_source_operator.h" +#include "exec/pipeline/dependency.h" +#include "exec/pipeline/pipeline_fragment_context.h" +#include "exec/sink/scale_writer_partitioning_exchanger.hpp" +#include "exec/sink/tablet_sink_hash_partitioner.h" +#include "exprs/vexpr.h" +#include "runtime/runtime_profile.h" #include "util/uid_util.h" -#include "vec/columns/column_const.h" -#include "vec/exprs/vexpr.h" -#include "vec/sink/scale_writer_partitioning_exchanger.hpp" -#include "vec/sink/tablet_sink_hash_partitioner.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" bool ExchangeSinkLocalState::transfer_large_data_by_brpc() const { return _parent->cast()._transfer_large_data_by_brpc; @@ -128,10 +128,10 @@ Status ExchangeSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& inf _partition_count = channels.size(); if (_state->query_options().__isset.enable_new_shuffle_hash_method && _state->query_options().enable_new_shuffle_hash_method) { - _partitioner = std::make_unique(channels.size()); + _partitioner = std::make_unique(channels.size()); } else { _partitioner = std::make_unique< - vectorized::Crc32HashPartitioner>( + Crc32HashPartitioner>( channels.size()); } RETURN_IF_ERROR(_partitioner->init(p._texprs)); @@ -141,7 +141,7 @@ Status ExchangeSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& inf } else if (_part_type == TPartitionType::BUCKET_SHFFULE_HASH_PARTITIONED) { _partition_count = channels.size(); _partitioner = - std::make_unique>( + std::make_unique>( channels.size()); RETURN_IF_ERROR(_partitioner->init(p._texprs)); RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc)); @@ -152,7 +152,7 @@ Status ExchangeSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& inf _partition_count = channels.size(); custom_profile()->add_info_string( "Partitioner", fmt::format("TabletSinkHashPartitioner({})", _partition_count)); - _partitioner = std::make_unique( + _partitioner = std::make_unique( cast_set(_partition_count), p._tablet_sink_txn_id, p._tablet_sink_schema, p._tablet_sink_partition, p._tablet_sink_location, p._tablet_sink_tuple_id, this); RETURN_IF_ERROR(_partitioner->init({})); @@ -160,7 +160,7 @@ Status ExchangeSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& inf } else if (_part_type == TPartitionType::HIVE_TABLE_SINK_HASH_PARTITIONED) { _partition_count = channels.size() * config::table_sink_partition_write_max_partition_nums_per_writer; - _partitioner = std::make_unique( + _partitioner = std::make_unique( channels.size(), _partition_count, channels.size(), 1, config::table_sink_partition_write_min_partition_data_processed_rebalance_threshold / state->task_num() == @@ -191,7 +191,7 @@ void ExchangeSinkLocalState::_create_channels() { const auto& fragment_instance_id = p._dests[i].fragment_instance_id; if (fragment_id_to_channel_index.find(fragment_instance_id.lo) == fragment_id_to_channel_index.end()) { - channels.push_back(std::make_shared( + channels.push_back(std::make_shared( this, p._dests[i].brpc_server, fragment_instance_id, p._dest_node_id)); fragment_id_to_channel_index.emplace(fragment_instance_id.lo, channels.size() - 1); @@ -242,7 +242,7 @@ Status ExchangeSinkLocalState::open(RuntimeState* state) { if ((_part_type == TPartitionType::UNPARTITIONED) && !_only_local_exchange) { _broadcast_pb_mem_limiter = - vectorized::BroadcastPBlockHolderMemLimiter::create_shared(_queue_dependency); + BroadcastPBlockHolderMemLimiter::create_shared(_queue_dependency); } else if (_last_local_channel_idx > -1) { size_t dep_id = 0; for (auto& channel : channels) { @@ -329,7 +329,7 @@ Status ExchangeSinkOperatorX::init(const TDataSink& tsink) { return Status::InternalError("TPartitionType::RANGE_PARTITIONED should not be used"); } if (_part_type == TPartitionType::OLAP_TABLE_SINK_HASH_PARTITIONED) { - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(*_t_tablet_sink_exprs, + RETURN_IF_ERROR(VExpr::create_expr_trees(*_t_tablet_sink_exprs, _tablet_sink_expr_ctxs)); } return Status::OK(); @@ -342,14 +342,14 @@ Status ExchangeSinkOperatorX::prepare(RuntimeState* state) { if (_part_type == TPartitionType::OLAP_TABLE_SINK_HASH_PARTITIONED) { if (_output_tuple_id == -1) { RETURN_IF_ERROR( - vectorized::VExpr::prepare(_tablet_sink_expr_ctxs, state, _child->row_desc())); + VExpr::prepare(_tablet_sink_expr_ctxs, state, _child->row_desc())); } else { auto* output_tuple_desc = state->desc_tbl().get_tuple_descriptor(_output_tuple_id); auto* output_row_desc = _pool->add(new RowDescriptor(output_tuple_desc, false)); RETURN_IF_ERROR( - vectorized::VExpr::prepare(_tablet_sink_expr_ctxs, state, *output_row_desc)); + VExpr::prepare(_tablet_sink_expr_ctxs, state, *output_row_desc)); } - RETURN_IF_ERROR(vectorized::VExpr::open(_tablet_sink_expr_ctxs, state)); + RETURN_IF_ERROR(VExpr::open(_tablet_sink_expr_ctxs, state)); } _init_sink_buffer(); @@ -372,7 +372,7 @@ Status ExchangeSinkOperatorX::_handle_eof_channel(RuntimeState* state, ChannelPt return channel->close(state); } -Status ExchangeSinkOperatorX::sink(RuntimeState* state, vectorized::Block* block, bool eos) { +Status ExchangeSinkOperatorX::sink(RuntimeState* state, Block* block, bool eos) { auto& local_state = get_local_state(state); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)block->rows()); // for auto-partition, may decease when do_partitioning @@ -445,7 +445,7 @@ Status ExchangeSinkOperatorX::sink(RuntimeState* state, vectorized::Block* block idx++; } } else { - auto block_holder = vectorized::BroadcastPBlockHolder::create_shared(); + auto block_holder = BroadcastPBlockHolder::create_shared(); { bool serialized = false; RETURN_IF_ERROR(local_state._serializer.next_serialized_block( @@ -553,7 +553,7 @@ Status ExchangeSinkOperatorX::sink(RuntimeState* state, vectorized::Block* block return final_st; } -void ExchangeSinkLocalState::register_channels(pipeline::ExchangeSinkBuffer* buffer) { +void ExchangeSinkLocalState::register_channels(ExchangeSinkBuffer* buffer) { for (auto& channel : channels) { channel->set_exchange_buffer(buffer); } @@ -632,4 +632,4 @@ std::shared_ptr ExchangeSinkOperatorX::get_sink_buffer( } return _create_buffer(state, {sender_ins_id}); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/exchange_sink_operator.h b/be/src/exec/operator/exchange_sink_operator.h similarity index 93% rename from be/src/pipeline/exec/exchange_sink_operator.h rename to be/src/exec/operator/exchange_sink_operator.h index b1fc03ec099636..ebce619fd5d91a 100644 --- a/be/src/pipeline/exec/exchange_sink_operator.h +++ b/be/src/exec/operator/exchange_sink_operator.h @@ -25,17 +25,16 @@ #include #include "common/status.h" -#include "exchange_sink_buffer.h" -#include "operator.h" -#include "pipeline/shuffle/exchange_writer.h" -#include "vec/sink/vdata_stream_sender.h" +#include "exec/exchange/exchange_writer.h" +#include "exec/exchange/vdata_stream_sender.h" +#include "exec/operator/exchange_sink_buffer.h" +#include "exec/operator/operator.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; class TDataSink; -namespace pipeline { class ExchangeSinkLocalState MOCK_REMOVE(final) : public PipelineXSinkLocalState<> { ENABLE_FACTORY_CREATOR(ExchangeSinkLocalState); @@ -75,7 +74,7 @@ class ExchangeSinkLocalState MOCK_REMOVE(final) : public PipelineXSinkLocalState Status open(RuntimeState* state) override; Status close(RuntimeState* state, Status exec_status) override; Dependency* finishdependency() override { return _finish_dependency.get(); } - void register_channels(pipeline::ExchangeSinkBuffer* buffer); + void register_channels(ExchangeSinkBuffer* buffer); RuntimeProfile::Counter* blocks_sent_counter() { return _blocks_sent_counter; } RuntimeProfile::Counter* local_send_timer() { return _local_send_timer; } @@ -104,17 +103,17 @@ class ExchangeSinkLocalState MOCK_REMOVE(final) : public PipelineXSinkLocalState RuntimeProfile::Counter* distribute_rows_into_channels_timer() { return _distribute_rows_into_channels_timer; } - std::vector> channels; + std::vector> channels; int current_channel_idx {0}; // index of current channel to send to if _random == true bool _only_local_exchange {false}; void on_channel_finished(InstanceLoId channel_id); - vectorized::PartitionerBase* partitioner() const { return _partitioner.get(); } + PartitionerBase* partitioner() const { return _partitioner.get(); } private: friend class ExchangeSinkOperatorX; - friend class vectorized::Channel; - friend class vectorized::BlockSerializer; + friend class Channel; + friend class BlockSerializer; MOCK_FUNCTION void _create_channels(); @@ -141,10 +140,10 @@ class ExchangeSinkLocalState MOCK_REMOVE(final) : public PipelineXSinkLocalState // Sender instance id, unique within a fragment. int _sender_id; - std::shared_ptr _broadcast_pb_mem_limiter; + std::shared_ptr _broadcast_pb_mem_limiter; size_t _rpc_channels_num = 0; - vectorized::BlockSerializer _serializer; + BlockSerializer _serializer; std::shared_ptr _queue_dependency = nullptr; @@ -167,7 +166,7 @@ class ExchangeSinkLocalState MOCK_REMOVE(final) : public PipelineXSinkLocalState * +-----------------+ +------------------+ */ std::vector> _local_channels_dependency; - std::unique_ptr _partitioner; + std::unique_ptr _partitioner; std::unique_ptr _writer; size_t _partition_count; @@ -200,7 +199,7 @@ class ExchangeSinkOperatorX MOCK_REMOVE(final) : public DataSinkOperatorX get_sink_buffer(RuntimeState* state, InstanceLoId sender_ins_id); - vectorized::VExprContextSPtrs& tablet_sink_expr_ctxs() { return _tablet_sink_expr_ctxs; } + VExprContextSPtrs& tablet_sink_expr_ctxs() { return _tablet_sink_expr_ctxs; } private: friend class ExchangeSinkLocalState; @@ -273,7 +272,7 @@ class ExchangeSinkOperatorX MOCK_REMOVE(final) : public DataSinkOperatorX _pool; - vectorized::VExprContextSPtrs _tablet_sink_expr_ctxs; + VExprContextSPtrs _tablet_sink_expr_ctxs; const std::vector* _t_tablet_sink_exprs = nullptr; // for external table sink random partition @@ -286,6 +285,5 @@ class ExchangeSinkOperatorX MOCK_REMOVE(final) : public DataSinkOperatorX& _fragment_instance_ids; }; -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/pipeline/exec/exchange_source_operator.cpp b/be/src/exec/operator/exchange_source_operator.cpp similarity index 95% rename from be/src/pipeline/exec/exchange_source_operator.cpp rename to be/src/exec/operator/exchange_source_operator.cpp index b31b193aff2c3b..21ba4441e482a6 100644 --- a/be/src/pipeline/exec/exchange_source_operator.cpp +++ b/be/src/exec/operator/exchange_source_operator.cpp @@ -15,23 +15,23 @@ // specific language governing permissions and limitations // under the License. -#include "exchange_source_operator.h" +#include "exec/operator/exchange_source_operator.h" #include #include #include -#include "pipeline/exec/operator.h" +#include "exec/exchange/vdata_stream_mgr.h" +#include "exec/exchange/vdata_stream_recvr.h" +#include "exec/operator/operator.h" +#include "exec/sort/vsort_exec_exprs.h" +#include "exprs/vexpr_context.h" #include "runtime/exec_env.h" #include "runtime/runtime_state.h" #include "util/defer_op.h" -#include "vec/common/sort/vsort_exec_exprs.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/runtime/vdata_stream_mgr.h" -#include "vec/runtime/vdata_stream_recvr.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" ExchangeLocalState::ExchangeLocalState(RuntimeState* state, OperatorXBase* parent) : Base(state, parent), num_rows_skipped(0), is_ready(false) {} @@ -143,7 +143,7 @@ Status ExchangeSourceOperatorX::prepare(RuntimeState* state) { return Status::OK(); } -Status ExchangeSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* block, +Status ExchangeSourceOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { auto& local_state = get_local_state(state); Defer is_eos([&]() { @@ -166,7 +166,7 @@ Status ExchangeSourceOperatorX::get_block(RuntimeState* state, vectorized::Block } { SCOPED_TIMER(local_state.filter_timer); - RETURN_IF_ERROR(doris::vectorized::VExprContext::filter_block(local_state.conjuncts(), + RETURN_IF_ERROR(doris::VExprContext::filter_block(local_state.conjuncts(), block, block->columns())); } @@ -224,4 +224,4 @@ Status ExchangeSourceOperatorX::close(RuntimeState* state) { _is_closed = true; return OperatorX::close(state); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/exchange_source_operator.h b/be/src/exec/operator/exchange_source_operator.h similarity index 90% rename from be/src/pipeline/exec/exchange_source_operator.h rename to be/src/exec/operator/exchange_source_operator.h index 3008217e13009a..5c273dca7b4e1f 100644 --- a/be/src/pipeline/exec/exchange_source_operator.h +++ b/be/src/exec/operator/exchange_source_operator.h @@ -19,19 +19,17 @@ #include -#include "operator.h" +#include "exec/operator/operator.h" namespace doris { #include "common/compile_check_begin.h" class ExecNode; } // namespace doris -namespace vectorized { class VDataStreamRecvr; class Block; -} // namespace vectorized -namespace doris::pipeline { +namespace doris { class ExchangeSourceOperatorX; class ExchangeLocalState : public PipelineXLocalState<> { @@ -56,8 +54,8 @@ class ExchangeLocalState : public PipelineXLocalState<> { } MOCK_FUNCTION void create_stream_recvr(RuntimeState* state); - std::shared_ptr stream_recvr; - doris::vectorized::VSortExecExprs vsort_exec_exprs; + std::shared_ptr stream_recvr; + doris::VSortExecExprs vsort_exec_exprs; int64_t num_rows_skipped; bool is_ready; @@ -83,7 +81,7 @@ class ExchangeSourceOperatorX final : public OperatorX { Status init(const TPlanNode& tnode, RuntimeState* state) override; Status prepare(RuntimeState* state) override; - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override; + Status get_block(RuntimeState* state, Block* block, bool* eos) override; std::string debug_string(int indentation_level = 0) const override; @@ -112,10 +110,10 @@ class ExchangeSourceOperatorX final : public OperatorX { // use in merge sort size_t _offset; - doris::vectorized::VSortExecExprs _vsort_exec_exprs; + doris::VSortExecExprs _vsort_exec_exprs; std::vector _is_asc_order; std::vector _nulls_first; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/file_scan_operator.cpp b/be/src/exec/operator/file_scan_operator.cpp similarity index 82% rename from be/src/pipeline/exec/file_scan_operator.cpp rename to be/src/exec/operator/file_scan_operator.cpp index ace81d0b97cbda..34fc77687eeeba 100644 --- a/be/src/pipeline/exec/file_scan_operator.cpp +++ b/be/src/exec/operator/file_scan_operator.cpp @@ -15,26 +15,26 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/exec/file_scan_operator.h" +#include "exec/operator/file_scan_operator.h" #include #include -#include "olap/storage_engine.h" -#include "olap/tablet_manager.h" -#include "pipeline/exec/olap_scan_operator.h" -#include "pipeline/exec/scan_operator.h" -#include "vec/exec/format/format_common.h" -#include "vec/exec/scan/file_scanner.h" -#include "vec/exec/scan/scanner_context.h" +#include "exec/operator/olap_scan_operator.h" +#include "exec/operator/scan_operator.h" +#include "exec/scan/file_scanner.h" +#include "exec/scan/scanner_context.h" +#include "format/format_common.h" +#include "storage/storage_engine.h" +#include "storage/tablet/tablet_manager.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" PushDownType FileScanLocalState::_should_push_down_binary_predicate( - vectorized::VectorizedFnCall* fn_call, vectorized::VExprContext* expr_ctx, - vectorized::Field& constant_val, const std::set fn_name) const { + VectorizedFnCall* fn_call, VExprContext* expr_ctx, Field& constant_val, + const std::set fn_name) const { if (!fn_name.contains(fn_call->fn().name.function_name)) { return PushDownType::UNACCEPTABLE; } @@ -45,7 +45,7 @@ PushDownType FileScanLocalState::_should_push_down_binary_predicate( std::shared_ptr const_col_wrapper; THROW_IF_ERROR(children[1]->get_const_col(expr_ctx, &const_col_wrapper)); const auto* const_column = - assert_cast(const_col_wrapper->column_ptr.get()); + assert_cast(const_col_wrapper->column_ptr.get()); constant_val = const_column->operator[](0); return PushDownType::PARTIAL_ACCEPTABLE; } else { @@ -87,11 +87,11 @@ int FileScanLocalState::min_scanners_concurrency(RuntimeState* state) const { (state->query_parallel_instance_num() / _parent->parallelism(state)); } -vectorized::ScannerScheduler* FileScanLocalState::scan_scheduler(RuntimeState* state) const { +ScannerScheduler* FileScanLocalState::scan_scheduler(RuntimeState* state) const { return state->get_query_ctx()->get_remote_scan_scheduler(); } -Status FileScanLocalState::_init_scanners(std::list* scanners) { +Status FileScanLocalState::_init_scanners(std::list* scanners) { if (_split_source->num_scan_ranges() == 0) { _eos = true; return Status::OK(); @@ -104,13 +104,13 @@ Status FileScanLocalState::_init_scanners(std::list* sc auto& p = _parent->cast(); // There's only one scan range for each backend in batch split mode. Each backend only starts up one ScanNode instance. - uint32_t shard_num = std::min( - vectorized::ScannerScheduler::default_remote_scan_thread_num() / p.parallelism(state()), - _max_scanners); + uint32_t shard_num = + std::min(ScannerScheduler::default_remote_scan_thread_num() / p.parallelism(state()), + _max_scanners); shard_num = std::max(shard_num, 1U); - _kv_cache.reset(new vectorized::ShardedKVCache(shard_num)); + _kv_cache.reset(new ShardedKVCache(shard_num)); for (int i = 0; i < _max_scanners; ++i) { - std::unique_ptr scanner = vectorized::FileScanner::create_unique( + std::unique_ptr scanner = FileScanner::create_unique( state(), this, p._limit, _split_source, _scanner_profile.get(), _kv_cache.get(), &p._colname_to_slot_id); RETURN_IF_ERROR(scanner->init(state(), _conjuncts)); @@ -131,8 +131,8 @@ void FileScanLocalState::set_scan_ranges(RuntimeState* state, auto& p = _parent->cast(); auto calc_max_scanners = [&](int parallel_instance_num) -> int { - int max_scanners = vectorized::ScannerScheduler::default_remote_scan_thread_num() / - parallel_instance_num; + int max_scanners = + ScannerScheduler::default_remote_scan_thread_num() / parallel_instance_num; // For external tables, each scanner is not bound to specific splits. // Instead, when a scanner is scheduled, it dynamically fetches the next scan range // from a unified split source for scanning. @@ -152,7 +152,7 @@ void FileScanLocalState::set_scan_ranges(RuntimeState* state, RuntimeProfile::Counter* get_split_timer = ADD_TIMER(custom_profile(), "GetSplitTime"); _max_scanners = calc_max_scanners(p.parallelism(state)); - _split_source = std::make_shared( + _split_source = std::make_shared( state, get_split_timer, split_source.split_source_id, split_source.num_splits, _max_scanners); } @@ -161,8 +161,7 @@ void FileScanLocalState::set_scan_ranges(RuntimeState* state, if (!p._batch_split_mode) { _max_scanners = calc_max_scanners(p.parallelism(state)); if (_split_source == nullptr) { - _split_source = std::make_shared(scan_ranges, - _max_scanners); + _split_source = std::make_shared(scan_ranges, _max_scanners); } // currently the total number of splits in the bach split mode cannot be accurately obtained, // so we don't do it in the batch split mode. @@ -206,4 +205,4 @@ Status FileScanOperatorX::prepare(RuntimeState* state) { return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/file_scan_operator.h b/be/src/exec/operator/file_scan_operator.h similarity index 82% rename from be/src/pipeline/exec/file_scan_operator.h rename to be/src/exec/operator/file_scan_operator.h index 31aa92cfbb2ec4..9a1d48a341b493 100644 --- a/be/src/pipeline/exec/file_scan_operator.h +++ b/be/src/exec/operator/file_scan_operator.h @@ -23,19 +23,17 @@ #include "common/logging.h" #include "common/status.h" -#include "operator.h" -#include "pipeline/exec/scan_operator.h" -#include "vec/exec/format/format_common.h" -#include "vec/exec/scan/split_source_connector.h" +#include "exec/operator/operator.h" +#include "exec/operator/scan_operator.h" +#include "exec/scan/split_source_connector.h" +#include "format/format_common.h" namespace doris { #include "common/compile_check_begin.h" -namespace vectorized { class FileScanner; -} // namespace vectorized } // namespace doris -namespace doris::pipeline { +namespace doris { class FileScanOperatorX; class FileScanLocalState final : public ScanLocalState { @@ -49,24 +47,24 @@ class FileScanLocalState final : public ScanLocalState { Status init(RuntimeState* state, LocalStateInfo& info) override; Status _process_conjuncts(RuntimeState* state) override; - Status _init_scanners(std::list* scanners) override; + Status _init_scanners(std::list* scanners) override; void set_scan_ranges(RuntimeState* state, const std::vector& scan_ranges) override; int parent_id() { return _parent->node_id(); } std::string name_suffix() const override; int max_scanners_concurrency(RuntimeState* state) const override; int min_scanners_concurrency(RuntimeState* state) const override; - vectorized::ScannerScheduler* scan_scheduler(RuntimeState* state) const override; + ScannerScheduler* scan_scheduler(RuntimeState* state) const override; private: - friend class vectorized::FileScanner; + friend class FileScanner; PushDownType _should_push_down_bloom_filter() const override { return PushDownType::UNACCEPTABLE; } PushDownType _should_push_down_topn_filter() const override { return PushDownType::PARTIAL_ACCEPTABLE; } - bool _push_down_topn(const vectorized::RuntimePredicate& predicate) override { + bool _push_down_topn(const RuntimePredicate& predicate) override { // For external table/ file scan, first try push down the predicate, // and then determine whether it can be pushed down within the (parquet/orc) reader. return true; @@ -75,8 +73,7 @@ class FileScanLocalState final : public ScanLocalState { PushDownType _should_push_down_bitmap_filter() const override { return PushDownType::UNACCEPTABLE; } - PushDownType _should_push_down_is_null_predicate( - vectorized::VectorizedFnCall* fn_call) const override { + PushDownType _should_push_down_is_null_predicate(VectorizedFnCall* fn_call) const override { return fn_call->fn().name.function_name == "is_null_pred" || fn_call->fn().name.function_name == "is_not_null_pred" ? PushDownType::PARTIAL_ACCEPTABLE @@ -86,16 +83,16 @@ class FileScanLocalState final : public ScanLocalState { return PushDownType::PARTIAL_ACCEPTABLE; } PushDownType _should_push_down_binary_predicate( - vectorized::VectorizedFnCall* fn_call, vectorized::VExprContext* expr_ctx, - vectorized::Field& constant_val, const std::set fn_name) const override; - std::shared_ptr _split_source = nullptr; + VectorizedFnCall* fn_call, VExprContext* expr_ctx, Field& constant_val, + const std::set fn_name) const override; + std::shared_ptr _split_source = nullptr; int _max_scanners; // A in memory cache to save some common components // of the this scan node. eg: // 1. iceberg delete file // 2. parquet file meta // KVCache _kv_cache; - std::unique_ptr _kv_cache; + std::unique_ptr _kv_cache; TupleId _output_tuple_id = -1; }; @@ -135,4 +132,4 @@ class FileScanOperatorX final : public ScanOperatorX { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/group_commit_block_sink_operator.cpp b/be/src/exec/operator/group_commit_block_sink_operator.cpp similarity index 94% rename from be/src/pipeline/exec/group_commit_block_sink_operator.cpp rename to be/src/exec/operator/group_commit_block_sink_operator.cpp index db5de4da5e0d12..3a8bbe1107d8b1 100644 --- a/be/src/pipeline/exec/group_commit_block_sink_operator.cpp +++ b/be/src/exec/operator/group_commit_block_sink_operator.cpp @@ -15,14 +15,14 @@ // specific language governing permissions and limitations // under the License. -#include "group_commit_block_sink_operator.h" +#include "exec/operator/group_commit_block_sink_operator.h" #include -#include "runtime/group_commit_mgr.h" -#include "vec/sink/vtablet_block_convertor.h" +#include "exec/sink/vtablet_block_convertor.h" +#include "load/group_commit/group_commit_mgr.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" GroupCommitBlockSinkLocalState::~GroupCommitBlockSinkLocalState() { if (_load_block_queue) { @@ -47,7 +47,7 @@ Status GroupCommitBlockSinkLocalState::open(RuntimeState* state) { RETURN_IF_ERROR(_vpartition->init()); _state = state; - _block_convertor = std::make_unique(p._output_tuple_desc); + _block_convertor = std::make_unique(p._output_tuple_desc); _block_convertor->init_autoinc_info(p._schema->db_id(), p._schema->table_id(), _state->batch_size()); @@ -110,7 +110,7 @@ std::string GroupCommitBlockSinkLocalState::debug_string(int indentation_level) } Status GroupCommitBlockSinkLocalState::_add_block(RuntimeState* state, - std::shared_ptr block) { + std::shared_ptr block) { if (block->rows() == 0) { return Status::OK(); } @@ -124,15 +124,15 @@ Status GroupCommitBlockSinkLocalState::_add_block(RuntimeState* state, block->get_by_position(i).type = make_nullable(block->get_by_position(i).type); } // add block to queue - auto cur_mutable_block = vectorized::MutableBlock::create_unique(block->clone_empty()); + auto cur_mutable_block = MutableBlock::create_unique(block->clone_empty()); { - vectorized::IColumn::Selector selector; + IColumn::Selector selector; for (auto i = 0; i < block->rows(); i++) { selector.emplace_back(i); } RETURN_IF_ERROR(block->append_to_block_by_selector(cur_mutable_block.get(), selector)); } - std::shared_ptr output_block = vectorized::Block::create_shared(); + std::shared_ptr output_block = Block::create_shared(); output_block->swap(cur_mutable_block->to_block()); if (!_is_block_appended && state->num_rows_load_total() + state->num_rows_load_unselected() + state->num_rows_load_filtered() <= @@ -265,7 +265,7 @@ Status GroupCommitBlockSinkOperatorX::init(const TDataSink& t_sink) { _load_id = table_sink.load_id; _max_filter_ratio = table_sink.max_filter_ratio; // From the thrift expressions create the real exprs. - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(_t_output_expr, _output_vexpr_ctxs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(_t_output_expr, _output_vexpr_ctxs)); return Status::OK(); } @@ -277,12 +277,11 @@ Status GroupCommitBlockSinkOperatorX::prepare(RuntimeState* state) { LOG(WARNING) << "unknown destination tuple descriptor, id=" << _tuple_desc_id; return Status::InternalError("unknown destination tuple descriptor"); } - RETURN_IF_ERROR(vectorized::VExpr::prepare(_output_vexpr_ctxs, state, _row_desc)); - return vectorized::VExpr::open(_output_vexpr_ctxs, state); + RETURN_IF_ERROR(VExpr::prepare(_output_vexpr_ctxs, state, _row_desc)); + return VExpr::open(_output_vexpr_ctxs, state); } -Status GroupCommitBlockSinkOperatorX::sink(RuntimeState* state, vectorized::Block* input_block, - bool eos) { +Status GroupCommitBlockSinkOperatorX::sink(RuntimeState* state, Block* input_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)input_block->rows()); @@ -329,7 +328,7 @@ Status GroupCommitBlockSinkOperatorX::sink(RuntimeState* state, vectorized::Bloc state->update_num_rows_load_total(rows); state->update_num_bytes_load_total(bytes); - std::shared_ptr block; + std::shared_ptr block; bool has_filtered_rows = false; { SCOPED_TIMER(local_state._valid_and_convert_block_timer); @@ -374,7 +373,7 @@ Status GroupCommitBlockSinkOperatorX::sink(RuntimeState* state, vectorized::Bloc if (local_state._block_convertor->num_filtered_rows() > 0 || local_state._has_filtered_rows) { auto cloneBlock = block->clone_without_columns(); - auto res_block = vectorized::MutableBlock::build_mutable_block(&cloneBlock); + auto res_block = MutableBlock::build_mutable_block(&cloneBlock); for (int i = 0; i < rows; ++i) { if (local_state._block_convertor->filter_map()[i]) { continue; @@ -393,4 +392,4 @@ Status GroupCommitBlockSinkOperatorX::sink(RuntimeState* state, vectorized::Bloc return wind_up(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/group_commit_block_sink_operator.h b/be/src/exec/operator/group_commit_block_sink_operator.h similarity index 87% rename from be/src/pipeline/exec/group_commit_block_sink_operator.h rename to be/src/exec/operator/group_commit_block_sink_operator.h index 7956dc784a1ba6..9589908eb88c4e 100644 --- a/be/src/pipeline/exec/group_commit_block_sink_operator.h +++ b/be/src/exec/operator/group_commit_block_sink_operator.h @@ -17,17 +17,17 @@ #pragma once -#include "exec/tablet_info.h" -#include "operator.h" -#include "runtime/group_commit_mgr.h" +#include "exec/operator/operator.h" +#include "load/group_commit/group_commit_mgr.h" +#include "storage/tablet_info.h" #include "util/bitmap.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class OlapTableBlockConvertor; -} // namespace doris::vectorized +} // namespace doris -namespace doris::pipeline { +namespace doris { class GroupCommitBlockSinkOperatorX; class GroupCommitBlockSinkLocalState final : public PipelineXSinkLocalState { @@ -55,19 +55,19 @@ class GroupCommitBlockSinkLocalState final : public PipelineXSinkLocalState block); + Status _add_block(RuntimeState* state, std::shared_ptr block); Status _add_blocks(RuntimeState* state, bool is_blocks_contain_all_load_data); size_t _calculate_estimated_wal_bytes(bool is_blocks_contain_all_load_data); void _remove_estimated_wal_bytes(); Status _initialize_load_queue(); - vectorized::VExprContextSPtrs _output_vexpr_ctxs; + VExprContextSPtrs _output_vexpr_ctxs; - std::unique_ptr _block_convertor; + std::unique_ptr _block_convertor; std::shared_ptr _load_block_queue = nullptr; // used to calculate if meet the max filter ratio - std::vector> _blocks; + std::vector> _blocks; bool _is_block_appended = false; // used for find_partition std::unique_ptr _vpartition = nullptr; @@ -103,14 +103,14 @@ class GroupCommitBlockSinkOperatorX final Status prepare(RuntimeState* state) override; - Status sink(RuntimeState* state, vectorized::Block* block, bool eos) override; + Status sink(RuntimeState* state, Block* block, bool eos) override; private: friend class GroupCommitBlockSinkLocalState; const RowDescriptor& _row_desc; const std::vector& _t_output_expr; - vectorized::VExprContextSPtrs _output_vexpr_ctxs; + VExprContextSPtrs _output_vexpr_ctxs; int _tuple_desc_id = -1; std::shared_ptr _schema; @@ -128,4 +128,4 @@ class GroupCommitBlockSinkOperatorX final }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/group_commit_scan_operator.cpp b/be/src/exec/operator/group_commit_scan_operator.cpp similarity index 88% rename from be/src/pipeline/exec/group_commit_scan_operator.cpp rename to be/src/exec/operator/group_commit_scan_operator.cpp index f258557be18bca..26c2cf4fe8202b 100644 --- a/be/src/pipeline/exec/group_commit_scan_operator.cpp +++ b/be/src/exec/operator/group_commit_scan_operator.cpp @@ -15,11 +15,11 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/exec/group_commit_scan_operator.h" +#include "exec/operator/group_commit_scan_operator.h" #include -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" GroupCommitOperatorX::GroupCommitOperatorX(ObjectPool* pool, const TPlanNode& tnode, int operator_id, const DescriptorTbl& descs, @@ -29,7 +29,7 @@ GroupCommitOperatorX::GroupCommitOperatorX(ObjectPool* pool, const TPlanNode& tn _output_tuple_id = tnode.file_scan_node.tuple_id; } -Status GroupCommitOperatorX::get_block(RuntimeState* state, vectorized::Block* block, bool* eos) { +Status GroupCommitOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); bool find_node = false; @@ -48,10 +48,10 @@ Status GroupCommitLocalState::init(RuntimeState* state, LocalStateInfo& info) { p._table_id, state->fragment_instance_id(), load_block_queue, _get_block_dependency); if (st.ok()) { DCHECK(load_block_queue != nullptr); - _runtime_filter_timer = std::make_shared( + _runtime_filter_timer = std::make_shared( MonotonicMillis(), load_block_queue->get_group_commit_interval_ms(), _get_block_dependency, true); - std::vector> timers; + std::vector> timers; timers.push_back(_runtime_filter_timer); ExecEnv::GetInstance()->runtime_filter_timer_queue()->push_filter_timer(std::move(timers)); } @@ -67,4 +67,4 @@ Status GroupCommitLocalState::_process_conjuncts(RuntimeState* state) { return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/group_commit_scan_operator.h b/be/src/exec/operator/group_commit_scan_operator.h similarity index 86% rename from be/src/pipeline/exec/group_commit_scan_operator.h rename to be/src/exec/operator/group_commit_scan_operator.h index 592e2e2815042f..ebaf26a2561b82 100644 --- a/be/src/pipeline/exec/group_commit_scan_operator.h +++ b/be/src/exec/operator/group_commit_scan_operator.h @@ -22,11 +22,11 @@ #include #include "common/status.h" -#include "operator.h" -#include "pipeline/exec/scan_operator.h" -#include "runtime/group_commit_mgr.h" +#include "exec/operator/operator.h" +#include "exec/operator/scan_operator.h" +#include "load/group_commit/group_commit_mgr.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class GroupCommitOperatorX; @@ -47,7 +47,7 @@ class GroupCommitLocalState final : public ScanLocalState Status _process_conjuncts(RuntimeState* state) override; std::shared_ptr _get_block_dependency = nullptr; - std::shared_ptr _runtime_filter_timer = nullptr; + std::shared_ptr _runtime_filter_timer = nullptr; }; class GroupCommitOperatorX final : public ScanOperatorX { @@ -55,7 +55,7 @@ class GroupCommitOperatorX final : public ScanOperatorX { GroupCommitOperatorX(ObjectPool* pool, const TPlanNode& tnode, int operator_id, const DescriptorTbl& descs, int parallel_tasks); - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override; + Status get_block(RuntimeState* state, Block* block, bool* eos) override; protected: friend class GroupCommitLocalState; @@ -63,4 +63,4 @@ class GroupCommitOperatorX final : public ScanOperatorX { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/hashjoin_build_sink.cpp b/be/src/exec/operator/hashjoin_build_sink.cpp similarity index 90% rename from be/src/pipeline/exec/hashjoin_build_sink.cpp rename to be/src/exec/operator/hashjoin_build_sink.cpp index f6747c00319fe3..5fb9a1211bef7d 100644 --- a/be/src/pipeline/exec/hashjoin_build_sink.cpp +++ b/be/src/exec/operator/hashjoin_build_sink.cpp @@ -15,23 +15,23 @@ // specific language governing permissions and limitations // under the License. -#include "hashjoin_build_sink.h" +#include "exec/operator/hashjoin_build_sink.h" #include #include #include -#include "pipeline/exec/hashjoin_probe_operator.h" -#include "pipeline/exec/operator.h" -#include "pipeline/pipeline_task.h" +#include "core/block/block.h" +#include "core/column/column_nullable.h" +#include "core/data_type/data_type_nullable.h" +#include "exec/common/template_helpers.hpp" +#include "exec/operator/hashjoin_probe_operator.h" +#include "exec/operator/operator.h" +#include "exec/pipeline/pipeline_task.h" #include "util/pretty_printer.h" #include "util/uid_util.h" -#include "vec/columns/column_nullable.h" -#include "vec/core/block.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/utils/template_helpers.hpp" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" HashJoinBuildSinkLocalState::HashJoinBuildSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state) @@ -160,7 +160,7 @@ size_t HashJoinBuildSinkLocalState::get_reserve_mem_size(RuntimeState* state, bo } size_to_reserve += _evaluate_mem_usage; - vectorized::ColumnRawPtrs raw_ptrs(_build_expr_ctxs.size()); + ColumnRawPtrs raw_ptrs(_build_expr_ctxs.size()); if (build_block_rows > 0) { auto block = _build_side_mutable_block.to_block(); @@ -168,26 +168,26 @@ size_t HashJoinBuildSinkLocalState::get_reserve_mem_size(RuntimeState* state, bo Defer defer([&]() { for (auto i : converted_columns) { auto& data = block.get_by_position(i); - data.column = vectorized::remove_nullable(data.column); - data.type = vectorized::remove_nullable(data.type); + data.column = remove_nullable(data.column); + data.type = remove_nullable(data.type); } - _build_side_mutable_block = vectorized::MutableBlock(std::move(block)); + _build_side_mutable_block = MutableBlock(std::move(block)); }); - vectorized::ColumnUInt8::MutablePtr null_map_val; + ColumnUInt8::MutablePtr null_map_val; if (p._join_op == TJoinOp::LEFT_OUTER_JOIN || p._join_op == TJoinOp::FULL_OUTER_JOIN || p._join_op == TJoinOp::ASOF_LEFT_OUTER_JOIN) { converted_columns = _convert_block_to_null(block); // first row is mocked for (int i = 0; i < block.columns(); i++) { auto [column, is_const] = unpack_if_const(block.safe_get_by_position(i).column); - assert_cast(column->assume_mutable().get()) + assert_cast(column->assume_mutable().get()) ->get_null_map_column() .get_data() .data()[0] = 1; } } - null_map_val = vectorized::ColumnUInt8::create(); + null_map_val = ColumnUInt8::create(); null_map_val->get_data().assign(build_block_rows, (uint8_t)0); // Get the key column that needs to be built @@ -196,7 +196,7 @@ size_t HashJoinBuildSinkLocalState::get_reserve_mem_size(RuntimeState* state, bo throw Exception(st); } - std::visit(vectorized::Overload {[&](std::monostate& arg) {}, + std::visit(Overload {[&](std::monostate& arg) {}, [&](auto&& hash_map_context) { size_to_reserve += hash_map_context.estimated_size( raw_ptrs, (uint32_t)block.rows(), true, @@ -311,7 +311,7 @@ void HashJoinBuildSinkLocalState::init_short_circuit_for_probe() { p._join_op == TJoinOp::LEFT_ANTI_JOIN || p._join_op == TJoinOp::ASOF_LEFT_OUTER_JOIN); } -Status HashJoinBuildSinkLocalState::build_asof_index(vectorized::Block& block) { +Status HashJoinBuildSinkLocalState::build_asof_index(Block& block) { auto& p = _parent->cast(); // Only for ASOF JOIN types @@ -333,7 +333,7 @@ Status HashJoinBuildSinkLocalState::build_asof_index(vectorized::Block& block) { const uint32_t* next_array = nullptr; size_t build_rows = 0; - std::visit(vectorized::Overload {[&](std::monostate&) {}, + std::visit(Overload {[&](std::monostate&) {}, [&](auto&& hash_table_ctx) { auto* hash_table = hash_table_ctx.hash_table.get(); DORIS_CHECK(hash_table); @@ -369,10 +369,10 @@ Status HashJoinBuildSinkLocalState::build_asof_index(vectorized::Block& block) { block.get_by_position(result_col_idx).column->convert_to_full_column_if_const(); // Handle nullable: extract nested column for value access, keep nullable for null checks - const vectorized::ColumnNullable* nullable_col = nullptr; - vectorized::ColumnPtr build_col_nested = asof_build_col; + const ColumnNullable* nullable_col = nullptr; + ColumnPtr build_col_nested = asof_build_col; if (asof_build_col->is_nullable()) { - nullable_col = assert_cast(asof_build_col.get()); + nullable_col = assert_cast(asof_build_col.get()); build_col_nested = nullable_col->get_nested_column_ptr(); } @@ -385,7 +385,7 @@ Status HashJoinBuildSinkLocalState::build_asof_index(vectorized::Block& block) { asof_column_dispatch(build_col_nested.get(), [&](const auto* typed_col) { using ColType = std::remove_const_t>; - if constexpr (std::is_same_v) { + if constexpr (std::is_same_v) { throw Exception(ErrorCode::INTERNAL_ERROR, "Unsupported ASOF column type for inline optimization"); } else { @@ -396,7 +396,7 @@ Status HashJoinBuildSinkLocalState::build_asof_index(vectorized::Block& block) { .emplace>>(); std::visit( - vectorized::Overload { + Overload { [&](std::monostate&) {}, [&](auto&& hash_table_ctx) { auto* hash_table = hash_table_ctx.hash_table.get(); @@ -485,8 +485,8 @@ Status HashJoinBuildSinkLocalState::build_asof_index(vectorized::Block& block) { return Status::OK(); } -Status HashJoinBuildSinkLocalState::_do_evaluate(vectorized::Block& block, - vectorized::VExprContextSPtrs& exprs, +Status HashJoinBuildSinkLocalState::_do_evaluate(Block& block, + VExprContextSPtrs& exprs, RuntimeProfile::Counter& expr_call_timer, std::vector& res_col_ids) { auto origin_size = block.allocated_bytes(); @@ -509,7 +509,7 @@ Status HashJoinBuildSinkLocalState::_do_evaluate(vectorized::Block& block, } std::vector HashJoinBuildSinkLocalState::_convert_block_to_null( - vectorized::Block& block) { + Block& block) { std::vector results; for (int i = 0; i < block.columns(); ++i) { if (auto& column_type = block.safe_get_by_position(i); !column_type.type->is_nullable()) { @@ -523,8 +523,8 @@ std::vector HashJoinBuildSinkLocalState::_convert_block_to_null( } Status HashJoinBuildSinkLocalState::_extract_join_column( - vectorized::Block& block, vectorized::ColumnUInt8::MutablePtr& null_map, - vectorized::ColumnRawPtrs& raw_ptrs, const std::vector& res_col_ids) { + Block& block, ColumnUInt8::MutablePtr& null_map, + ColumnRawPtrs& raw_ptrs, const std::vector& res_col_ids) { DCHECK(_should_build_hash_table); auto& shared_state = *_shared_state; for (size_t i = 0; i < shared_state.build_exprs_size; ++i) { @@ -532,16 +532,16 @@ Status HashJoinBuildSinkLocalState::_extract_join_column( if (!column->is_nullable() && _parent->cast()._serialize_null_into_key[i]) { _key_columns_holder.emplace_back( - vectorized::make_nullable(block.get_by_position(res_col_ids[i]).column)); + make_nullable(block.get_by_position(res_col_ids[i]).column)); raw_ptrs[i] = _key_columns_holder.back().get(); - } else if (const auto* nullable = check_and_get_column(*column); + } else if (const auto* nullable = check_and_get_column(*column); !_parent->cast()._serialize_null_into_key[i] && nullable) { // update nulllmap and split nested out of ColumnNullable when serialize_null_into_key is false and column is nullable const auto& col_nested = nullable->get_nested_column(); const auto& col_nullmap = nullable->get_null_map_data(); DCHECK(null_map); - vectorized::VectorizedUtils::update_null_map(null_map->get_data(), col_nullmap); + VectorizedUtils::update_null_map(null_map->get_data(), col_nullmap); raw_ptrs[i] = &col_nested; } else { raw_ptrs[i] = column; @@ -551,7 +551,7 @@ Status HashJoinBuildSinkLocalState::_extract_join_column( } Status HashJoinBuildSinkLocalState::process_build_block(RuntimeState* state, - vectorized::Block& block) { + Block& block) { DCHECK(_should_build_hash_table); auto& p = _parent->cast(); SCOPED_TIMER(_build_table_timer); @@ -565,15 +565,15 @@ Status HashJoinBuildSinkLocalState::process_build_block(RuntimeState* state, } } - vectorized::ColumnRawPtrs raw_ptrs(_build_expr_ctxs.size()); - vectorized::ColumnUInt8::MutablePtr null_map_val; + ColumnRawPtrs raw_ptrs(_build_expr_ctxs.size()); + ColumnUInt8::MutablePtr null_map_val; if (p._join_op == TJoinOp::LEFT_OUTER_JOIN || p._join_op == TJoinOp::FULL_OUTER_JOIN || p._join_op == TJoinOp::ASOF_LEFT_OUTER_JOIN) { _convert_block_to_null(block); // first row is mocked for (int i = 0; i < block.columns(); i++) { auto [column, is_const] = unpack_if_const(block.safe_get_by_position(i).column); - assert_cast(column->assume_mutable().get()) + assert_cast(column->assume_mutable().get()) ->get_null_map_column() .get_data() .data()[0] = 1; @@ -582,7 +582,7 @@ Status HashJoinBuildSinkLocalState::process_build_block(RuntimeState* state, _set_build_side_has_external_nullmap(block, _build_col_ids); if (_build_side_has_external_nullmap) { - null_map_val = vectorized::ColumnUInt8::create(); + null_map_val = ColumnUInt8::create(); null_map_val->get_data().assign((size_t)rows, (uint8_t)0); } @@ -592,7 +592,7 @@ Status HashJoinBuildSinkLocalState::process_build_block(RuntimeState* state, RETURN_IF_ERROR(_hash_table_init(state, raw_ptrs)); Status st = std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg, auto join_op, auto short_circuit_for_null_in_build_side, auto with_other_conjuncts) -> Status { @@ -617,13 +617,13 @@ Status HashJoinBuildSinkLocalState::process_build_block(RuntimeState* state, }}, _shared_state->hash_table_variant_vector.front()->method_variant, _shared_state->join_op_variants, - vectorized::make_bool_variant(p._short_circuit_for_null_in_build_side), - vectorized::make_bool_variant((p._have_other_join_conjunct))); + make_bool_variant(p._short_circuit_for_null_in_build_side), + make_bool_variant((p._have_other_join_conjunct))); return st; } void HashJoinBuildSinkLocalState::_set_build_side_has_external_nullmap( - vectorized::Block& block, const std::vector& res_col_ids) { + Block& block, const std::vector& res_col_ids) { DCHECK(_should_build_hash_table); auto& p = _parent->cast(); if (p._short_circuit_for_null_in_build_side) { @@ -640,9 +640,9 @@ void HashJoinBuildSinkLocalState::_set_build_side_has_external_nullmap( } Status HashJoinBuildSinkLocalState::_hash_table_init(RuntimeState* state, - const vectorized::ColumnRawPtrs& raw_ptrs) { + const ColumnRawPtrs& raw_ptrs) { auto& p = _parent->cast(); - std::vector data_types; + std::vector data_types; for (size_t i = 0; i < _build_expr_ctxs.size(); ++i) { auto& ctx = _build_expr_ctxs[i]; auto data_type = ctx->root()->data_type(); @@ -650,10 +650,10 @@ Status HashJoinBuildSinkLocalState::_hash_table_init(RuntimeState* state, /// For 'null safe equal' join, /// the build key column maybe be converted to nullable from non-nullable. if (p._serialize_null_into_key[i]) { - data_types.emplace_back(vectorized::make_nullable(data_type)); + data_types.emplace_back(make_nullable(data_type)); } else { // in this case, we use nullmap to represent null value - data_types.emplace_back(vectorized::remove_nullable(data_type)); + data_types.emplace_back(remove_nullable(data_type)); } } if (_build_expr_ctxs.size() == 1) { @@ -698,16 +698,16 @@ Status HashJoinBuildSinkOperatorX::init(const TPlanNode& tnode, RuntimeState* st const std::vector& eq_join_conjuncts = tnode.hash_join_node.eq_join_conjuncts; for (const auto& eq_join_conjunct : eq_join_conjuncts) { - vectorized::VExprContextSPtr build_ctx; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(eq_join_conjunct.right, build_ctx)); + VExprContextSPtr build_ctx; + RETURN_IF_ERROR(VExpr::create_expr_tree(eq_join_conjunct.right, build_ctx)); { // for type check - vectorized::VExprContextSPtr probe_ctx; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(eq_join_conjunct.left, probe_ctx)); + VExprContextSPtr probe_ctx; + RETURN_IF_ERROR(VExpr::create_expr_tree(eq_join_conjunct.left, probe_ctx)); auto build_side_expr_type = build_ctx->root()->data_type(); auto probe_side_expr_type = probe_ctx->root()->data_type(); - if (!vectorized::make_nullable(build_side_expr_type) - ->equals(*vectorized::make_nullable(probe_side_expr_type))) { + if (!make_nullable(build_side_expr_type) + ->equals(*make_nullable(probe_side_expr_type))) { return Status::InternalError( "build side type {}, not match probe side type {} , node info " "{}", @@ -749,15 +749,15 @@ Status HashJoinBuildSinkOperatorX::init(const TPlanNode& tnode, RuntimeState* st if (is_asof_join(_join_op)) { DORIS_CHECK(tnode.hash_join_node.__isset.match_condition); DORIS_CHECK(!_asof_build_side_expr); - vectorized::VExprContextSPtr full_conjunct; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(tnode.hash_join_node.match_condition, + VExprContextSPtr full_conjunct; + RETURN_IF_ERROR(VExpr::create_expr_tree(tnode.hash_join_node.match_condition, full_conjunct)); DORIS_CHECK(full_conjunct); DORIS_CHECK(full_conjunct->root()); DORIS_CHECK(full_conjunct->root()->get_num_children() == 2); _asof_opcode = full_conjunct->root()->op(); auto right_child_expr = full_conjunct->root()->get_child(1); - _asof_build_side_expr = std::make_shared(right_child_expr); + _asof_build_side_expr = std::make_shared(right_child_expr); } return Status::OK(); @@ -781,7 +781,7 @@ Status HashJoinBuildSinkOperatorX::prepare(RuntimeState* state) { } }; init_keep_column_flags(row_desc().tuple_descriptors(), _should_keep_column_flags); - RETURN_IF_ERROR(vectorized::VExpr::prepare(_build_expr_ctxs, state, _child->row_desc())); + RETURN_IF_ERROR(VExpr::prepare(_build_expr_ctxs, state, _child->row_desc())); // Prepare ASOF build-side expression against build child's row_desc directly. // match_condition is bound on input tuples, so child(1) references build child's slots. if (is_asof_join(_join_op)) { @@ -789,10 +789,10 @@ Status HashJoinBuildSinkOperatorX::prepare(RuntimeState* state) { RETURN_IF_ERROR(_asof_build_side_expr->prepare(state, _child->row_desc())); RETURN_IF_ERROR(_asof_build_side_expr->open(state)); } - return vectorized::VExpr::open(_build_expr_ctxs, state); + return VExpr::open(_build_expr_ctxs, state); } -Status HashJoinBuildSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block, +Status HashJoinBuildSinkOperatorX::sink(RuntimeState* state, Block* in_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); @@ -803,7 +803,7 @@ Status HashJoinBuildSinkOperatorX::sink(RuntimeState* state, vectorized::Block* // data from probe side. if (local_state._build_side_mutable_block.empty()) { - auto tmp_build_block = vectorized::VectorizedUtils::create_empty_columnswithtypename( + auto tmp_build_block = VectorizedUtils::create_empty_columnswithtypename( _child->row_desc()); tmp_build_block = *(tmp_build_block.create_same_struct_block(1, false)); local_state._build_col_ids.resize(_build_expr_ctxs.size()); @@ -811,7 +811,7 @@ Status HashJoinBuildSinkOperatorX::sink(RuntimeState* state, vectorized::Block* *local_state._build_expr_call_timer, local_state._build_col_ids)); local_state._build_side_mutable_block = - vectorized::MutableBlock::build_mutable_block(&tmp_build_block); + MutableBlock::build_mutable_block(&tmp_build_block); } if (!in_block->empty()) { @@ -838,7 +838,7 @@ Status HashJoinBuildSinkOperatorX::sink(RuntimeState* state, vectorized::Block* if (local_state._should_build_hash_table && eos) { DCHECK(!local_state._build_side_mutable_block.empty()); - local_state._shared_state->build_block = std::make_shared( + local_state._shared_state->build_block = std::make_shared( local_state._build_side_mutable_block.to_block()); RETURN_IF_ERROR(local_state._runtime_filter_producer_helper->send_filter_size( @@ -906,4 +906,4 @@ std::string HashJoinBuildSinkOperatorX::get_memory_usage_debug_str(RuntimeState* PrettyPrinter::print_bytes(local_state._build_arena_memory_usage->value())); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/hashjoin_build_sink.h b/be/src/exec/operator/hashjoin_build_sink.h similarity index 86% rename from be/src/pipeline/exec/hashjoin_build_sink.h rename to be/src/exec/operator/hashjoin_build_sink.h index 569f9b3302567b..bb7c16207d5480 100644 --- a/be/src/pipeline/exec/hashjoin_build_sink.h +++ b/be/src/exec/operator/hashjoin_build_sink.h @@ -17,11 +17,11 @@ #pragma once -#include "join_build_sink_operator.h" -#include "operator.h" -#include "runtime_filter/runtime_filter_producer_helper.h" +#include "exec/operator/join_build_sink_operator.h" +#include "exec/operator/operator.h" +#include "exec/runtime_filter/runtime_filter_producer_helper.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class HashJoinBuildSinkOperatorX; @@ -37,10 +37,10 @@ class HashJoinBuildSinkLocalState MOCK_REMOVE(final) Status init(RuntimeState* state, LocalSinkStateInfo& info) override; Status open(RuntimeState* state) override; Status terminate(RuntimeState* state) override; - Status process_build_block(RuntimeState* state, vectorized::Block& block); + Status process_build_block(RuntimeState* state, Block& block); // Build ASOF JOIN pre-sorted index for O(log K) lookup - Status build_asof_index(vectorized::Block& block); + Status build_asof_index(Block& block); void init_short_circuit_for_probe(); @@ -53,24 +53,21 @@ class HashJoinBuildSinkLocalState MOCK_REMOVE(final) [[nodiscard]] MOCK_FUNCTION size_t get_reserve_mem_size(RuntimeState* state, bool eos); protected: - Status _hash_table_init(RuntimeState* state, const vectorized::ColumnRawPtrs& raw_ptrs); - void _set_build_side_has_external_nullmap(vectorized::Block& block, - const std::vector& res_col_ids); - Status _do_evaluate(vectorized::Block& block, vectorized::VExprContextSPtrs& exprs, + Status _hash_table_init(RuntimeState* state, const ColumnRawPtrs& raw_ptrs); + void _set_build_side_has_external_nullmap(Block& block, const std::vector& res_col_ids); + Status _do_evaluate(Block& block, VExprContextSPtrs& exprs, RuntimeProfile::Counter& expr_call_timer, std::vector& res_col_ids); - std::vector _convert_block_to_null(vectorized::Block& block); - Status _extract_join_column(vectorized::Block& block, - vectorized::ColumnUInt8::MutablePtr& null_map, - vectorized::ColumnRawPtrs& raw_ptrs, - const std::vector& res_col_ids); + std::vector _convert_block_to_null(Block& block); + Status _extract_join_column(Block& block, ColumnUInt8::MutablePtr& null_map, + ColumnRawPtrs& raw_ptrs, const std::vector& res_col_ids); friend class HashJoinBuildSinkOperatorX; friend class PartitionedHashJoinSinkLocalState; template friend struct ProcessHashTableBuild; // build expr - vectorized::VExprContextSPtrs _build_expr_ctxs; - std::vector _key_columns_holder; + VExprContextSPtrs _build_expr_ctxs; + std::vector _key_columns_holder; bool _should_build_hash_table = true; @@ -78,7 +75,7 @@ class HashJoinBuildSinkLocalState MOCK_REMOVE(final) size_t _build_side_rows = 0; int _task_idx; - vectorized::MutableBlock _build_side_mutable_block; + MutableBlock _build_side_mutable_block; std::shared_ptr _runtime_filter_producer_helper; /* @@ -121,7 +118,7 @@ class HashJoinBuildSinkOperatorX MOCK_REMOVE(final) Status prepare(RuntimeState* state) override; - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos) override; + Status sink(RuntimeState* state, Block* in_block, bool eos) override; size_t get_reserve_mem_size(RuntimeState* state, bool eos) override; @@ -176,7 +173,7 @@ class HashJoinBuildSinkOperatorX MOCK_REMOVE(final) const TJoinDistributionType::type _join_distribution; // build expr - vectorized::VExprContextSPtrs _build_expr_ctxs; + VExprContextSPtrs _build_expr_ctxs; // mark the build hash table whether it needs to store null value std::vector _serialize_null_into_key; @@ -195,19 +192,19 @@ class HashJoinBuildSinkOperatorX MOCK_REMOVE(final) // ASOF JOIN: build-side expression extracted from MATCH_CONDITION's right child // Prepared against build child's row_desc directly (no intermediate tuple needed) - vectorized::VExprContextSPtr _asof_build_side_expr; + VExprContextSPtr _asof_build_side_expr; TExprOpcode::type _asof_opcode = TExprOpcode::INVALID_OPCODE; bool _use_shared_hash_table = false; std::atomic _signaled = false; std::mutex _mutex; - std::vector> _finish_dependencies; + std::vector> _finish_dependencies; std::map> _runtime_filters; }; template struct ProcessHashTableBuild { - ProcessHashTableBuild(uint32_t rows, vectorized::ColumnRawPtrs& build_raw_ptrs, + ProcessHashTableBuild(uint32_t rows, ColumnRawPtrs& build_raw_ptrs, HashJoinBuildSinkLocalState* parent, int batch_size, RuntimeState* state) : _rows(rows), _build_raw_ptrs(build_raw_ptrs), @@ -216,8 +213,7 @@ struct ProcessHashTableBuild { _state(state) {} template - Status run(HashTableContext& hash_table_ctx, vectorized::ConstNullMapPtr null_map, - bool* has_null_key) { + Status run(HashTableContext& hash_table_ctx, ConstNullMapPtr null_map, bool* has_null_key) { if (null_map) { // first row is mocked and is null if (simd::contain_one(null_map->data() + 1, _rows - 1)) { @@ -272,11 +268,11 @@ struct ProcessHashTableBuild { private: const uint32_t _rows; - vectorized::ColumnRawPtrs& _build_raw_ptrs; + ColumnRawPtrs& _build_raw_ptrs; HashJoinBuildSinkLocalState* _parent = nullptr; int _batch_size; RuntimeState* _state = nullptr; }; -} // namespace doris::pipeline +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/pipeline/exec/hashjoin_probe_operator.cpp b/be/src/exec/operator/hashjoin_probe_operator.cpp similarity index 91% rename from be/src/pipeline/exec/hashjoin_probe_operator.cpp rename to be/src/exec/operator/hashjoin_probe_operator.cpp index 2add03f640c0dd..4f55cef2d4b4a8 100644 --- a/be/src/pipeline/exec/hashjoin_probe_operator.cpp +++ b/be/src/exec/operator/hashjoin_probe_operator.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "hashjoin_probe_operator.h" +#include "exec/operator/hashjoin_probe_operator.h" #include #include @@ -24,12 +24,12 @@ #include "common/cast_set.h" #include "common/logging.h" -#include "pipeline/exec/operator.h" +#include "core/assert_cast.h" +#include "core/data_type/data_type_nullable.h" +#include "exec/operator/operator.h" #include "runtime/descriptors.h" -#include "vec/common/assert_cast.h" -#include "vec/data_types/data_type_nullable.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" HashJoinProbeLocalState::HashJoinProbeLocalState(RuntimeState* state, OperatorXBase* parent) : JoinProbeLocalState(state, parent), @@ -102,7 +102,7 @@ Status HashJoinProbeLocalState::open(RuntimeState* state) { } }, _shared_state->join_op_variants, - vectorized::make_bool_variant(p._have_other_join_conjunct)); + make_bool_variant(p._have_other_join_conjunct)); return res; } @@ -122,7 +122,7 @@ Status HashJoinProbeLocalState::close(RuntimeState* state) { return Status::OK(); } if (_process_hashtable_ctx_variants) { - std::visit(vectorized::Overload {[&](std::monostate&) {}, + std::visit(Overload {[&](std::monostate&) {}, [&](auto&& process_hashtable_ctx) { if (process_hashtable_ctx._arena) { process_hashtable_ctx._arena.reset(); @@ -136,7 +136,7 @@ Status HashJoinProbeLocalState::close(RuntimeState* state) { return JoinProbeLocalState::close(state); } -bool HashJoinProbeLocalState::_need_probe_null_map(vectorized::Block& block, +bool HashJoinProbeLocalState::_need_probe_null_map(Block& block, const std::vector& res_col_ids) { for (size_t i = 0; i < _probe_expr_ctxs.size(); ++i) { const auto* column = block.get_by_position(res_col_ids[i]).column.get(); @@ -185,7 +185,7 @@ HashJoinProbeOperatorX::HashJoinProbeOperatorX(ObjectPool* pool, const TPlanNode ? tnode.distribute_expr_lists[0] : std::vector {}) {} -Status HashJoinProbeOperatorX::pull(doris::RuntimeState* state, vectorized::Block* output_block, +Status HashJoinProbeOperatorX::pull(doris::RuntimeState* state, Block* output_block, bool* eos) const { auto& local_state = get_local_state(state); if (local_state._shared_state->short_circuit_for_probe) { @@ -217,8 +217,8 @@ Status HashJoinProbeOperatorX::pull(doris::RuntimeState* state, vectorized::Bloc // the nested columns' null-map will be random values(not only 1 and 0), // if `struct_element` is called next, it will result in an invalid ColumnNullable data. column->insert_many_defaults(block_rows); - auto null_map_column = vectorized::ColumnUInt8::create(block_rows, 1); - auto nullable_column = vectorized::ColumnNullable::create(std::move(column), + auto null_map_column = ColumnUInt8::create(block_rows, 1); + auto nullable_column = ColumnNullable::create(std::move(column), std::move(null_map_column)); local_state._probe_block.insert({std::move(nullable_column), make_nullable(type), _right_table_column_names[i]}); @@ -234,8 +234,8 @@ Status HashJoinProbeOperatorX::pull(doris::RuntimeState* state, vectorized::Bloc local_state._join_block.clear_column_data(); - vectorized::MutableBlock mutable_join_block(&local_state._join_block); - vectorized::Block temp_block; + MutableBlock mutable_join_block(&local_state._join_block); + Block temp_block; Status st; if (local_state._probe_index < local_state._probe_block.rows()) { @@ -329,7 +329,7 @@ std::string HashJoinProbeLocalState::debug_string(int indentation_level) const { return fmt::to_string(debug_string_buffer); } -Status HashJoinProbeLocalState::_extract_join_column(vectorized::Block& block, +Status HashJoinProbeLocalState::_extract_join_column(Block& block, const std::vector& res_col_ids) { if (empty_right_table_shortcut()) { return Status::OK(); @@ -343,7 +343,7 @@ Status HashJoinProbeLocalState::_extract_join_column(vectorized::Block& block, } if (_need_null_map_for_probe) { if (!_null_map_column) { - _null_map_column = vectorized::ColumnUInt8::create(); + _null_map_column = ColumnUInt8::create(); } _null_map_column->get_data().assign(block.rows(), (uint8_t)0); } @@ -354,16 +354,16 @@ Status HashJoinProbeLocalState::_extract_join_column(vectorized::Block& block, if (!column->is_nullable() && _parent->cast()._serialize_null_into_key[i]) { _key_columns_holder.emplace_back( - vectorized::make_nullable(block.get_by_position(res_col_ids[i]).column)); + make_nullable(block.get_by_position(res_col_ids[i]).column)); _probe_columns[i] = _key_columns_holder.back().get(); - } else if (const auto* nullable = check_and_get_column(*column); + } else if (const auto* nullable = check_and_get_column(*column); nullable && !_parent->cast()._serialize_null_into_key[i]) { // update nulllmap and split nested out of ColumnNullable when serialize_null_into_key is false and column is nullable const auto& col_nested = nullable->get_nested_column(); const auto& col_nullmap = nullable->get_null_map_data(); DCHECK(_null_map_column); - vectorized::VectorizedUtils::update_null_map(_null_map_column->get_data(), col_nullmap); + VectorizedUtils::update_null_map(_null_map_column->get_data(), col_nullmap); _probe_columns[i] = &col_nested; } else { _probe_columns[i] = column; @@ -372,7 +372,7 @@ Status HashJoinProbeLocalState::_extract_join_column(vectorized::Block& block, return Status::OK(); } -std::vector HashJoinProbeLocalState::_convert_block_to_null(vectorized::Block& block) { +std::vector HashJoinProbeLocalState::_convert_block_to_null(Block& block) { std::vector results; for (int i = 0; i < block.columns(); ++i) { if (auto& column_type = block.safe_get_by_position(i); !column_type.type->is_nullable()) { @@ -386,9 +386,9 @@ std::vector HashJoinProbeLocalState::_convert_block_to_null(vectorized } Status HashJoinProbeLocalState::filter_data_and_build_output(RuntimeState* state, - vectorized::Block* output_block, + Block* output_block, bool* eos, - vectorized::Block* temp_block, + Block* temp_block, bool check_rows_count) { auto output_rows = temp_block->rows(); if (check_rows_count) { @@ -411,8 +411,8 @@ bool HashJoinProbeOperatorX::need_more_input_data(RuntimeState* state) const { !local_state._probe_eos && !local_state._shared_state->short_circuit_for_probe; } -Status HashJoinProbeOperatorX::_do_evaluate(vectorized::Block& block, - vectorized::VExprContextSPtrs& exprs, +Status HashJoinProbeOperatorX::_do_evaluate(Block& block, + VExprContextSPtrs& exprs, RuntimeProfile::Counter& expr_call_timer, std::vector& res_col_ids) const { for (size_t i = 0; i < exprs.size(); ++i) { @@ -431,7 +431,7 @@ Status HashJoinProbeOperatorX::_do_evaluate(vectorized::Block& block, return Status::OK(); } -Status HashJoinProbeOperatorX::push(RuntimeState* state, vectorized::Block* input_block, +Status HashJoinProbeOperatorX::push(RuntimeState* state, Block* input_block, bool eos) const { auto& local_state = get_local_state(state); local_state.prepare_for_next(); @@ -468,8 +468,8 @@ Status HashJoinProbeOperatorX::init(const TPlanNode& tnode, RuntimeState* state) DCHECK(tnode.__isset.hash_join_node); const std::vector& eq_join_conjuncts = tnode.hash_join_node.eq_join_conjuncts; for (const auto& eq_join_conjunct : eq_join_conjuncts) { - vectorized::VExprContextSPtr ctx; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(eq_join_conjunct.left, ctx)); + VExprContextSPtr ctx; + RETURN_IF_ERROR(VExpr::create_expr_tree(eq_join_conjunct.left, ctx)); _probe_expr_ctxs.push_back(ctx); /// null safe equal means null = null is true, the operator in SQL should be: <=>. @@ -496,14 +496,14 @@ Status HashJoinProbeOperatorX::init(const TPlanNode& tnode, RuntimeState* state) if (tnode.hash_join_node.__isset.other_join_conjuncts && !tnode.hash_join_node.other_join_conjuncts.empty()) { - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees( + RETURN_IF_ERROR(VExpr::create_expr_trees( tnode.hash_join_node.other_join_conjuncts, _other_join_conjuncts)); DCHECK(!_build_unique); DCHECK(_have_other_join_conjunct); } else if (tnode.hash_join_node.__isset.vother_join_conjunct) { _other_join_conjuncts.resize(1); - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree( + RETURN_IF_ERROR(VExpr::create_expr_tree( tnode.hash_join_node.vother_join_conjunct, _other_join_conjuncts[0])); // If LEFT SEMI JOIN/LEFT ANTI JOIN with not equal predicate, @@ -514,7 +514,7 @@ Status HashJoinProbeOperatorX::init(const TPlanNode& tnode, RuntimeState* state) if (tnode.hash_join_node.__isset.mark_join_conjuncts && !tnode.hash_join_node.mark_join_conjuncts.empty()) { - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees( + RETURN_IF_ERROR(VExpr::create_expr_trees( tnode.hash_join_node.mark_join_conjuncts, _mark_join_conjuncts)); DCHECK(_is_mark_join); @@ -529,14 +529,14 @@ Status HashJoinProbeOperatorX::init(const TPlanNode& tnode, RuntimeState* state) // match_condition is bound on input tuples, so child(0) references probe child's slots. if (is_asof_join(_join_op)) { DORIS_CHECK(tnode.hash_join_node.__isset.match_condition); - vectorized::VExprContextSPtr full_conjunct; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(tnode.hash_join_node.match_condition, + VExprContextSPtr full_conjunct; + RETURN_IF_ERROR(VExpr::create_expr_tree(tnode.hash_join_node.match_condition, full_conjunct)); DORIS_CHECK(full_conjunct); DORIS_CHECK(full_conjunct->root()); DORIS_CHECK(full_conjunct->root()->get_num_children() == 2); auto left_child_expr = full_conjunct->root()->get_child(0); - _asof_probe_expr = std::make_shared(left_child_expr); + _asof_probe_expr = std::make_shared(left_child_expr); } return Status::OK(); @@ -577,7 +577,7 @@ Status HashJoinProbeOperatorX::prepare(RuntimeState* state) { conjunct->root()->collect_slot_column_ids(_should_not_lazy_materialized_column_ids); } - RETURN_IF_ERROR(vectorized::VExpr::prepare(_probe_expr_ctxs, state, _child->row_desc())); + RETURN_IF_ERROR(VExpr::prepare(_probe_expr_ctxs, state, _child->row_desc())); // Prepare ASOF probe-side expression against probe child's row_desc directly. if (is_asof_join(_join_op)) { DORIS_CHECK(_asof_probe_expr); @@ -588,10 +588,10 @@ Status HashJoinProbeOperatorX::prepare(RuntimeState* state) { DCHECK(_build_side_child != nullptr); // right table data types _right_table_data_types = - vectorized::VectorizedUtils::get_data_types(_build_side_child->row_desc()); - _left_table_data_types = vectorized::VectorizedUtils::get_data_types(_child->row_desc()); + VectorizedUtils::get_data_types(_build_side_child->row_desc()); + _left_table_data_types = VectorizedUtils::get_data_types(_child->row_desc()); _right_table_column_names = - vectorized::VectorizedUtils::get_column_names(_build_side_child->row_desc()); + VectorizedUtils::get_column_names(_build_side_child->row_desc()); std::vector slots_to_check; for (const auto& tuple_descriptor : _intermediate_row_desc->tuple_descriptors()) { @@ -610,7 +610,7 @@ Status HashJoinProbeOperatorX::prepare(RuntimeState* state) { data_type->get_name()); } - const auto& null_data_type = assert_cast(*data_type); + const auto& null_data_type = assert_cast(*data_type); if (null_data_type.get_nested_type()->get_primitive_type() != PrimitiveType::TYPE_BOOLEAN) { return Status::InternalError( "The last column for mark join should be Nullable(UInt8), not {}", @@ -660,7 +660,7 @@ Status HashJoinProbeOperatorX::prepare(RuntimeState* state) { _join_op == TJoinOp::ASOF_LEFT_OUTER_JOIN)); if (accept_nullable_not_match) { - auto data_type_non_nullable = vectorized::remove_nullable(data_type); + auto data_type_non_nullable = remove_nullable(data_type); if (data_type_non_nullable->equals(*target_data_type)) { continue; } @@ -676,7 +676,7 @@ Status HashJoinProbeOperatorX::prepare(RuntimeState* state) { } _build_side_child.reset(); - RETURN_IF_ERROR(vectorized::VExpr::open(_probe_expr_ctxs, state)); + RETURN_IF_ERROR(VExpr::open(_probe_expr_ctxs, state)); for (auto& conjunct : _other_join_conjuncts) { RETURN_IF_ERROR(conjunct->open(state)); } @@ -688,4 +688,4 @@ Status HashJoinProbeOperatorX::prepare(RuntimeState* state) { return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/hashjoin_probe_operator.h b/be/src/exec/operator/hashjoin_probe_operator.h similarity index 84% rename from be/src/pipeline/exec/hashjoin_probe_operator.h rename to be/src/exec/operator/hashjoin_probe_operator.h index 6be1df67fe61b1..200d067e80dc64 100644 --- a/be/src/pipeline/exec/hashjoin_probe_operator.h +++ b/be/src/exec/operator/hashjoin_probe_operator.h @@ -20,13 +20,12 @@ #include "common/be_mock_util.h" #include "common/status.h" -#include "operator.h" -#include "pipeline/exec/join_probe_operator.h" +#include "exec/operator/join_probe_operator.h" +#include "exec/operator/operator.h" namespace doris { class RuntimeState; -namespace pipeline { #include "common/compile_check_begin.h" class HashJoinProbeLocalState; @@ -58,12 +57,12 @@ class HashJoinProbeLocalState MOCK_REMOVE(final) Status close(RuntimeState* state) override; void prepare_for_next(); - Status filter_data_and_build_output(RuntimeState* state, vectorized::Block* output_block, - bool* eos, vectorized::Block* temp_block, + Status filter_data_and_build_output(RuntimeState* state, Block* output_block, + bool* eos, Block* temp_block, bool check_rows_count = true); bool has_null_in_build_side() { return _shared_state->_has_null_in_build_side; } - const std::shared_ptr& build_block() const { + const std::shared_ptr& build_block() const { return _shared_state->build_block; } bool empty_right_table_shortcut() const { @@ -73,9 +72,9 @@ class HashJoinProbeLocalState MOCK_REMOVE(final) private: void _prepare_probe_block(); - bool _need_probe_null_map(vectorized::Block& block, const std::vector& res_col_ids); - std::vector _convert_block_to_null(vectorized::Block& block); - Status _extract_join_column(vectorized::Block& block, const std::vector& res_col_ids); + bool _need_probe_null_map(Block& block, const std::vector& res_col_ids); + std::vector _convert_block_to_null(Block& block); + Status _extract_join_column(Block& block, const std::vector& res_col_ids); friend class HashJoinProbeOperatorX; template friend struct ProcessHashTableProbe; @@ -90,23 +89,23 @@ class HashJoinProbeLocalState MOCK_REMOVE(final) // For mark join, last probe index of null mark int _last_probe_null_mark; - vectorized::Block _probe_block; - vectorized::ColumnRawPtrs _probe_columns; + Block _probe_block; + ColumnRawPtrs _probe_columns; // other expr - vectorized::VExprContextSPtrs _other_join_conjuncts; + VExprContextSPtrs _other_join_conjuncts; - vectorized::VExprContextSPtrs _mark_join_conjuncts; + VExprContextSPtrs _mark_join_conjuncts; - std::vector _key_columns_holder; + std::vector _key_columns_holder; // probe expr - vectorized::VExprContextSPtrs _probe_expr_ctxs; + VExprContextSPtrs _probe_expr_ctxs; std::vector _probe_column_disguise_null; std::vector _probe_column_convert_to_null; bool _need_null_map_for_probe = false; bool _has_set_need_null_map_for_probe = false; - vectorized::ColumnUInt8::MutablePtr _null_map_column; + ColumnUInt8::MutablePtr _null_map_column; std::unique_ptr _process_hashtable_ctx_variants = std::make_unique(); @@ -134,8 +133,8 @@ class HashJoinProbeOperatorX MOCK_REMOVE(final) Status init(const TPlanNode& tnode, RuntimeState* state) override; Status prepare(RuntimeState* state) override; - Status push(RuntimeState* state, vectorized::Block* input_block, bool eos) const override; - Status pull(doris::RuntimeState* state, vectorized::Block* output_block, + Status push(RuntimeState* state, Block* input_block, bool eos) const override; + Status pull(doris::RuntimeState* state, Block* output_block, bool* eos) const override; bool need_more_input_data(RuntimeState* state) const override; @@ -185,7 +184,7 @@ class HashJoinProbeOperatorX MOCK_REMOVE(final) } private: - Status _do_evaluate(vectorized::Block& block, vectorized::VExprContextSPtrs& exprs, + Status _do_evaluate(Block& block, VExprContextSPtrs& exprs, RuntimeProfile::Counter& expr_call_timer, std::vector& res_col_ids) const; friend class HashJoinProbeLocalState; @@ -196,21 +195,21 @@ class HashJoinProbeOperatorX MOCK_REMOVE(final) const bool _is_broadcast_join; // other expr - vectorized::VExprContextSPtrs _other_join_conjuncts; + VExprContextSPtrs _other_join_conjuncts; - vectorized::VExprContextSPtrs _mark_join_conjuncts; + VExprContextSPtrs _mark_join_conjuncts; // mark the build hash table whether it needs to store null value std::vector _serialize_null_into_key; // probe expr - vectorized::VExprContextSPtrs _probe_expr_ctxs; + VExprContextSPtrs _probe_expr_ctxs; // ASOF JOIN: probe-side expression extracted from MATCH_CONDITION's left child // Prepared against probe child's row_desc directly - vectorized::VExprContextSPtr _asof_probe_expr; + VExprContextSPtr _asof_probe_expr; - vectorized::DataTypes _right_table_data_types; - vectorized::DataTypes _left_table_data_types; + DataTypes _right_table_data_types; + DataTypes _left_table_data_types; std::vector _hash_output_slot_ids; std::vector _left_output_slot_flags; std::vector _right_output_slot_flags; @@ -223,6 +222,5 @@ class HashJoinProbeOperatorX MOCK_REMOVE(final) size_t _right_col_idx; }; -} // namespace pipeline } // namespace doris #include "common/compile_check_end.h" \ No newline at end of file diff --git a/be/src/pipeline/exec/hive_table_sink_operator.cpp b/be/src/exec/operator/hive_table_sink_operator.cpp similarity index 92% rename from be/src/pipeline/exec/hive_table_sink_operator.cpp rename to be/src/exec/operator/hive_table_sink_operator.cpp index 314df2bf066d87..8ac33400198ec0 100644 --- a/be/src/pipeline/exec/hive_table_sink_operator.cpp +++ b/be/src/exec/operator/hive_table_sink_operator.cpp @@ -15,11 +15,11 @@ // specific language governing permissions and limitations // under the License. -#include "hive_table_sink_operator.h" +#include "exec/operator/hive_table_sink_operator.h" #include "common/status.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" Status HiveTableSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& info) { RETURN_IF_ERROR(Base::init(state, info)); @@ -30,4 +30,4 @@ Status HiveTableSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& in return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/hive_table_sink_operator.h b/be/src/exec/operator/hive_table_sink_operator.h similarity index 77% rename from be/src/pipeline/exec/hive_table_sink_operator.h rename to be/src/exec/operator/hive_table_sink_operator.h index 725fd8e049094d..ff4a681f425613 100644 --- a/be/src/pipeline/exec/hive_table_sink_operator.h +++ b/be/src/exec/operator/hive_table_sink_operator.h @@ -17,18 +17,18 @@ #pragma once -#include "operator.h" -#include "vec/sink/writer/vhive_table_writer.h" +#include "exec/operator/operator.h" +#include "exec/sink/writer/vhive_table_writer.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class HiveTableSinkOperatorX; class HiveTableSinkLocalState final - : public AsyncWriterSink { + : public AsyncWriterSink { public: - using Base = AsyncWriterSink; + using Base = AsyncWriterSink; using Parent = HiveTableSinkOperatorX; ENABLE_FACTORY_CREATOR(HiveTableSinkLocalState); HiveTableSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state) @@ -56,17 +56,17 @@ class HiveTableSinkOperatorX final : public DataSinkOperatorXrows()); @@ -76,13 +76,13 @@ class HiveTableSinkOperatorX final : public DataSinkOperatorX - requires(std::is_base_of_v) + requires(std::is_base_of_v) friend class AsyncWriterSink; const RowDescriptor& _row_desc; - vectorized::VExprContextSPtrs _output_vexpr_ctxs; + VExprContextSPtrs _output_vexpr_ctxs; const std::vector& _t_output_expr; ObjectPool* _pool = nullptr; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/iceberg_table_sink_operator.cpp b/be/src/exec/operator/iceberg_table_sink_operator.cpp similarity index 92% rename from be/src/pipeline/exec/iceberg_table_sink_operator.cpp rename to be/src/exec/operator/iceberg_table_sink_operator.cpp index ab76beac655608..22b7ddd153106b 100644 --- a/be/src/pipeline/exec/iceberg_table_sink_operator.cpp +++ b/be/src/exec/operator/iceberg_table_sink_operator.cpp @@ -15,11 +15,11 @@ // specific language governing permissions and limitations // under the License. -#include "iceberg_table_sink_operator.h" +#include "exec/operator/iceberg_table_sink_operator.h" #include "common/status.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" Status IcebergTableSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& info) { RETURN_IF_ERROR(Base::init(state, info)); @@ -30,4 +30,4 @@ Status IcebergTableSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/iceberg_table_sink_operator.h b/be/src/exec/operator/iceberg_table_sink_operator.h similarity index 77% rename from be/src/pipeline/exec/iceberg_table_sink_operator.h rename to be/src/exec/operator/iceberg_table_sink_operator.h index 284657a721993f..5d3867323bd2c6 100644 --- a/be/src/pipeline/exec/iceberg_table_sink_operator.h +++ b/be/src/exec/operator/iceberg_table_sink_operator.h @@ -17,18 +17,18 @@ #pragma once -#include "operator.h" -#include "vec/sink/writer/iceberg/viceberg_table_writer.h" +#include "exec/operator/operator.h" +#include "exec/sink/writer/iceberg/viceberg_table_writer.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class IcebergTableSinkOperatorX; class IcebergTableSinkLocalState final - : public AsyncWriterSink { + : public AsyncWriterSink { public: - using Base = AsyncWriterSink; + using Base = AsyncWriterSink; using Parent = IcebergTableSinkOperatorX; ENABLE_FACTORY_CREATOR(IcebergTableSinkLocalState); IcebergTableSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state) @@ -55,17 +55,17 @@ class IcebergTableSinkOperatorX final : public DataSinkOperatorXrows()); @@ -75,13 +75,13 @@ class IcebergTableSinkOperatorX final : public DataSinkOperatorX - requires(std::is_base_of_v) + requires(std::is_base_of_v) friend class AsyncWriterSink; const RowDescriptor& _row_desc; - vectorized::VExprContextSPtrs _output_vexpr_ctxs; + VExprContextSPtrs _output_vexpr_ctxs; const std::vector& _t_output_expr; ObjectPool* _pool = nullptr; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/jdbc_scan_operator.cpp b/be/src/exec/operator/jdbc_scan_operator.cpp similarity index 81% rename from be/src/pipeline/exec/jdbc_scan_operator.cpp rename to be/src/exec/operator/jdbc_scan_operator.cpp index 9877e05351835b..311acb37f90640 100644 --- a/be/src/pipeline/exec/jdbc_scan_operator.cpp +++ b/be/src/exec/operator/jdbc_scan_operator.cpp @@ -15,12 +15,12 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/exec/jdbc_scan_operator.h" +#include "exec/operator/jdbc_scan_operator.h" #include "common/object_pool.h" -#include "vec/exec/scan/jdbc_scanner.h" +#include "exec/scan/jdbc_scanner.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" std::string JDBCScanLocalState::name_suffix() const { return fmt::format("(nereids_id={}. table_name={})" + operator_name_suffix, @@ -29,11 +29,11 @@ std::string JDBCScanLocalState::name_suffix() const { std::to_string(_parent->node_id())); } -Status JDBCScanLocalState::_init_scanners(std::list* scanners) { +Status JDBCScanLocalState::_init_scanners(std::list* scanners) { auto& p = _parent->cast(); - std::unique_ptr scanner = vectorized::JdbcScanner::create_unique( - state(), this, p._limit, p._tuple_id, p._query_string, p._table_type, p._is_tvf, - _scanner_profile.get()); + std::unique_ptr scanner = + JdbcScanner::create_unique(state(), this, p._limit, p._tuple_id, p._query_string, + p._table_type, p._is_tvf, _scanner_profile.get()); RETURN_IF_ERROR(scanner->init(state(), _conjuncts)); scanners->push_back(std::move(scanner)); return Status::OK(); @@ -50,4 +50,4 @@ JDBCScanOperatorX::JDBCScanOperatorX(ObjectPool* pool, const TPlanNode& tnode, i _is_tvf = tnode.jdbc_scan_node.__isset.is_tvf ? tnode.jdbc_scan_node.is_tvf : false; } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/jdbc_scan_operator.h b/be/src/exec/operator/jdbc_scan_operator.h similarity index 87% rename from be/src/pipeline/exec/jdbc_scan_operator.h rename to be/src/exec/operator/jdbc_scan_operator.h index 45cc85978f627b..6a233826e12336 100644 --- a/be/src/pipeline/exec/jdbc_scan_operator.h +++ b/be/src/exec/operator/jdbc_scan_operator.h @@ -22,18 +22,16 @@ #include #include "common/status.h" -#include "operator.h" -#include "pipeline/exec/scan_operator.h" +#include "exec/operator/operator.h" +#include "exec/operator/scan_operator.h" namespace doris { #include "common/compile_check_begin.h" -namespace vectorized { class JdbcScanner; -} } // namespace doris -namespace doris::pipeline { +namespace doris { class JDBCScanOperatorX; class JDBCScanLocalState final : public ScanLocalState { @@ -42,12 +40,12 @@ class JDBCScanLocalState final : public ScanLocalState { ENABLE_FACTORY_CREATOR(JDBCScanLocalState); JDBCScanLocalState(RuntimeState* state, OperatorXBase* parent) : ScanLocalState(state, parent) {} - Status _init_scanners(std::list* scanners) override; + Status _init_scanners(std::list* scanners) override; std::string name_suffix() const override; private: - friend class vectorized::JdbcScanner; + friend class JdbcScanner; }; class JDBCScanOperatorX final : public ScanOperatorX { @@ -65,4 +63,4 @@ class JDBCScanOperatorX final : public ScanOperatorX { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/jdbc_table_sink_operator.cpp b/be/src/exec/operator/jdbc_table_sink_operator.cpp similarity index 78% rename from be/src/pipeline/exec/jdbc_table_sink_operator.cpp rename to be/src/exec/operator/jdbc_table_sink_operator.cpp index c213616e25cbae..85761effac1ac0 100644 --- a/be/src/pipeline/exec/jdbc_table_sink_operator.cpp +++ b/be/src/exec/operator/jdbc_table_sink_operator.cpp @@ -15,16 +15,16 @@ // specific language governing permissions and limitations // under the License. -#include "jdbc_table_sink_operator.h" +#include "exec/operator/jdbc_table_sink_operator.h" #include #include "common/object_pool.h" -#include "pipeline/exec/operator.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" +#include "exec/operator/operator.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" JdbcTableSinkOperatorX::JdbcTableSinkOperatorX(const RowDescriptor& row_desc, int operator_id, const std::vector& t_output_expr) @@ -36,18 +36,18 @@ JdbcTableSinkOperatorX::JdbcTableSinkOperatorX(const RowDescriptor& row_desc, in Status JdbcTableSinkOperatorX::init(const TDataSink& thrift_sink) { RETURN_IF_ERROR(DataSinkOperatorX::init(thrift_sink)); // From the thrift expressions create the real exprs. - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(_t_output_expr, _output_vexpr_ctxs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(_t_output_expr, _output_vexpr_ctxs)); return Status::OK(); } Status JdbcTableSinkOperatorX::prepare(RuntimeState* state) { RETURN_IF_ERROR(DataSinkOperatorX::prepare(state)); - RETURN_IF_ERROR(vectorized::VExpr::prepare(_output_vexpr_ctxs, state, _row_desc)); - RETURN_IF_ERROR(vectorized::VExpr::open(_output_vexpr_ctxs, state)); + RETURN_IF_ERROR(VExpr::prepare(_output_vexpr_ctxs, state, _row_desc)); + RETURN_IF_ERROR(VExpr::open(_output_vexpr_ctxs, state)); return Status::OK(); } -Status JdbcTableSinkOperatorX::sink(RuntimeState* state, vectorized::Block* block, bool eos) { +Status JdbcTableSinkOperatorX::sink(RuntimeState* state, Block* block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)block->rows()); @@ -55,4 +55,4 @@ Status JdbcTableSinkOperatorX::sink(RuntimeState* state, vectorized::Block* bloc return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/jdbc_table_sink_operator.h b/be/src/exec/operator/jdbc_table_sink_operator.h similarity index 73% rename from be/src/pipeline/exec/jdbc_table_sink_operator.h rename to be/src/exec/operator/jdbc_table_sink_operator.h index d1b617402b2247..7481549ccda2f0 100644 --- a/be/src/pipeline/exec/jdbc_table_sink_operator.h +++ b/be/src/exec/operator/jdbc_table_sink_operator.h @@ -19,22 +19,21 @@ #include -#include "operator.h" -#include "vec/sink/writer/vjdbc_table_writer.h" +#include "exec/operator/operator.h" +#include "exec/sink/writer/vjdbc_table_writer.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class JdbcTableSinkOperatorX; class JdbcTableSinkLocalState final - : public AsyncWriterSink { + : public AsyncWriterSink { ENABLE_FACTORY_CREATOR(JdbcTableSinkLocalState); public: - using Base = AsyncWriterSink; + using Base = AsyncWriterSink; JdbcTableSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state) - : AsyncWriterSink(parent, state) { - } + : AsyncWriterSink(parent, state) {} private: friend class JdbcTableSinkOperatorX; @@ -47,18 +46,18 @@ class JdbcTableSinkOperatorX final : public DataSinkOperatorX - requires(std::is_base_of_v) + requires(std::is_base_of_v) friend class AsyncWriterSink; const RowDescriptor& _row_desc; const std::vector& _t_output_expr; - vectorized::VExprContextSPtrs _output_vexpr_ctxs; + VExprContextSPtrs _output_vexpr_ctxs; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/join/asof_left_inner_join_impl.cpp b/be/src/exec/operator/join/asof_left_inner_join_impl.cpp similarity index 97% rename from be/src/pipeline/exec/join/asof_left_inner_join_impl.cpp rename to be/src/exec/operator/join/asof_left_inner_join_impl.cpp index 0bb8dd9ecf3982..e509f81e23ec9a 100644 --- a/be/src/pipeline/exec/join/asof_left_inner_join_impl.cpp +++ b/be/src/exec/operator/join/asof_left_inner_join_impl.cpp @@ -19,7 +19,7 @@ #include "process_hash_table_probe_impl.h" -namespace doris::pipeline { +namespace doris { INSTANTIATION_FOR(TJoinOp::ASOF_LEFT_INNER_JOIN); diff --git a/be/src/pipeline/exec/join/asof_left_outer_join_impl.cpp b/be/src/exec/operator/join/asof_left_outer_join_impl.cpp similarity index 97% rename from be/src/pipeline/exec/join/asof_left_outer_join_impl.cpp rename to be/src/exec/operator/join/asof_left_outer_join_impl.cpp index 30a36e6f7a04d5..785a736f56306a 100644 --- a/be/src/pipeline/exec/join/asof_left_outer_join_impl.cpp +++ b/be/src/exec/operator/join/asof_left_outer_join_impl.cpp @@ -19,7 +19,7 @@ #include "process_hash_table_probe_impl.h" -namespace doris::pipeline { +namespace doris { INSTANTIATION_FOR(TJoinOp::ASOF_LEFT_OUTER_JOIN); diff --git a/be/src/pipeline/exec/join/full_outer_join_impl.cpp b/be/src/exec/operator/join/full_outer_join_impl.cpp similarity index 91% rename from be/src/pipeline/exec/join/full_outer_join_impl.cpp rename to be/src/exec/operator/join/full_outer_join_impl.cpp index 0e1ddb58642537..4f94a6bd79c3fa 100644 --- a/be/src/pipeline/exec/join/full_outer_join_impl.cpp +++ b/be/src/exec/operator/join/full_outer_join_impl.cpp @@ -17,9 +17,9 @@ #include -#include "process_hash_table_probe_impl.h" +#include "exec/operator/join/process_hash_table_probe_impl.h" -namespace doris::pipeline { +namespace doris { INSTANTIATION_FOR(TJoinOp::FULL_OUTER_JOIN); diff --git a/be/src/pipeline/exec/join/inner_join_impl.cpp b/be/src/exec/operator/join/inner_join_impl.cpp similarity index 91% rename from be/src/pipeline/exec/join/inner_join_impl.cpp rename to be/src/exec/operator/join/inner_join_impl.cpp index 21767ecafa0509..07571ddedb0f23 100644 --- a/be/src/pipeline/exec/join/inner_join_impl.cpp +++ b/be/src/exec/operator/join/inner_join_impl.cpp @@ -17,9 +17,9 @@ #include -#include "process_hash_table_probe_impl.h" +#include "exec/operator/join/process_hash_table_probe_impl.h" -namespace doris::pipeline { +namespace doris { INSTANTIATION_FOR(TJoinOp::INNER_JOIN); diff --git a/be/src/pipeline/exec/join/left_anti_join_impl.cpp b/be/src/exec/operator/join/left_anti_join_impl.cpp similarity index 91% rename from be/src/pipeline/exec/join/left_anti_join_impl.cpp rename to be/src/exec/operator/join/left_anti_join_impl.cpp index ab6a45442b2815..1b995c500c7fa0 100644 --- a/be/src/pipeline/exec/join/left_anti_join_impl.cpp +++ b/be/src/exec/operator/join/left_anti_join_impl.cpp @@ -17,9 +17,9 @@ #include -#include "process_hash_table_probe_impl.h" +#include "exec/operator/join/process_hash_table_probe_impl.h" -namespace doris::pipeline { +namespace doris { INSTANTIATION_FOR(TJoinOp::LEFT_ANTI_JOIN); diff --git a/be/src/pipeline/exec/join/left_outer_join_impl.cpp b/be/src/exec/operator/join/left_outer_join_impl.cpp similarity index 91% rename from be/src/pipeline/exec/join/left_outer_join_impl.cpp rename to be/src/exec/operator/join/left_outer_join_impl.cpp index 4c8e2c5ac9fefc..6d69f664463930 100644 --- a/be/src/pipeline/exec/join/left_outer_join_impl.cpp +++ b/be/src/exec/operator/join/left_outer_join_impl.cpp @@ -17,9 +17,9 @@ #include -#include "process_hash_table_probe_impl.h" +#include "exec/operator/join/process_hash_table_probe_impl.h" -namespace doris::pipeline { +namespace doris { INSTANTIATION_FOR(TJoinOp::LEFT_OUTER_JOIN); diff --git a/be/src/pipeline/exec/join/left_semi_join_impl.cpp b/be/src/exec/operator/join/left_semi_join_impl.cpp similarity index 91% rename from be/src/pipeline/exec/join/left_semi_join_impl.cpp rename to be/src/exec/operator/join/left_semi_join_impl.cpp index 8365403abfeff5..37975306f6aaf3 100644 --- a/be/src/pipeline/exec/join/left_semi_join_impl.cpp +++ b/be/src/exec/operator/join/left_semi_join_impl.cpp @@ -17,9 +17,9 @@ #include -#include "process_hash_table_probe_impl.h" +#include "exec/operator/join/process_hash_table_probe_impl.h" -namespace doris::pipeline { +namespace doris { INSTANTIATION_FOR(TJoinOp::LEFT_SEMI_JOIN); diff --git a/be/src/pipeline/exec/join/null_aware_left_anti_join_impl.cpp b/be/src/exec/operator/join/null_aware_left_anti_join_impl.cpp similarity index 91% rename from be/src/pipeline/exec/join/null_aware_left_anti_join_impl.cpp rename to be/src/exec/operator/join/null_aware_left_anti_join_impl.cpp index 834335f282f0ad..f26426c6c9a2b4 100644 --- a/be/src/pipeline/exec/join/null_aware_left_anti_join_impl.cpp +++ b/be/src/exec/operator/join/null_aware_left_anti_join_impl.cpp @@ -17,9 +17,9 @@ #include -#include "process_hash_table_probe_impl.h" +#include "exec/operator/join/process_hash_table_probe_impl.h" -namespace doris::pipeline { +namespace doris { INSTANTIATION_FOR(TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN); diff --git a/be/src/pipeline/exec/join/null_aware_left_semi_join_impl.cpp b/be/src/exec/operator/join/null_aware_left_semi_join_impl.cpp similarity index 91% rename from be/src/pipeline/exec/join/null_aware_left_semi_join_impl.cpp rename to be/src/exec/operator/join/null_aware_left_semi_join_impl.cpp index b079a0ec95fa48..bbd9df61ec36e5 100644 --- a/be/src/pipeline/exec/join/null_aware_left_semi_join_impl.cpp +++ b/be/src/exec/operator/join/null_aware_left_semi_join_impl.cpp @@ -17,9 +17,9 @@ #include -#include "process_hash_table_probe_impl.h" +#include "exec/operator/join/process_hash_table_probe_impl.h" -namespace doris::pipeline { +namespace doris { INSTANTIATION_FOR(TJoinOp::NULL_AWARE_LEFT_SEMI_JOIN); diff --git a/be/src/pipeline/exec/join/process_hash_table_probe.h b/be/src/exec/operator/join/process_hash_table_probe.h similarity index 74% rename from be/src/pipeline/exec/join/process_hash_table_probe.h rename to be/src/exec/operator/join/process_hash_table_probe.h index fe18e17e844417..281ef31e7e9ed7 100644 --- a/be/src/pipeline/exec/join/process_hash_table_probe.h +++ b/be/src/exec/operator/join/process_hash_table_probe.h @@ -19,26 +19,23 @@ #include -#include "vec/columns/column.h" -#include "vec/columns/column_vector.h" -#include "vec/common/arena.h" -#include "vec/common/custom_allocator.h" +#include "core/arena.h" +#include "core/column/column.h" +#include "core/column/column_vector.h" +#include "core/custom_allocator.h" namespace doris { -namespace vectorized { class Block; class MutableBlock; struct HashJoinProbeContext; -} // namespace vectorized -namespace pipeline { class HashJoinProbeLocalState; class HashJoinProbeOperatorX; -using MutableColumnPtr = vectorized::IColumn::MutablePtr; -using MutableColumns = std::vector; +using MutableColumnPtr = IColumn::MutablePtr; +using MutableColumns = std::vector; -using NullMap = vectorized::ColumnUInt8::Container; +using NullMap = ColumnUInt8::Container; using ConstNullMapPtr = const NullMap*; template @@ -47,30 +44,30 @@ struct ProcessHashTableProbe { ~ProcessHashTableProbe() = default; // output build side result column - void build_side_output_column(vectorized::MutableColumns& mcol, bool is_mark_join); + void build_side_output_column(MutableColumns& mcol, bool is_mark_join); - void probe_side_output_column(vectorized::MutableColumns& mcol); + void probe_side_output_column(MutableColumns& mcol); // Only process the join with no other join conjunct, because of no other join conjunt // the output block struct is same with mutable block. we can do more opt on it and simplify // the logic of probe template Status process(HashTableType& hash_table_ctx, const uint8_t* null_map, - vectorized::MutableBlock& mutable_block, vectorized::Block* output_block, + MutableBlock& mutable_block, Block* output_block, uint32_t probe_rows, bool is_mark_join); template void process_direct_return(HashTableType& hash_table_ctx, - vectorized::MutableBlock& mutable_block, - vectorized::Block* output_block, uint32_t probe_rows); + MutableBlock& mutable_block, + Block* output_block, uint32_t probe_rows); // In the presence of other join conjunct, the process of join become more complicated. // each matching join column need to be processed by other join conjunct. so the struct of mutable block // and output block may be different // The output result is determined by the other join conjunct result and same_to_prev struct - Status do_other_join_conjuncts(vectorized::Block* output_block, DorisVector& visited); + Status do_other_join_conjuncts(Block* output_block, DorisVector& visited); - Status do_mark_join_conjuncts(vectorized::Block* output_block, const uint8_t* null_map); + Status do_mark_join_conjuncts(Block* output_block, const uint8_t* null_map); // ASOF JOIN optimized: use pre-sorted index to find best match in O(log K) per probe row // Returns the number of matched rows @@ -78,7 +75,7 @@ struct ProcessHashTableProbe { uint32_t _find_batch_asof_optimized(HashTableType& hash_table_ctx, const uint8_t* null_map, uint32_t probe_rows); - Status finalize_block_with_filter(vectorized::Block* output_block, size_t filter_column_id, + Status finalize_block_with_filter(Block* output_block, size_t filter_column_id, size_t column_to_keep); template @@ -88,25 +85,25 @@ struct ProcessHashTableProbe { // Process full outer join/ right join / right semi/anti join to output the join result // in hash table template - Status finish_probing(HashTableType& hash_table_ctx, vectorized::MutableBlock& mutable_block, - vectorized::Block* output_block, bool* eos, bool is_mark_join); + Status finish_probing(HashTableType& hash_table_ctx, MutableBlock& mutable_block, + Block* output_block, bool* eos, bool is_mark_join); /// For null aware join with other conjuncts, if the probe key of one row on left side is null, /// we should make this row match with all rows in build side. uint32_t _process_probe_null_key(uint32_t probe_idx); - pipeline::HashJoinProbeLocalState* _parent = nullptr; - pipeline::HashJoinProbeOperatorX* _parent_operator = nullptr; + HashJoinProbeLocalState* _parent = nullptr; + HashJoinProbeOperatorX* _parent_operator = nullptr; const int _batch_size; - const std::shared_ptr& _build_block; - std::unique_ptr _arena; + const std::shared_ptr& _build_block; + std::unique_ptr _arena; - vectorized::ColumnOffset32 _probe_indexs; - vectorized::ColumnOffset32 _output_row_indexs; + ColumnOffset32 _probe_indexs; + ColumnOffset32 _output_row_indexs; bool _probe_visited = false; bool _picking_null_keys = false; - vectorized::ColumnOffset32 _build_indexs; + ColumnOffset32 _build_indexs; std::vector _null_flags; /// If the probe key of one row on left side is null, @@ -148,5 +145,4 @@ struct ProcessHashTableProbe { DorisVector mark_join_flags; }; -} // namespace pipeline } // namespace doris diff --git a/be/src/pipeline/exec/join/process_hash_table_probe_impl.h b/be/src/exec/operator/join/process_hash_table_probe_impl.h similarity index 86% rename from be/src/pipeline/exec/join/process_hash_table_probe_impl.h rename to be/src/exec/operator/join/process_hash_table_probe_impl.h index 74a4f91fde670a..a065128c4d9d9e 100644 --- a/be/src/pipeline/exec/join/process_hash_table_probe_impl.h +++ b/be/src/exec/operator/join/process_hash_table_probe_impl.h @@ -21,17 +21,17 @@ #include "common/cast_set.h" #include "common/status.h" -#include "pipeline/exec/hashjoin_probe_operator.h" -#include "process_hash_table_probe.h" +#include "core/column/column_const.h" +#include "core/column/column_filter_helper.h" +#include "core/column/column_nullable.h" +#include "core/data_type/data_type_number.h" // IWYU pragma: keep +#include "exec/operator/hashjoin_probe_operator.h" +#include "exec/operator/join/process_hash_table_probe.h" +#include "exprs/vexpr_context.h" #include "runtime/thread_context.h" // IWYU pragma: keep #include "util/simd/bits.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_filter_helper.h" -#include "vec/columns/column_nullable.h" -#include "vec/data_types/data_type_number.h" // IWYU pragma: keep -#include "vec/exprs/vexpr_context.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" static bool check_all_match_one(const auto& vecs) { @@ -59,7 +59,7 @@ static void mock_column_size(auto& col, size_t size) { if (!is_column_const(*col)) { DCHECK(col->empty()); col->insert_default(); - col = vectorized::ColumnConst::create(std::move(col), size); + col = ColumnConst::create(std::move(col), size); } else { col->resize(size); } @@ -97,7 +97,7 @@ ProcessHashTableProbe::ProcessHashTableProbe(HashJoinProbeLocalState } template -void ProcessHashTableProbe::build_side_output_column(vectorized::MutableColumns& mcol, +void ProcessHashTableProbe::build_side_output_column(MutableColumns& mcol, bool is_mark_join) { SCOPED_TIMER(_build_side_output_timer); @@ -116,7 +116,7 @@ void ProcessHashTableProbe::build_side_output_column(vectorized::Mut const auto& column = *_build_block->safe_get_by_position(i).column; _build_column_has_null[i] = false; if (_right_output_slot_flags[i] && column.is_nullable()) { - const auto& nullable = assert_cast(column); + const auto& nullable = assert_cast(column); _build_column_has_null[i] = !simd::contain_one( nullable.get_null_map_data().data() + 1, nullable.size() - 1); } @@ -132,7 +132,7 @@ void ProcessHashTableProbe::build_side_output_column(vectorized::Mut i + (int)_right_col_idx)); if (should_output) { if (!build_index_has_zero && _build_column_has_null[i]) { - assert_cast(mcol[i + _right_col_idx].get()) + assert_cast(mcol[i + _right_col_idx].get()) ->insert_indices_from_not_has_null(column, _build_indexs.get_data().data(), _build_indexs.get_data().data() + size); } else { @@ -146,20 +146,17 @@ void ProcessHashTableProbe::build_side_output_column(vectorized::Mut } if (_parent->_mark_column_id != -1) { // resize mark column and fill with true - auto& mark_column = - assert_cast(*mcol[_parent->_mark_column_id]); + auto& mark_column = assert_cast(*mcol[_parent->_mark_column_id]); mark_column.resize(size); auto* null_map = mark_column.get_null_map_column().get_data().data(); - auto* data = assert_cast(mark_column.get_nested_column()) - .get_data() - .data(); + auto* data = assert_cast(mark_column.get_nested_column()).get_data().data(); std::fill(null_map, null_map + size, 0); std::fill(data, data + size, 1); } } template -void ProcessHashTableProbe::probe_side_output_column(vectorized::MutableColumns& mcol) { +void ProcessHashTableProbe::probe_side_output_column(MutableColumns& mcol) { SCOPED_TIMER(_probe_side_output_timer); auto& probe_block = _parent->_probe_block; bool all_match_one = @@ -264,11 +261,11 @@ uint32_t ProcessHashTableProbe:: probe_block.get_by_position(probe_col_idx).column->convert_to_full_column_if_const(); // Remove nullable wrapper for comparison - keep original for null check - vectorized::ColumnPtr probe_col_for_compare = probe_col_ptr; + ColumnPtr probe_col_for_compare = probe_col_ptr; const uint8_t* asof_probe_null_map = nullptr; if (probe_col_ptr->is_nullable()) { const auto* nullable_probe_col = - assert_cast(probe_col_ptr.get()); + assert_cast(probe_col_ptr.get()); asof_probe_null_map = nullable_probe_col->get_null_map_data().data(); probe_col_for_compare = nullable_probe_col->get_nested_column_ptr(); } @@ -435,7 +432,7 @@ uint32_t ProcessHashTableProbe:: // Dispatch on AsofIndexVariant to get the correct integer type, // then cast probe column to the matching concrete type uint32_t matched_cnt = std::visit( - vectorized::Overload { + Overload { [](std::monostate&) -> uint32_t { throw Exception(ErrorCode::INTERNAL_ERROR, "AsofIndexVariant should not be monostate here"); @@ -443,18 +440,18 @@ uint32_t ProcessHashTableProbe:: [&](std::vector>& groups) -> uint32_t { // DateV2 return probe_with_index( - groups, assert_cast(probe_col)); + groups, assert_cast(probe_col)); }, [&](std::vector>& groups) -> uint32_t { // DateTimeV2 or TimestampTZ if (const auto* c = - vectorized::check_and_get_column( + check_and_get_column( probe_col)) { return probe_with_index(groups, c); } return probe_with_index( groups, - assert_cast(probe_col)); + assert_cast(probe_col)); }}, shared_state->asof_index_groups); @@ -463,9 +460,10 @@ uint32_t ProcessHashTableProbe:: template template -void ProcessHashTableProbe::process_direct_return( - HashTableType& hash_table_ctx, vectorized::MutableBlock& mutable_block, - vectorized::Block* output_block, uint32_t probe_rows) { +void ProcessHashTableProbe::process_direct_return(HashTableType& hash_table_ctx, + MutableBlock& mutable_block, + Block* output_block, + uint32_t probe_rows) { _probe_indexs.resize(probe_rows); auto* probe_indexs_data = _probe_indexs.get_data().data(); for (uint32_t i = 0; i < probe_rows; i++) { @@ -481,8 +479,7 @@ template template Status ProcessHashTableProbe::process(HashTableType& hash_table_ctx, const uint8_t* null_map, - vectorized::MutableBlock& mutable_block, - vectorized::Block* output_block, + MutableBlock& mutable_block, Block* output_block, uint32_t probe_rows, bool is_mark_join) { if (_right_col_len && !_build_block) { return Status::InternalError("build block is nullptr"); @@ -624,18 +621,18 @@ uint32_t ProcessHashTableProbe::_process_probe_null_key(uint32_t pro } template -Status ProcessHashTableProbe::finalize_block_with_filter( - vectorized::Block* output_block, size_t filter_column_id, size_t column_to_keep) { - vectorized::ColumnPtr filter_ptr = output_block->get_by_position(filter_column_id).column; - RETURN_IF_ERROR( - vectorized::Block::filter_block(output_block, filter_column_id, column_to_keep)); +Status ProcessHashTableProbe::finalize_block_with_filter(Block* output_block, + size_t filter_column_id, + size_t column_to_keep) { + ColumnPtr filter_ptr = output_block->get_by_position(filter_column_id).column; + RETURN_IF_ERROR(Block::filter_block(output_block, filter_column_id, column_to_keep)); if (!_parent_operator->can_do_lazy_materialized()) { return Status::OK(); } auto do_lazy_materialize = [&](const std::vector& output_slot_flags, - vectorized::ColumnOffset32& row_indexs, int column_offset, - vectorized::Block* source_block, bool try_all_match_one) { + ColumnOffset32& row_indexs, int column_offset, + Block* source_block, bool try_all_match_one) { std::vector column_ids; for (int i = 0; i < output_slot_flags.size(); ++i) { if (output_slot_flags[i] && @@ -646,8 +643,7 @@ Status ProcessHashTableProbe::finalize_block_with_filter( if (column_ids.empty()) { return; } - const auto& column_filter = - assert_cast(filter_ptr.get())->get_data(); + const auto& column_filter = assert_cast(filter_ptr.get())->get_data(); bool need_filter = simd::contain_zero(column_filter.data(), column_filter.size()); if (need_filter) { row_indexs.filter(column_filter); @@ -658,7 +654,7 @@ Status ProcessHashTableProbe::finalize_block_with_filter( for (int column_id : column_ids) { int output_column_id = column_id + column_offset; output_block->get_by_position(output_column_id).column = - assert_cast( + assert_cast( output_block->get_by_position(output_column_id).column.get()) ->get_data_column_ptr(); @@ -709,7 +705,7 @@ Status ProcessHashTableProbe::finalize_block_with_filter( * So this query will be a "null aware left anti join", which means the equal conjunct's result should be nullable. */ template -Status ProcessHashTableProbe::do_mark_join_conjuncts(vectorized::Block* output_block, +Status ProcessHashTableProbe::do_mark_join_conjuncts(Block* output_block, const uint8_t* null_map) { if (JoinOpType != TJoinOp::LEFT_ANTI_JOIN && JoinOpType != TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN && JoinOpType != TJoinOp::LEFT_SEMI_JOIN && JoinOpType != TJoinOp::NULL_AWARE_LEFT_SEMI_JOIN && @@ -732,12 +728,10 @@ Status ProcessHashTableProbe::do_mark_join_conjuncts(vectorized::Blo auto mark_column_mutable = output_block->get_by_position(_parent->_mark_column_id).column->assume_mutable(); - auto& mark_column = assert_cast(*mark_column_mutable); - vectorized::IColumn::Filter& filter = - assert_cast(mark_column.get_nested_column()).get_data(); - RETURN_IF_ERROR( - vectorized::VExprContext::execute_conjuncts(_parent->_mark_join_conjuncts, output_block, - mark_column.get_null_map_column(), filter)); + auto& mark_column = assert_cast(*mark_column_mutable); + IColumn::Filter& filter = assert_cast(mark_column.get_nested_column()).get_data(); + RETURN_IF_ERROR(VExprContext::execute_conjuncts(_parent->_mark_join_conjuncts, output_block, + mark_column.get_null_map_column(), filter)); uint8_t* mark_filter_data = filter.data(); uint8_t* mark_null_map = mark_column.get_null_map_data().data(); @@ -776,12 +770,12 @@ Status ProcessHashTableProbe::do_mark_join_conjuncts(vectorized::Blo } if (_have_other_join_conjunct) { - vectorized::IColumn::Filter other_conjunct_filter(row_count, 1); + IColumn::Filter other_conjunct_filter(row_count, 1); { bool can_be_filter_all = false; - RETURN_IF_ERROR(vectorized::VExprContext::execute_conjuncts( - _parent->_other_join_conjuncts, nullptr, output_block, &other_conjunct_filter, - &can_be_filter_all)); + RETURN_IF_ERROR(VExprContext::execute_conjuncts(_parent->_other_join_conjuncts, nullptr, + output_block, &other_conjunct_filter, + &can_be_filter_all)); } DCHECK_EQ(filter.size(), other_conjunct_filter.size()); const auto* other_filter_data = other_conjunct_filter.data(); @@ -795,7 +789,7 @@ Status ProcessHashTableProbe::do_mark_join_conjuncts(vectorized::Blo } } - auto filter_column = vectorized::ColumnUInt8::create(row_count, 0); + auto filter_column = ColumnUInt8::create(row_count, 0); auto* __restrict filter_map = filter_column->get_data().data(); for (size_t i = 0; i != row_count; ++i) { if constexpr (is_right_half_join) { @@ -856,14 +850,13 @@ Status ProcessHashTableProbe::do_mark_join_conjuncts(vectorized::Blo } auto result_column_id = output_block->columns(); - output_block->insert( - {std::move(filter_column), std::make_shared(), ""}); + output_block->insert({std::move(filter_column), std::make_shared(), ""}); return finalize_block_with_filter(output_block, result_column_id, result_column_id); } } template -Status ProcessHashTableProbe::do_other_join_conjuncts(vectorized::Block* output_block, +Status ProcessHashTableProbe::do_other_join_conjuncts(Block* output_block, DorisVector& visited) { // dispose the other join conjunct exec auto row_count = output_block->rows(); @@ -873,28 +866,27 @@ Status ProcessHashTableProbe::do_other_join_conjuncts(vectorized::Bl SCOPED_TIMER(_parent->_non_equal_join_conjuncts_timer); size_t orig_columns = output_block->columns(); - vectorized::IColumn::Filter other_conjunct_filter(row_count, 1); + IColumn::Filter other_conjunct_filter(row_count, 1); { bool can_be_filter_all = false; - RETURN_IF_ERROR(vectorized::VExprContext::execute_conjuncts( - _parent->_other_join_conjuncts, nullptr, output_block, &other_conjunct_filter, - &can_be_filter_all)); + RETURN_IF_ERROR(VExprContext::execute_conjuncts(_parent->_other_join_conjuncts, nullptr, + output_block, &other_conjunct_filter, + &can_be_filter_all)); } - auto filter_column = vectorized::ColumnUInt8::create(); + auto filter_column = ColumnUInt8::create(); filter_column->get_data() = std::move(other_conjunct_filter); auto result_column_id = output_block->columns(); - output_block->insert( - {std::move(filter_column), std::make_shared(), ""}); + output_block->insert({std::move(filter_column), std::make_shared(), ""}); uint8_t* __restrict filter_column_ptr = - assert_cast( + assert_cast( output_block->get_by_position(result_column_id).column->assume_mutable_ref()) .get_data() .data(); if constexpr (JoinOpType == TJoinOp::LEFT_OUTER_JOIN || JoinOpType == TJoinOp::FULL_OUTER_JOIN) { - auto new_filter_column = vectorized::ColumnUInt8::create(row_count); + auto new_filter_column = ColumnUInt8::create(row_count); auto* __restrict filter_map = new_filter_column->get_data().data(); // process equal-conjuncts-matched tuples that are newly generated @@ -924,7 +916,7 @@ Status ProcessHashTableProbe::do_other_join_conjuncts(vectorized::Bl } else if constexpr (JoinOpType == TJoinOp::LEFT_ANTI_JOIN || JoinOpType == TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN || JoinOpType == TJoinOp::LEFT_SEMI_JOIN) { - auto new_filter_column = vectorized::ColumnUInt8::create(row_count); + auto new_filter_column = ColumnUInt8::create(row_count); auto* __restrict filter_map = new_filter_column->get_data().data(); for (size_t i = 0; i < row_count; ++i) { @@ -982,15 +974,15 @@ Status ProcessHashTableProbe::do_other_join_conjuncts(vectorized::Bl template template Status ProcessHashTableProbe::finish_probing(HashTableType& hash_table_ctx, - vectorized::MutableBlock& mutable_block, - vectorized::Block* output_block, bool* eos, + MutableBlock& mutable_block, + Block* output_block, bool* eos, bool is_mark_join) { SCOPED_TIMER(_finish_probe_phase_timer); auto& mcol = mutable_block.mutable_columns(); if (is_mark_join) { - std::unique_ptr mark_column = - std::make_unique(*mcol[mcol.size() - 1]); + std::unique_ptr mark_column = + std::make_unique(*mcol[mcol.size() - 1]); *eos = hash_table_ctx.hash_table->template iterate_map(_build_indexs, mark_column.get()); } else { @@ -1026,11 +1018,11 @@ Status ProcessHashTableProbe::finish_probing(HashTableType& hash_tab } // mark column is nullable - auto* mark_column = assert_cast( - mcol[_parent->_mark_column_id].get()); + auto* mark_column = + assert_cast(mcol[_parent->_mark_column_id].get()); mark_column->resize(block_size); auto* null_map = mark_column->get_null_map_data().data(); - auto* data = assert_cast(mark_column->get_nested_column()) + auto* data = assert_cast(mark_column->get_nested_column()) .get_data() .data(); for (size_t i = 0; i != block_size; ++i) { @@ -1052,8 +1044,7 @@ Status ProcessHashTableProbe::finish_probing(HashTableType& hash_tab if constexpr (JoinOpType == TJoinOp::RIGHT_OUTER_JOIN || JoinOpType == TJoinOp::FULL_OUTER_JOIN) { for (int i = 0; i < _right_col_idx; ++i) { - assert_cast(mcol[i].get()) - ->insert_many_defaults(block_size); + assert_cast(mcol[i].get())->insert_many_defaults(block_size); } } output_block->swap(mutable_block.to_block(0)); @@ -1073,38 +1064,38 @@ struct ExtractType { #define INSTANTIATION(JoinOpType, T) \ template Status ProcessHashTableProbe::process::Type>( \ ExtractType::Type & hash_table_ctx, const uint8_t* null_map, \ - vectorized::MutableBlock& mutable_block, vectorized::Block* output_block, \ - uint32_t probe_rows, bool is_mark_join); \ + MutableBlock& mutable_block, Block* output_block, uint32_t probe_rows, \ + bool is_mark_join); \ template void \ ProcessHashTableProbe::process_direct_return::Type>( \ - ExtractType::Type & hash_table_ctx, vectorized::MutableBlock & mutable_block, \ - vectorized::Block * output_block, uint32_t probe_rows); \ + ExtractType::Type & hash_table_ctx, MutableBlock & mutable_block, \ + Block * output_block, uint32_t probe_rows); \ template Status ProcessHashTableProbe::finish_probing::Type>( \ - ExtractType::Type & hash_table_ctx, vectorized::MutableBlock & mutable_block, \ - vectorized::Block * output_block, bool* eos, bool is_mark_join); - -#define INSTANTIATION_FOR(JoinOpType) \ - template struct ProcessHashTableProbe; \ - \ - INSTANTIATION(JoinOpType, (SerializedHashTableContext)); \ - INSTANTIATION(JoinOpType, (DirectPrimaryTypeHashTableContext)); \ - INSTANTIATION(JoinOpType, (DirectPrimaryTypeHashTableContext)); \ - INSTANTIATION(JoinOpType, (DirectPrimaryTypeHashTableContext)); \ - INSTANTIATION(JoinOpType, (DirectPrimaryTypeHashTableContext)); \ - INSTANTIATION(JoinOpType, (DirectPrimaryTypeHashTableContext)); \ - INSTANTIATION(JoinOpType, (PrimaryTypeHashTableContext)); \ - INSTANTIATION(JoinOpType, (PrimaryTypeHashTableContext)); \ - INSTANTIATION(JoinOpType, (PrimaryTypeHashTableContext)); \ - INSTANTIATION(JoinOpType, (PrimaryTypeHashTableContext)); \ - INSTANTIATION(JoinOpType, (PrimaryTypeHashTableContext)); \ - INSTANTIATION(JoinOpType, (PrimaryTypeHashTableContext)); \ - INSTANTIATION(JoinOpType, (FixedKeyHashTableContext)); \ - INSTANTIATION(JoinOpType, (FixedKeyHashTableContext)); \ - INSTANTIATION(JoinOpType, (FixedKeyHashTableContext)); \ - INSTANTIATION(JoinOpType, (FixedKeyHashTableContext)); \ - INSTANTIATION(JoinOpType, (FixedKeyHashTableContext)); \ - INSTANTIATION(JoinOpType, (FixedKeyHashTableContext)); \ - INSTANTIATION(JoinOpType, (FixedKeyHashTableContext)); \ + ExtractType::Type & hash_table_ctx, MutableBlock & mutable_block, \ + Block * output_block, bool* eos, bool is_mark_join); + +#define INSTANTIATION_FOR(JoinOpType) \ + template struct ProcessHashTableProbe; \ + \ + INSTANTIATION(JoinOpType, (SerializedHashTableContext)); \ + INSTANTIATION(JoinOpType, (DirectPrimaryTypeHashTableContext)); \ + INSTANTIATION(JoinOpType, (DirectPrimaryTypeHashTableContext)); \ + INSTANTIATION(JoinOpType, (DirectPrimaryTypeHashTableContext)); \ + INSTANTIATION(JoinOpType, (DirectPrimaryTypeHashTableContext)); \ + INSTANTIATION(JoinOpType, (DirectPrimaryTypeHashTableContext)); \ + INSTANTIATION(JoinOpType, (PrimaryTypeHashTableContext)); \ + INSTANTIATION(JoinOpType, (PrimaryTypeHashTableContext)); \ + INSTANTIATION(JoinOpType, (PrimaryTypeHashTableContext)); \ + INSTANTIATION(JoinOpType, (PrimaryTypeHashTableContext)); \ + INSTANTIATION(JoinOpType, (PrimaryTypeHashTableContext)); \ + INSTANTIATION(JoinOpType, (PrimaryTypeHashTableContext)); \ + INSTANTIATION(JoinOpType, (FixedKeyHashTableContext)); \ + INSTANTIATION(JoinOpType, (FixedKeyHashTableContext)); \ + INSTANTIATION(JoinOpType, (FixedKeyHashTableContext)); \ + INSTANTIATION(JoinOpType, (FixedKeyHashTableContext)); \ + INSTANTIATION(JoinOpType, (FixedKeyHashTableContext)); \ + INSTANTIATION(JoinOpType, (FixedKeyHashTableContext)); \ + INSTANTIATION(JoinOpType, (FixedKeyHashTableContext)); \ INSTANTIATION(JoinOpType, (MethodOneString)); #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/join/right_anti_join_impl.cpp b/be/src/exec/operator/join/right_anti_join_impl.cpp similarity index 91% rename from be/src/pipeline/exec/join/right_anti_join_impl.cpp rename to be/src/exec/operator/join/right_anti_join_impl.cpp index e3cc943bf3b3ec..95fb92c826bf48 100644 --- a/be/src/pipeline/exec/join/right_anti_join_impl.cpp +++ b/be/src/exec/operator/join/right_anti_join_impl.cpp @@ -17,9 +17,9 @@ #include -#include "process_hash_table_probe_impl.h" +#include "exec/operator/join/process_hash_table_probe_impl.h" -namespace doris::pipeline { +namespace doris { INSTANTIATION_FOR(TJoinOp::RIGHT_ANTI_JOIN); diff --git a/be/src/pipeline/exec/join/right_outer_join_impl.cpp b/be/src/exec/operator/join/right_outer_join_impl.cpp similarity index 91% rename from be/src/pipeline/exec/join/right_outer_join_impl.cpp rename to be/src/exec/operator/join/right_outer_join_impl.cpp index 65c6eaaab18d10..4f48f715f5e439 100644 --- a/be/src/pipeline/exec/join/right_outer_join_impl.cpp +++ b/be/src/exec/operator/join/right_outer_join_impl.cpp @@ -17,9 +17,9 @@ #include -#include "process_hash_table_probe_impl.h" +#include "exec/operator/join/process_hash_table_probe_impl.h" -namespace doris::pipeline { +namespace doris { INSTANTIATION_FOR(TJoinOp::RIGHT_OUTER_JOIN); diff --git a/be/src/pipeline/exec/join/right_semi_join_impl.cpp b/be/src/exec/operator/join/right_semi_join_impl.cpp similarity index 91% rename from be/src/pipeline/exec/join/right_semi_join_impl.cpp rename to be/src/exec/operator/join/right_semi_join_impl.cpp index f89826d8845f44..be46fbfce92eb9 100644 --- a/be/src/pipeline/exec/join/right_semi_join_impl.cpp +++ b/be/src/exec/operator/join/right_semi_join_impl.cpp @@ -17,9 +17,9 @@ #include -#include "process_hash_table_probe_impl.h" +#include "exec/operator/join/process_hash_table_probe_impl.h" -namespace doris::pipeline { +namespace doris { INSTANTIATION_FOR(TJoinOp::RIGHT_SEMI_JOIN); diff --git a/be/src/pipeline/exec/join_build_sink_operator.cpp b/be/src/exec/operator/join_build_sink_operator.cpp similarity index 95% rename from be/src/pipeline/exec/join_build_sink_operator.cpp rename to be/src/exec/operator/join_build_sink_operator.cpp index fb9cc718232693..150840a05fa1fd 100644 --- a/be/src/pipeline/exec/join_build_sink_operator.cpp +++ b/be/src/exec/operator/join_build_sink_operator.cpp @@ -15,14 +15,14 @@ // specific language governing permissions and limitations // under the License. -#include "join_build_sink_operator.h" +#include "exec/operator/join_build_sink_operator.h" -#include "pipeline/exec/hashjoin_build_sink.h" -#include "pipeline/exec/nested_loop_join_build_operator.h" -#include "pipeline/exec/operator.h" -#include "pipeline/exec/partitioned_hash_join_sink_operator.h" +#include "exec/operator/hashjoin_build_sink.h" +#include "exec/operator/nested_loop_join_build_operator.h" +#include "exec/operator/operator.h" +#include "exec/operator/partitioned_hash_join_sink_operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" template Status JoinBuildSinkLocalState::init(RuntimeState* state, @@ -125,4 +125,4 @@ template class JoinBuildSinkOperatorX; template class JoinBuildSinkLocalState; -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/join_build_sink_operator.h b/be/src/exec/operator/join_build_sink_operator.h similarity index 97% rename from be/src/pipeline/exec/join_build_sink_operator.h rename to be/src/exec/operator/join_build_sink_operator.h index 93f4e5c11c296f..c097e69cca99aa 100644 --- a/be/src/pipeline/exec/join_build_sink_operator.h +++ b/be/src/exec/operator/join_build_sink_operator.h @@ -17,9 +17,9 @@ #pragma once -#include "operator.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" template class JoinBuildSinkOperatorX; @@ -72,4 +72,4 @@ class JoinBuildSinkOperatorX : public DataSinkOperatorX { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/join_probe_operator.cpp b/be/src/exec/operator/join_probe_operator.cpp similarity index 92% rename from be/src/pipeline/exec/join_probe_operator.cpp rename to be/src/exec/operator/join_probe_operator.cpp index 1d25460c04e565..29ee21c80fd9f7 100644 --- a/be/src/pipeline/exec/join_probe_operator.cpp +++ b/be/src/exec/operator/join_probe_operator.cpp @@ -15,16 +15,16 @@ // specific language governing permissions and limitations // under the License. -#include "join_probe_operator.h" +#include "exec/operator/join_probe_operator.h" #include -#include "pipeline/exec/hashjoin_probe_operator.h" -#include "pipeline/exec/nested_loop_join_probe_operator.h" -#include "pipeline/exec/operator.h" -#include "pipeline/exec/partitioned_hash_join_probe_operator.h" +#include "exec/operator/hashjoin_probe_operator.h" +#include "exec/operator/nested_loop_join_probe_operator.h" +#include "exec/operator/operator.h" +#include "exec/operator/partitioned_hash_join_probe_operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" template Status JoinProbeLocalState::init(RuntimeState* state, @@ -64,17 +64,17 @@ void JoinProbeLocalState::_construct_mutable_join_block if (p._is_mark_join) { _mark_column_id = _join_block.columns() - 1; #ifndef NDEBUG - const auto& mark_column = assert_cast( + const auto& mark_column = assert_cast( *_join_block.get_by_position(_mark_column_id).column); auto& nested_column = mark_column.get_nested_column(); - DCHECK(check_and_get_column(nested_column) != nullptr); + DCHECK(check_and_get_column(nested_column) != nullptr); #endif } } template -Status JoinProbeLocalState::_build_output_block( - vectorized::Block* origin_block, vectorized::Block* output_block) { +Status JoinProbeLocalState::_build_output_block(Block* origin_block, + Block* output_block) { if (!output_block->mem_reuse()) { output_block->swap(origin_block->clone_empty()); } @@ -143,4 +143,4 @@ template class JoinProbeLocalState; template class JoinProbeOperatorX; -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/join_probe_operator.h b/be/src/exec/operator/join_probe_operator.h similarity index 91% rename from be/src/pipeline/exec/join_probe_operator.h rename to be/src/exec/operator/join_probe_operator.h index 705d319efb4d23..8cd83f3a1ea72c 100644 --- a/be/src/pipeline/exec/join_probe_operator.h +++ b/be/src/exec/operator/join_probe_operator.h @@ -17,9 +17,9 @@ #pragma once -#include "operator.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" template class JoinProbeOperatorX; @@ -34,12 +34,12 @@ class JoinProbeLocalState : public PipelineXLocalState { template friend class StatefulOperatorX; JoinProbeLocalState(RuntimeState* state, OperatorXBase* parent) - : Base(state, parent), _child_block(vectorized::Block::create_unique()) {} + : Base(state, parent), _child_block(Block::create_unique()) {} ~JoinProbeLocalState() override = default; void _construct_mutable_join_block(); - Status _build_output_block(vectorized::Block* origin_block, vectorized::Block* output_block); + Status _build_output_block(Block* origin_block, Block* output_block); // output expr - vectorized::Block _join_block; + Block _join_block; size_t _mark_column_id = -1; @@ -49,7 +49,7 @@ class JoinProbeLocalState : public PipelineXLocalState { RuntimeProfile::Counter* _build_output_block_timer = nullptr; RuntimeProfile::Counter* _finish_probe_phase_timer = nullptr; - std::unique_ptr _child_block = nullptr; + std::unique_ptr _child_block = nullptr; bool _child_eos = false; }; @@ -109,4 +109,4 @@ class JoinProbeOperatorX : public StatefulOperatorX { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/local_merge_sort_source_operator.cpp b/be/src/exec/operator/local_merge_sort_source_operator.cpp similarity index 85% rename from be/src/pipeline/exec/local_merge_sort_source_operator.cpp rename to be/src/exec/operator/local_merge_sort_source_operator.cpp index bcd8cafdbbd538..07ee373fd9cf3e 100644 --- a/be/src/pipeline/exec/local_merge_sort_source_operator.cpp +++ b/be/src/exec/operator/local_merge_sort_source_operator.cpp @@ -15,15 +15,15 @@ // specific language governing permissions and limitations // under the License. -#include "local_merge_sort_source_operator.h" +#include "exec/operator/local_merge_sort_source_operator.h" #include #include -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" LocalMergeSortLocalState::LocalMergeSortLocalState(RuntimeState* state, OperatorXBase* parent) @@ -60,19 +60,18 @@ std::vector LocalMergeSortLocalState::dependencies() const { Status LocalMergeSortLocalState::build_merger(RuntimeState* state) { auto& p = _parent->cast(); - vectorized::VExprContextSPtrs ordering_expr_ctxs; + VExprContextSPtrs ordering_expr_ctxs; ordering_expr_ctxs.resize(p._vsort_exec_exprs.ordering_expr_ctxs().size()); for (size_t i = 0; i < ordering_expr_ctxs.size(); i++) { RETURN_IF_ERROR( p._vsort_exec_exprs.ordering_expr_ctxs()[i]->clone(state, ordering_expr_ctxs[i])); } - _merger = std::make_unique(ordering_expr_ctxs, p._is_asc_order, - p._nulls_first, state->batch_size(), - p._limit, p._offset, custom_profile()); - std::vector child_block_suppliers; + _merger = std::make_unique(ordering_expr_ctxs, p._is_asc_order, + p._nulls_first, state->batch_size(), p._limit, + p._offset, custom_profile()); + std::vector child_block_suppliers; for (auto sorter : p._sorters) { - vectorized::BlockSupplier block_supplier = [sorter, state](vectorized::Block* block, - bool* eos) { + BlockSupplier block_supplier = [sorter, state](Block* block, bool* eos) { return sorter->get_next(state, block, eos); }; child_block_suppliers.push_back(block_supplier); @@ -116,8 +115,7 @@ void LocalMergeSortSourceOperatorX::init_dependencies_and_sorter() { _sorters.resize(_parallel_tasks); } -Status LocalMergeSortSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* block, - bool* eos) { +Status LocalMergeSortSourceOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); SCOPED_PEAK_MEM(&local_state._estimate_memory_usage); @@ -131,8 +129,8 @@ Status LocalMergeSortSourceOperatorX::get_block(RuntimeState* state, vectorized: return Status::OK(); } -Status LocalMergeSortSourceOperatorX::main_source_get_block(RuntimeState* state, - vectorized::Block* block, bool* eos) { +Status LocalMergeSortSourceOperatorX::main_source_get_block(RuntimeState* state, Block* block, + bool* eos) { auto& local_state = get_local_state(state); if (local_state._merger == nullptr) { // Since we cannot control the initialization order of different local states, we set the sorter to the operator during execution. @@ -143,8 +141,8 @@ Status LocalMergeSortSourceOperatorX::main_source_get_block(RuntimeState* state, return Status::OK(); } -Status LocalMergeSortSourceOperatorX::other_source_get_block(RuntimeState* state, - vectorized::Block* block, bool* eos) { +Status LocalMergeSortSourceOperatorX::other_source_get_block(RuntimeState* state, Block* block, + bool* eos) { auto& local_state = get_local_state(state); DCHECK(_other_source_deps[local_state._task_idx] != nullptr); // Since we cannot control the initialization order of different local states, we set the sorter to the operator during execution. @@ -156,4 +154,4 @@ Status LocalMergeSortSourceOperatorX::other_source_get_block(RuntimeState* state } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/local_merge_sort_source_operator.h b/be/src/exec/operator/local_merge_sort_source_operator.h similarity index 89% rename from be/src/pipeline/exec/local_merge_sort_source_operator.h rename to be/src/exec/operator/local_merge_sort_source_operator.h index 0e55ce10e71820..4944ded203002c 100644 --- a/be/src/pipeline/exec/local_merge_sort_source_operator.h +++ b/be/src/exec/operator/local_merge_sort_source_operator.h @@ -20,15 +20,13 @@ #include #include "common/status.h" -#include "operator.h" -#include "pipeline/dependency.h" +#include "exec/operator/operator.h" +#include "exec/pipeline/dependency.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace pipeline { - // The LocalMergeSortSourceOperatorX is an operator that performs merge sort locally. // If there is an instance, it will only operate in one instance (referred to as the main source below), // while the other instances will directly return EOS (referred to as other sources below). @@ -72,7 +70,7 @@ class LocalMergeSortLocalState final : public PipelineXLocalState _merger = nullptr; + std::unique_ptr _merger = nullptr; }; class LocalMergeSortSourceOperatorX final : public OperatorX { @@ -85,7 +83,7 @@ class LocalMergeSortSourceOperatorX final : public OperatorX _is_asc_order; std::vector _nulls_first; - vectorized::VSortExecExprs _vsort_exec_exprs; + VSortExecExprs _vsort_exec_exprs; const int64_t _offset; std::vector _other_source_deps; // The sorters of all instances are used in the main source. - std::vector> _sorters; + std::vector> _sorters; }; -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/pipeline/exec/materialization_opertor.cpp b/be/src/exec/operator/materialization_opertor.cpp similarity index 91% rename from be/src/pipeline/exec/materialization_opertor.cpp rename to be/src/exec/operator/materialization_opertor.cpp index c2030adb4aecb4..cc76a731c71eea 100644 --- a/be/src/pipeline/exec/materialization_opertor.cpp +++ b/be/src/exec/operator/materialization_opertor.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/exec/materialization_opertor.h" +#include "exec/operator/materialization_opertor.h" #include #include @@ -24,18 +24,17 @@ #include #include "common/status.h" +#include "core/block/block.h" +#include "core/column/column.h" +#include "exec/operator/operator.h" #include "exec/rowid_fetcher.h" -#include "pipeline/exec/operator.h" +#include "exec/scan/file_scanner.h" #include "util/brpc_client_cache.h" #include "util/brpc_closure.h" -#include "vec/columns/column.h" -#include "vec/core/block.h" -#include "vec/exec/scan/file_scanner.h" namespace doris { -namespace pipeline { -void MaterializationSharedState::get_block(vectorized::Block* block) { +void MaterializationSharedState::get_block(Block* block) { for (int i = 0, j = 0, rowid_to_block_loc = rowid_locs[j]; i < origin_block.columns(); i++) { if (i != rowid_to_block_loc) { block->insert(origin_block.get_by_position(i)); @@ -62,9 +61,9 @@ Status MaterializationSharedState::merge_multi_response() { // Keeping block_maps across iterations would leave stale entries from the previous // relation and miss entries for the current one, causing the // "backend_id not found in block_maps" error. - std::unordered_map> block_maps; + std::unordered_map> block_maps; for (auto& [backend_id, rpc_struct] : rpc_struct_map) { - vectorized::Block partial_block; + Block partial_block; size_t uncompressed_size = 0; int64_t uncompressed_time = 0; DCHECK(rpc_struct.response.blocks_size() > i); @@ -140,26 +139,26 @@ void MaterializationSharedState::_update_profile_info(int64_t backend_id, update_profile_info_key(RowIdStorageReader::InitReaderAvgTimeProfile); update_profile_info_key(RowIdStorageReader::GetBlockAvgTimeProfile); update_profile_info_key(RowIdStorageReader::FileReadLinesProfile); - update_profile_info_key(vectorized::FileScanner::FileReadBytesProfile); - update_profile_info_key(vectorized::FileScanner::FileReadTimeProfile); + update_profile_info_key(FileScanner::FileReadBytesProfile); + update_profile_info_key(FileScanner::FileReadTimeProfile); } -Status MaterializationSharedState::create_muiltget_result(const vectorized::Columns& columns, +Status MaterializationSharedState::create_muiltget_result(const Columns& columns, bool child_eos, bool gc_id_map) { const auto rows = columns.empty() ? 0 : columns[0]->size(); block_order_results.resize(columns.size()); for (int i = 0; i < columns.size(); ++i) { const uint8_t* null_map = nullptr; - const vectorized::ColumnString* column_rowid = nullptr; + const ColumnString* column_rowid = nullptr; auto& column = columns[i]; - if (auto column_ptr = check_and_get_column(*column)) { + if (auto column_ptr = check_and_get_column(*column)) { null_map = column_ptr->get_null_map_data().data(); - column_rowid = assert_cast( + column_rowid = assert_cast( column_ptr->get_nested_column_ptr().get()); } else { - column_rowid = assert_cast(column.get()); + column_rowid = assert_cast(column.get()); } auto& block_order = block_order_results[i]; @@ -225,7 +224,7 @@ Status MaterializationSharedState::init_multi_requests( state->desc_tbl().get_tuple_descriptor(materialization_node.intermediate_tuple_id); const auto& slots = tuple_desc->slots(); response_blocks = - std::vector(materialization_node.column_descs_lists.size()); + std::vector(materialization_node.column_descs_lists.size()); for (int i = 0; i < materialization_node.column_descs_lists.size(); ++i) { auto request_block_desc = multi_get_request.add_request_block_descs(); @@ -249,7 +248,7 @@ Status MaterializationSharedState::init_multi_requests( slots[slot_loc_item]->to_protobuf(request_block_desc->add_slots()); slots_res.emplace_back(slots[slot_loc_item]); } - response_blocks[i] = vectorized::MutableBlock(vectorized::Block(slots_res, 10)); + response_blocks[i] = MutableBlock(Block(slots_res, 10)); } // Initialize the stubs and requests for each BE @@ -279,14 +278,14 @@ Status MaterializationOperator::init(const doris::TPlanNode& tnode, doris::Runti _gc_id_map = tnode.materialization_node.gc_id_map; // Create result_expr_ctx_lists_ from thrift exprs. auto& fetch_expr_lists = tnode.materialization_node.fetch_expr_lists; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(fetch_expr_lists, _rowid_exprs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(fetch_expr_lists, _rowid_exprs)); return Status::OK(); } Status MaterializationOperator::prepare(RuntimeState* state) { RETURN_IF_ERROR(Base::prepare(state)); - RETURN_IF_ERROR(vectorized::VExpr::prepare(_rowid_exprs, state, _child->row_desc())); - RETURN_IF_ERROR(vectorized::VExpr::open(_rowid_exprs, state)); + RETURN_IF_ERROR(VExpr::prepare(_rowid_exprs, state, _child->row_desc())); + RETURN_IF_ERROR(VExpr::open(_rowid_exprs, state)); return Status::OK(); } @@ -296,7 +295,7 @@ bool MaterializationOperator::need_more_input_data(RuntimeState* state) const { !local_state._materialization_state.eos; } -Status MaterializationOperator::pull(RuntimeState* state, vectorized::Block* output_block, +Status MaterializationOperator::pull(RuntimeState* state, Block* output_block, bool* eos) const { auto& local_state = get_local_state(state); output_block->clear(); @@ -321,7 +320,7 @@ Status MaterializationOperator::pull(RuntimeState* state, vectorized::Block* out return Status::OK(); } -Status MaterializationOperator::push(RuntimeState* state, vectorized::Block* in_block, +Status MaterializationOperator::push(RuntimeState* state, Block* in_block, bool eos) const { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); @@ -332,7 +331,7 @@ Status MaterializationOperator::push(RuntimeState* state, vectorized::Block* in_ if (in_block->rows() > 0 || eos) { // execute the rowid exprs - vectorized::Columns columns; + Columns columns; if (in_block->rows() != 0) { local_state._materialization_state.rowid_locs.resize(_rowid_exprs.size()); for (int i = 0; i < _rowid_exprs.size(); ++i) { @@ -385,5 +384,4 @@ Status MaterializationOperator::push(RuntimeState* state, vectorized::Block* in_ return Status::OK(); } -} // namespace pipeline } // namespace doris diff --git a/be/src/pipeline/exec/materialization_opertor.h b/be/src/exec/operator/materialization_opertor.h similarity index 87% rename from be/src/pipeline/exec/materialization_opertor.h rename to be/src/exec/operator/materialization_opertor.h index a456374d09f939..8973b20c23588c 100644 --- a/be/src/pipeline/exec/materialization_opertor.h +++ b/be/src/exec/operator/materialization_opertor.h @@ -20,14 +20,12 @@ #include #include "common/status.h" -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace pipeline { - class MaterializationOperator; struct FetchRpcStruct { @@ -42,10 +40,10 @@ struct MaterializationSharedState { MaterializationSharedState() = default; Status init_multi_requests(const TMaterializationNode& tnode, RuntimeState* state); - Status create_muiltget_result(const vectorized::Columns& columns, bool eos, bool gc_id_map); + Status create_muiltget_result(const Columns& columns, bool eos, bool gc_id_map); Status merge_multi_response(); - void get_block(vectorized::Block* block); + void get_block(Block* block); private: void _update_profile_info(int64_t backend_id, RuntimeProfile* response_profile); @@ -56,10 +54,10 @@ struct MaterializationSharedState { bool eos = false; // empty materialization sink block not need to merge block bool need_merge_block = true; - vectorized::Block origin_block; + Block origin_block; // The rowid column of the origin block. should be replaced by the column of the result block. std::vector rowid_locs; - std::vector response_blocks; + std::vector response_blocks; std::map rpc_struct_map; // Register each line in which block to ensure the order of the result. // Zero means NULL value. @@ -95,7 +93,7 @@ class MaterializationLocalState final : public PipelineXLocalState friend class StatefulOperatorX; - std::unique_ptr _child_block = vectorized::Block::create_unique(); + std::unique_ptr _child_block = Block::create_unique(); bool _child_eos = false; MaterializationSharedState _materialization_state; RuntimeProfile::Counter* _max_rpc_timer = nullptr; @@ -116,18 +114,17 @@ class MaterializationOperator final : public StatefulOperatorX { +class MCTableSinkLocalState final : public AsyncWriterSink { public: - using Base = AsyncWriterSink; + using Base = AsyncWriterSink; using Parent = MCTableSinkOperatorX; ENABLE_FACTORY_CREATOR(MCTableSinkLocalState); MCTableSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state) @@ -54,17 +53,17 @@ class MCTableSinkOperatorX final : public DataSinkOperatorXrows()); @@ -74,13 +73,13 @@ class MCTableSinkOperatorX final : public DataSinkOperatorX - requires(std::is_base_of_v) + requires(std::is_base_of_v) friend class AsyncWriterSink; const RowDescriptor& _row_desc; - vectorized::VExprContextSPtrs _output_vexpr_ctxs; + VExprContextSPtrs _output_vexpr_ctxs; const std::vector& _t_output_expr; ObjectPool* _pool = nullptr; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/memory_scratch_sink_operator.cpp b/be/src/exec/operator/memory_scratch_sink_operator.cpp similarity index 85% rename from be/src/pipeline/exec/memory_scratch_sink_operator.cpp rename to be/src/exec/operator/memory_scratch_sink_operator.cpp index e45f4a982c7549..917d54da763a12 100644 --- a/be/src/pipeline/exec/memory_scratch_sink_operator.cpp +++ b/be/src/exec/operator/memory_scratch_sink_operator.cpp @@ -15,19 +15,19 @@ // specific language governing permissions and limitations // under the License. -#include "memory_scratch_sink_operator.h" +#include "exec/operator/memory_scratch_sink_operator.h" #include #include "common/object_pool.h" -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" +#include "format/arrow/arrow_block_convertor.h" +#include "format/arrow/arrow_row_batch.h" #include "runtime/record_batch_queue.h" -#include "util/arrow/block_convertor.h" -#include "util/arrow/row_batch.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" Status MemoryScratchSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& info) { RETURN_IF_ERROR(Base::init(state, info)); @@ -75,20 +75,19 @@ MemoryScratchSinkOperatorX::MemoryScratchSinkOperatorX(const RowDescriptor& row_ Status MemoryScratchSinkOperatorX::init(const TDataSink& thrift_sink) { RETURN_IF_ERROR(DataSinkOperatorX::init(thrift_sink)); // From the thrift expressions create the real exprs. - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(_t_output_expr, _output_vexpr_ctxs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(_t_output_expr, _output_vexpr_ctxs)); return Status::OK(); } Status MemoryScratchSinkOperatorX::prepare(RuntimeState* state) { RETURN_IF_ERROR(DataSinkOperatorX::prepare(state)); - RETURN_IF_ERROR(vectorized::VExpr::prepare(_output_vexpr_ctxs, state, _row_desc)); + RETURN_IF_ERROR(VExpr::prepare(_output_vexpr_ctxs, state, _row_desc)); _timezone_obj = state->timezone_obj(); - RETURN_IF_ERROR(vectorized::VExpr::open(_output_vexpr_ctxs, state)); + RETURN_IF_ERROR(VExpr::open(_output_vexpr_ctxs, state)); return Status::OK(); } -Status MemoryScratchSinkOperatorX::sink(RuntimeState* state, vectorized::Block* input_block, - bool eos) { +Status MemoryScratchSinkOperatorX::sink(RuntimeState* state, Block* input_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); if (nullptr == input_block || 0 == input_block->rows()) { @@ -98,10 +97,10 @@ Status MemoryScratchSinkOperatorX::sink(RuntimeState* state, vectorized::Block* std::shared_ptr result; // Exec vectorized expr here to speed up, block.rows() == 0 means expr exec // failed, just return the error status - vectorized::Block block; + Block block; { SCOPED_TIMER(local_state._evaluation_timer); - RETURN_IF_ERROR(vectorized::VExprContext::get_output_block_after_execute_exprs( + RETURN_IF_ERROR(VExprContext::get_output_block_after_execute_exprs( local_state._output_vexpr_ctxs, *input_block, &block)); } std::shared_ptr block_arrow_schema; @@ -122,4 +121,4 @@ Status MemoryScratchSinkOperatorX::sink(RuntimeState* state, vectorized::Block* return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/memory_scratch_sink_operator.h b/be/src/exec/operator/memory_scratch_sink_operator.h similarity index 90% rename from be/src/pipeline/exec/memory_scratch_sink_operator.h rename to be/src/exec/operator/memory_scratch_sink_operator.h index 6b5c15feed78f4..03ec59647a917d 100644 --- a/be/src/pipeline/exec/memory_scratch_sink_operator.h +++ b/be/src/exec/operator/memory_scratch_sink_operator.h @@ -19,10 +19,10 @@ #include -#include "operator.h" +#include "exec/operator/operator.h" #include "runtime/result_queue_mgr.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class MemoryScratchSinkOperatorX; @@ -43,7 +43,7 @@ class MemoryScratchSinkLocalState final : public PipelineXSinkLocalState _queue_dependency = nullptr; RuntimeProfile::Counter* _get_arrow_schema_timer = nullptr; @@ -58,15 +58,15 @@ class MemoryScratchSinkOperatorX final : public DataSinkOperatorX& _t_output_expr; - vectorized::VExprContextSPtrs _output_vexpr_ctxs; + VExprContextSPtrs _output_vexpr_ctxs; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/meta_scan_operator.cpp b/be/src/exec/operator/meta_scan_operator.cpp similarity index 80% rename from be/src/pipeline/exec/meta_scan_operator.cpp rename to be/src/exec/operator/meta_scan_operator.cpp index bf6a4ff550954e..0920432b640f34 100644 --- a/be/src/pipeline/exec/meta_scan_operator.cpp +++ b/be/src/exec/operator/meta_scan_operator.cpp @@ -15,13 +15,13 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/exec/meta_scan_operator.h" +#include "exec/operator/meta_scan_operator.h" -#include "vec/exec/scan/meta_scanner.h" +#include "exec/scan/meta_scanner.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" -Status MetaScanLocalState::_init_scanners(std::list* scanners) { +Status MetaScanLocalState::_init_scanners(std::list* scanners) { if (Base::_eos) { return Status::OK(); } @@ -29,9 +29,9 @@ Status MetaScanLocalState::_init_scanners(std::list* sc auto& p = _parent->cast(); for (auto& scan_range : _scan_ranges) { - std::shared_ptr scanner = vectorized::MetaScanner::create_shared( - state(), this, p._tuple_id, scan_range, p._limit, custom_profile(), - p._user_identity); + std::shared_ptr scanner = + MetaScanner::create_shared(state(), this, p._tuple_id, scan_range, p._limit, + custom_profile(), p._user_identity); RETURN_IF_ERROR(scanner->init(state(), _conjuncts)); scanners->push_back(scanner); } @@ -58,4 +58,4 @@ MetaScanOperatorX::MetaScanOperatorX(ObjectPool* pool, const TPlanNode& tnode, i } } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/meta_scan_operator.h b/be/src/exec/operator/meta_scan_operator.h similarity index 87% rename from be/src/pipeline/exec/meta_scan_operator.h rename to be/src/exec/operator/meta_scan_operator.h index 7d7e67999fb9f3..7ae32e59c8f443 100644 --- a/be/src/pipeline/exec/meta_scan_operator.h +++ b/be/src/exec/operator/meta_scan_operator.h @@ -22,18 +22,16 @@ #include #include "common/status.h" -#include "operator.h" -#include "pipeline/exec/scan_operator.h" +#include "exec/operator/operator.h" +#include "exec/operator/scan_operator.h" namespace doris { #include "common/compile_check_begin.h" -namespace vectorized { class OlapScanner; -} } // namespace doris -namespace doris::pipeline { +namespace doris { class MetaScanOperatorX; class MetaScanLocalState final : public ScanLocalState { @@ -44,11 +42,11 @@ class MetaScanLocalState final : public ScanLocalState { MetaScanLocalState(RuntimeState* state, OperatorXBase* parent) : Base(state, parent) {} private: - friend class vectorized::OlapScanner; + friend class OlapScanner; void set_scan_ranges(RuntimeState* state, const std::vector& scan_ranges) override; - Status _init_scanners(std::list* scanners) override; + Status _init_scanners(std::list* scanners) override; Status _process_conjuncts(RuntimeState* state) override; std::vector _scan_ranges; @@ -67,4 +65,4 @@ class MetaScanOperatorX final : public ScanOperatorX { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/mock_operator.h b/be/src/exec/operator/mock_operator.h similarity index 79% rename from be/src/pipeline/exec/mock_operator.h rename to be/src/exec/operator/mock_operator.h index c010a24fee9f83..a83b5de5448176 100644 --- a/be/src/pipeline/exec/mock_operator.h +++ b/be/src/exec/operator/mock_operator.h @@ -19,15 +19,15 @@ #include -#include "pipeline/exec/operator.h" -#include "vec/core/block.h" +#include "core/block/block.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { #ifdef BE_TEST -class MockLocalState final : public doris::pipeline::PipelineXLocalState { +class MockLocalState final : public doris::PipelineXLocalState { public: - using Base = doris::pipeline::PipelineXLocalState; + using Base = doris::PipelineXLocalState; ENABLE_FACTORY_CREATOR(MockLocalState); MockLocalState(RuntimeState* state, OperatorXBase* parent) : Base(state, parent) {} @@ -42,7 +42,7 @@ class MockOperatorX final : public OperatorX { ENABLE_FACTORY_CREATOR(MockOperatorX); MockOperatorX() = default; - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override { + Status get_block(RuntimeState* state, Block* block, bool* eos) override { if (_outout_blocks.empty()) { *eos = true; return Status::OK(); @@ -59,9 +59,9 @@ class MockOperatorX final : public OperatorX { [[nodiscard]] bool is_source() const override { return true; } friend class MockLocalState; - std::list _outout_blocks; + std::list _outout_blocks; }; #endif -} // namespace doris::pipeline \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/exec/mock_scan_operator.h b/be/src/exec/operator/mock_scan_operator.h similarity index 84% rename from be/src/pipeline/exec/mock_scan_operator.h rename to be/src/exec/operator/mock_scan_operator.h index 7f651e3391a4a6..1022a5c44fb694 100644 --- a/be/src/pipeline/exec/mock_scan_operator.h +++ b/be/src/exec/operator/mock_scan_operator.h @@ -15,10 +15,10 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/exec/scan_operator.h" +#include "exec/operator/scan_operator.h" #ifdef BE_TEST -namespace doris::pipeline { +namespace doris { class MockScanOperatorX; class MockScanLocalState final : public ScanLocalState { @@ -44,8 +44,7 @@ class MockScanLocalState final : public ScanLocalState { bool _should_push_down_common_expr() override { return true; } PushDownType _should_push_down_topn_filter() const override { return PushDownType::ACCEPTABLE; } - PushDownType _should_push_down_is_null_predicate( - vectorized::VectorizedFnCall* fn_call) const override { + PushDownType _should_push_down_is_null_predicate(VectorizedFnCall* fn_call) const override { return fn_call->fn().name.function_name == "is_null_pred" || fn_call->fn().name.function_name == "is_not_null_pred" ? PushDownType::ACCEPTABLE @@ -55,8 +54,8 @@ class MockScanLocalState final : public ScanLocalState { return PushDownType::ACCEPTABLE; } PushDownType _should_push_down_binary_predicate( - vectorized::VectorizedFnCall* fn_call, vectorized::VExprContext* expr_ctx, - vectorized::Field& constant_val, const std::set fn_name) const override { + VectorizedFnCall* fn_call, VExprContext* expr_ctx, Field& constant_val, + const std::set fn_name) const override { if (!fn_name.contains(fn_call->fn().name.function_name)) { return PushDownType::UNACCEPTABLE; } @@ -66,8 +65,8 @@ class MockScanLocalState final : public ScanLocalState { if (children[1]->is_constant()) { std::shared_ptr const_col_wrapper; THROW_IF_ERROR(children[1]->get_const_col(expr_ctx, &const_col_wrapper)); - const auto* const_column = assert_cast( - const_col_wrapper->column_ptr.get()); + const auto* const_column = + assert_cast(const_col_wrapper->column_ptr.get()); constant_val = const_column->operator[](0); return PushDownType::ACCEPTABLE; } else { @@ -82,5 +81,5 @@ class MockScanOperatorX final : public ScanOperatorX { friend class OlapScanLocalState; MockScanOperatorX() = default; }; -} // namespace doris::pipeline +} // namespace doris #endif \ No newline at end of file diff --git a/be/src/pipeline/exec/multi_cast_data_stream_sink.cpp b/be/src/exec/operator/multi_cast_data_stream_sink.cpp similarity index 90% rename from be/src/pipeline/exec/multi_cast_data_stream_sink.cpp rename to be/src/exec/operator/multi_cast_data_stream_sink.cpp index 362de4fb42b73c..fbfb66482bc6cf 100644 --- a/be/src/pipeline/exec/multi_cast_data_stream_sink.cpp +++ b/be/src/exec/operator/multi_cast_data_stream_sink.cpp @@ -15,13 +15,13 @@ // specific language governing permissions and limitations // under the License. -#include "multi_cast_data_stream_sink.h" +#include "exec/operator/multi_cast_data_stream_sink.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/multi_cast_data_streamer.h" -#include "pipeline/exec/operator.h" +#include "exec/operator/multi_cast_data_streamer.h" +#include "exec/operator/operator.h" +#include "exec/pipeline/dependency.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" std::string MultiCastDataStreamSinkLocalState::name_suffix() { @@ -64,8 +64,7 @@ std::string MultiCastDataStreamSinkLocalState::debug_string(int indentation_leve return fmt::to_string(debug_string_buffer); } -Status MultiCastDataStreamSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block, - bool eos) { +Status MultiCastDataStreamSinkOperatorX::sink(RuntimeState* state, Block* in_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); if (in_block->rows() > 0 || eos) { @@ -77,4 +76,4 @@ Status MultiCastDataStreamSinkOperatorX::sink(RuntimeState* state, vectorized::B return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/multi_cast_data_stream_sink.h b/be/src/exec/operator/multi_cast_data_stream_sink.h similarity index 93% rename from be/src/pipeline/exec/multi_cast_data_stream_sink.h rename to be/src/exec/operator/multi_cast_data_stream_sink.h index 23d116fe6430c6..602371ce02c3ce 100644 --- a/be/src/pipeline/exec/multi_cast_data_stream_sink.h +++ b/be/src/exec/operator/multi_cast_data_stream_sink.h @@ -20,10 +20,10 @@ #include #include "common/status.h" -#include "operator.h" -#include "pipeline/exec/data_queue.h" +#include "exec/operator/data_queue.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class MultiCastDataStreamSinkOperatorX; @@ -57,7 +57,7 @@ class MultiCastDataStreamSinkOperatorX final _num_dests(sources.size()) {} ~MultiCastDataStreamSinkOperatorX() override = default; - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos) override; + Status sink(RuntimeState* state, Block* in_block, bool eos) override; std::shared_ptr create_shared_state() const override; @@ -77,4 +77,4 @@ class MultiCastDataStreamSinkOperatorX final }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/multi_cast_data_stream_source.cpp b/be/src/exec/operator/multi_cast_data_stream_source.cpp similarity index 85% rename from be/src/pipeline/exec/multi_cast_data_stream_source.cpp rename to be/src/exec/operator/multi_cast_data_stream_source.cpp index 936199ad20bbe3..7f19535859fab3 100644 --- a/be/src/pipeline/exec/multi_cast_data_stream_source.cpp +++ b/be/src/exec/operator/multi_cast_data_stream_source.cpp @@ -15,15 +15,15 @@ // specific language governing permissions and limitations // under the License. -#include "multi_cast_data_stream_source.h" +#include "exec/operator/multi_cast_data_stream_source.h" #include "common/status.h" -#include "pipeline/exec/multi_cast_data_streamer.h" -#include "pipeline/exec/operator.h" -#include "vec/core/block.h" -#include "vec/core/materialize_block.h" +#include "core/block/block.h" +#include "core/block/materialize_block.h" +#include "exec/operator/multi_cast_data_streamer.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" MultiCastDataStreamSourceLocalState::MultiCastDataStreamSourceLocalState(RuntimeState* state, OperatorXBase* parent) @@ -80,13 +80,13 @@ Status MultiCastDataStreamSourceLocalState::close(RuntimeState* state) { return Base::close(state); } -Status MultiCastDataStreamerSourceOperatorX::get_block(RuntimeState* state, - vectorized::Block* block, bool* eos) { +Status MultiCastDataStreamerSourceOperatorX::get_block(RuntimeState* state, Block* block, + bool* eos) { //auto& local_state = get_local_state(state); auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); - vectorized::Block tmp_block; - vectorized::Block* output_block = block; + Block tmp_block; + Block* output_block = block; if (!local_state._output_expr_contexts.empty()) { output_block = &tmp_block; } @@ -104,17 +104,17 @@ Status MultiCastDataStreamerSourceOperatorX::get_block(RuntimeState* state, if (!local_state._conjuncts.empty() && !output_block->empty()) { SCOPED_TIMER(local_state._filter_timer); - RETURN_IF_ERROR(vectorized::VExprContext::filter_block(local_state._conjuncts, output_block, - output_block->columns())); + RETURN_IF_ERROR(VExprContext::filter_block(local_state._conjuncts, output_block, + output_block->columns())); } if (!local_state._output_expr_contexts.empty() && output_block->rows() > 0) { SCOPED_TIMER(local_state._materialize_data_timer); - RETURN_IF_ERROR(vectorized::VExprContext::get_output_block_after_execute_exprs( + RETURN_IF_ERROR(VExprContext::get_output_block_after_execute_exprs( local_state._output_expr_contexts, *output_block, block, true)); - vectorized::materialize_block_inplace(*block); + materialize_block_inplace(*block); } return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/multi_cast_data_stream_source.h b/be/src/exec/operator/multi_cast_data_stream_source.h similarity index 76% rename from be/src/pipeline/exec/multi_cast_data_stream_source.h rename to be/src/exec/operator/multi_cast_data_stream_source.h index d0a524a48fce67..3673269e92f4a0 100644 --- a/be/src/pipeline/exec/multi_cast_data_stream_source.h +++ b/be/src/exec/operator/multi_cast_data_stream_source.h @@ -22,17 +22,14 @@ #include #include "common/status.h" -#include "operator.h" -#include "runtime_filter/runtime_filter_consumer_helper.h" +#include "exec/operator/operator.h" +#include "exec/runtime_filter/runtime_filter_consumer_helper.h" namespace doris { class RuntimeState; -namespace vectorized { class Block; -} // namespace vectorized -namespace pipeline { #include "common/compile_check_begin.h" class MultiCastDataStreamer; class MultiCastDataStreamerSourceOperatorX; @@ -64,7 +61,7 @@ class MultiCastDataStreamSourceLocalState final private: friend class MultiCastDataStreamerSourceOperatorX; - vectorized::VExprContextSPtrs _output_expr_contexts; + VExprContextSPtrs _output_expr_contexts; std::vector> _filter_dependencies; RuntimeProfile::Counter* _wait_for_rf_timer = nullptr; @@ -94,23 +91,21 @@ class MultiCastDataStreamerSourceOperatorX final RETURN_IF_ERROR(Base::prepare(state)); // init profile for runtime filter if (_t_data_stream_sink.__isset.output_exprs) { - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(_t_data_stream_sink.output_exprs, - _output_expr_contexts)); - RETURN_IF_ERROR(vectorized::VExpr::prepare(_output_expr_contexts, state, - _multi_cast_output_row_descriptor)); - RETURN_IF_ERROR(vectorized::VExpr::open(_output_expr_contexts, state)); + RETURN_IF_ERROR(VExpr::create_expr_trees(_t_data_stream_sink.output_exprs, + _output_expr_contexts)); + RETURN_IF_ERROR(VExpr::prepare(_output_expr_contexts, state, + _multi_cast_output_row_descriptor)); + RETURN_IF_ERROR(VExpr::open(_output_expr_contexts, state)); } if (_t_data_stream_sink.__isset.conjuncts) { - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(_t_data_stream_sink.conjuncts, - conjuncts())); - RETURN_IF_ERROR(vectorized::VExpr::prepare(conjuncts(), state, - _multi_cast_output_row_descriptor)); - RETURN_IF_ERROR(vectorized::VExpr::open(conjuncts(), state)); + RETURN_IF_ERROR(VExpr::create_expr_trees(_t_data_stream_sink.conjuncts, conjuncts())); + RETURN_IF_ERROR(VExpr::prepare(conjuncts(), state, _multi_cast_output_row_descriptor)); + RETURN_IF_ERROR(VExpr::open(conjuncts(), state)); } return Status::OK(); } - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override; + Status get_block(RuntimeState* state, Block* block, bool* eos) override; bool is_source() const override { return true; } @@ -124,10 +119,9 @@ class MultiCastDataStreamerSourceOperatorX final friend class MultiCastDataStreamSourceLocalState; const int _consumer_id; const TDataStreamSink _t_data_stream_sink; - vectorized::VExprContextSPtrs _output_expr_contexts; + VExprContextSPtrs _output_expr_contexts; const RowDescriptor& _multi_cast_output_row_descriptor; }; -} // namespace pipeline } // namespace doris #include "common/compile_check_end.h" \ No newline at end of file diff --git a/be/src/pipeline/exec/multi_cast_data_streamer.cpp b/be/src/exec/operator/multi_cast_data_streamer.cpp similarity index 92% rename from be/src/pipeline/exec/multi_cast_data_streamer.cpp rename to be/src/exec/operator/multi_cast_data_streamer.cpp index 38080010057d94..4511f42ae3c57d 100644 --- a/be/src/pipeline/exec/multi_cast_data_streamer.cpp +++ b/be/src/exec/operator/multi_cast_data_streamer.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "multi_cast_data_streamer.h" +#include "exec/operator/multi_cast_data_streamer.h" #include #include @@ -28,26 +28,25 @@ #include "common/exception.h" #include "common/logging.h" #include "common/status.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/multi_cast_data_stream_source.h" -#include "pipeline/exec/spill_utils.h" +#include "core/block/block.h" +#include "exec/operator/multi_cast_data_stream_source.h" +#include "exec/operator/spill_utils.h" +#include "exec/pipeline/dependency.h" +#include "exec/spill/spill_stream_manager.h" #include "runtime/exec_env.h" #include "runtime/runtime_state.h" #include "util/pretty_printer.h" #include "util/uid_util.h" -#include "vec/core/block.h" -#include "vec/spill/spill_stream_manager.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" -MultiCastBlock::MultiCastBlock(vectorized::Block* block, int un_finish_copy, size_t mem_size) +MultiCastBlock::MultiCastBlock(Block* block, int un_finish_copy, size_t mem_size) : _un_finish_copy(un_finish_copy), _mem_size(mem_size) { - _block = vectorized::Block::create_unique(block->get_columns_with_type_and_name()); + _block = Block::create_unique(block->get_columns_with_type_and_name()); block->clear(); } -Status MultiCastDataStreamer::pull(RuntimeState* state, int sender_idx, vectorized::Block* block, - bool* eos) { +Status MultiCastDataStreamer::pull(RuntimeState* state, int sender_idx, Block* block, bool* eos) { MultiCastBlock* multi_cast_block = nullptr; { INJECT_MOCK_SLEEP(std::unique_lock l(_mutex)); @@ -90,7 +89,7 @@ Status MultiCastDataStreamer::pull(RuntimeState* state, int sender_idx, vectoriz } auto spill_func = [this, reader_item, sender_idx]() { - vectorized::Block block; + Block block; bool spill_eos = false; size_t read_size = 0; while (!spill_eos) { @@ -151,8 +150,7 @@ Status MultiCastDataStreamer::pull(RuntimeState* state, int sender_idx, vectoriz return _copy_block(state, sender_idx, block, *multi_cast_block); } -Status MultiCastDataStreamer::_copy_block(RuntimeState* state, int32_t sender_idx, - vectorized::Block* block, +Status MultiCastDataStreamer::_copy_block(RuntimeState* state, int32_t sender_idx, Block* block, MultiCastBlock& multi_cast_block) { const auto rows = block->rows(); for (int i = 0; i < block->columns(); ++i) { @@ -181,7 +179,7 @@ Status MultiCastDataStreamer::_trigger_spill_if_need(RuntimeState* state, bool* return Status::OK(); } - vectorized::SpillStreamSPtr spill_stream; + SpillStreamSPtr spill_stream; *triggered = false; if (_cumulative_mem_size.load() >= config::exchg_node_buffer_size_bytes && _multi_cast_blocks.size() >= 4) { @@ -237,9 +235,8 @@ Status MultiCastDataStreamer::_trigger_spill_if_need(RuntimeState* state, bool* return Status::OK(); } -Status MultiCastDataStreamer::_start_spill_task(RuntimeState* state, - vectorized::SpillStreamSPtr spill_stream) { - std::vector blocks; +Status MultiCastDataStreamer::_start_spill_task(RuntimeState* state, SpillStreamSPtr spill_stream) { + std::vector blocks; for (auto& block : _multi_cast_blocks) { DCHECK_GT(block._block->rows(), 0); blocks.emplace_back(std::move(*block._block)); @@ -280,7 +277,7 @@ Status MultiCastDataStreamer::_start_spill_task(RuntimeState* state, return SpillSinkRunnable(state, nullptr, _sink_operator_profile, exception_catch_func).run(); } -Status MultiCastDataStreamer::push(RuntimeState* state, doris::vectorized::Block* block, bool eos) { +Status MultiCastDataStreamer::push(RuntimeState* state, doris::Block* block, bool eos) { auto rows = block->rows(); COUNTER_UPDATE(_process_rows, rows); @@ -313,8 +310,7 @@ Status MultiCastDataStreamer::push(RuntimeState* state, doris::vectorized::Block bool spilled = false; RETURN_IF_ERROR(_trigger_spill_if_need(state, &spilled)); if (spilled) { - _pending_block = vectorized::Block::create_unique( - block->get_columns_with_type_and_name()); + _pending_block = Block::create_unique(block->get_columns_with_type_and_name()); block->clear(); return Status::OK(); } @@ -395,4 +391,4 @@ std::string MultiCastDataStreamer::debug_string() { return fmt::to_string(debug_string_buffer); } -} // namespace doris::pipeline \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/exec/multi_cast_data_streamer.h b/be/src/exec/operator/multi_cast_data_streamer.h similarity index 82% rename from be/src/pipeline/exec/multi_cast_data_streamer.h rename to be/src/exec/operator/multi_cast_data_streamer.h index 4829fe61d94cb1..b9dc9112cfba07 100644 --- a/be/src/pipeline/exec/multi_cast_data_streamer.h +++ b/be/src/exec/operator/multi_cast_data_streamer.h @@ -22,22 +22,22 @@ #include #include -#include "pipeline/dependency.h" -#include "util/runtime_profile.h" -#include "vec/core/block.h" -#include "vec/sink/vdata_stream_sender.h" -#include "vec/spill/spill_stream.h" +#include "core/block/block.h" +#include "exec/exchange/vdata_stream_sender.h" +#include "exec/pipeline/dependency.h" +#include "exec/spill/spill_stream.h" +#include "runtime/runtime_profile.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class Dependency; struct MultiCastSharedState; struct MultiCastBlock { - MultiCastBlock(vectorized::Block* block, int need_copy, size_t mem_size); + MultiCastBlock(Block* block, int need_copy, size_t mem_size); - std::unique_ptr _block; + std::unique_ptr _block; // Each block is copied during pull. If _un_finish_copy == 0, // it indicates that this block has been fully used and can be released. int _un_finish_copy; @@ -45,8 +45,8 @@ struct MultiCastBlock { }; struct SpillingReader { - vectorized::SpillReaderUPtr reader; - vectorized::SpillStreamSPtr stream; + SpillReaderUPtr reader; + SpillStreamSPtr stream; int64_t block_offset {0}; bool all_data_read {false}; }; @@ -71,9 +71,9 @@ class MultiCastDataStreamer { ~MultiCastDataStreamer() = default; - Status pull(RuntimeState* state, int sender_idx, vectorized::Block* block, bool* eos); + Status pull(RuntimeState* state, int sender_idx, Block* block, bool* eos); - Status push(RuntimeState* state, vectorized::Block* block, bool eos); + Status push(RuntimeState* state, Block* block, bool eos); RuntimeProfile* profile() { return _profile; } @@ -96,16 +96,16 @@ class MultiCastDataStreamer { void _set_ready_for_read(int sender_idx); void _block_reading(int sender_idx); - Status _copy_block(RuntimeState* state, int32_t sender_idx, vectorized::Block* block, + Status _copy_block(RuntimeState* state, int32_t sender_idx, Block* block, MultiCastBlock& multi_cast_block); - Status _start_spill_task(RuntimeState* state, vectorized::SpillStreamSPtr spill_stream); + Status _start_spill_task(RuntimeState* state, SpillStreamSPtr spill_stream); Status _trigger_spill_if_need(RuntimeState* state, bool* triggered); RuntimeProfile* _profile = nullptr; std::list _multi_cast_blocks; - std::vector> _cached_blocks; + std::vector> _cached_blocks; std::vector::iterator> _sender_pos_to_read; std::mutex _mutex; bool _eos = false; @@ -119,7 +119,7 @@ class MultiCastDataStreamer { Dependency* _write_dependency; std::vector _dependencies; - vectorized::BlockUPtr _pending_block; + BlockUPtr _pending_block; std::vector>> _spill_readers; @@ -128,4 +128,4 @@ class MultiCastDataStreamer { std::vector _source_operator_profiles; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/exec/nested_loop_join_build_operator.cpp b/be/src/exec/operator/nested_loop_join_build_operator.cpp similarity index 90% rename from be/src/pipeline/exec/nested_loop_join_build_operator.cpp rename to be/src/exec/operator/nested_loop_join_build_operator.cpp index 028eb4b63d3045..e61399fc13a18b 100644 --- a/be/src/pipeline/exec/nested_loop_join_build_operator.cpp +++ b/be/src/exec/operator/nested_loop_join_build_operator.cpp @@ -15,14 +15,14 @@ // specific language governing permissions and limitations // under the License. -#include "nested_loop_join_build_operator.h" +#include "exec/operator/nested_loop_join_build_operator.h" #include -#include "pipeline/exec/operator.h" -#include "runtime_filter/runtime_filter_producer_helper_cross.h" +#include "exec/operator/operator.h" +#include "exec/runtime_filter/runtime_filter_producer_helper_cross.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" NestedLoopJoinBuildSinkLocalState::NestedLoopJoinBuildSinkLocalState(DataSinkOperatorXBase* parent, @@ -77,7 +77,7 @@ Status NestedLoopJoinBuildSinkOperatorX::init(const TPlanNode& tnode, RuntimeSta for (size_t i = 0; i < _runtime_filter_descs.size(); i++) { filter_src_exprs.push_back(_runtime_filter_descs[i].src_expr); } - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(filter_src_exprs, _filter_src_expr_ctxs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(filter_src_exprs, _filter_src_expr_ctxs)); return Status::OK(); } @@ -90,12 +90,11 @@ Status NestedLoopJoinBuildSinkOperatorX::prepare(RuntimeState* state) { auto tuple_idx = _row_descriptor.get_tuple_idx(build_tuple_desc->id()); RETURN_IF_INVALID_TUPLE_IDX(build_tuple_desc->id(), tuple_idx); } - RETURN_IF_ERROR(vectorized::VExpr::prepare(_filter_src_expr_ctxs, state, _child->row_desc())); - return vectorized::VExpr::open(_filter_src_expr_ctxs, state); + RETURN_IF_ERROR(VExpr::prepare(_filter_src_expr_ctxs, state, _child->row_desc())); + return VExpr::open(_filter_src_expr_ctxs, state); } -Status NestedLoopJoinBuildSinkOperatorX::sink(doris::RuntimeState* state, vectorized::Block* block, - bool eos) { +Status NestedLoopJoinBuildSinkOperatorX::sink(doris::RuntimeState* state, Block* block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)block->rows()); @@ -107,7 +106,7 @@ Status NestedLoopJoinBuildSinkOperatorX::sink(doris::RuntimeState* state, vector local_state._shared_state->build_blocks.emplace_back(std::move(*block)); if (_match_all_build || _is_right_semi_anti) { local_state._shared_state->build_side_visited_flags.emplace_back( - vectorized::ColumnUInt8::create(rows, 0)); + ColumnUInt8::create(rows, 0)); } } @@ -125,4 +124,4 @@ Status NestedLoopJoinBuildSinkOperatorX::sink(doris::RuntimeState* state, vector return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/nested_loop_join_build_operator.h b/be/src/exec/operator/nested_loop_join_build_operator.h similarity index 86% rename from be/src/pipeline/exec/nested_loop_join_build_operator.h rename to be/src/exec/operator/nested_loop_join_build_operator.h index eb31846747525e..2f3dd8429a7f3a 100644 --- a/be/src/pipeline/exec/nested_loop_join_build_operator.h +++ b/be/src/exec/operator/nested_loop_join_build_operator.h @@ -19,11 +19,11 @@ #include -#include "operator.h" -#include "pipeline/exec/join_build_sink_operator.h" -#include "runtime_filter/runtime_filter_producer_helper_cross.h" +#include "exec/operator/join_build_sink_operator.h" +#include "exec/operator/operator.h" +#include "exec/runtime_filter/runtime_filter_producer_helper_cross.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class NestedLoopJoinBuildSinkOperatorX; @@ -41,12 +41,12 @@ class NestedLoopJoinBuildSinkLocalState final Status open(RuntimeState* state) override; Status close(RuntimeState* state, Status exec_status) override; - vectorized::Blocks& build_blocks() { return _shared_state->build_blocks; } + Blocks& build_blocks() { return _shared_state->build_blocks; } private: friend class NestedLoopJoinBuildSinkOperatorX; - vectorized::VExprContextSPtrs _filter_src_expr_ctxs; + VExprContextSPtrs _filter_src_expr_ctxs; std::shared_ptr _runtime_filter_producer_helper; }; @@ -65,7 +65,7 @@ class NestedLoopJoinBuildSinkOperatorX final Status prepare(RuntimeState* state) override; - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos) override; + Status sink(RuntimeState* state, Block* in_block, bool eos) override; DataDistribution required_data_distribution(RuntimeState* /*state*/) const override { if (_join_op == TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN) { @@ -78,11 +78,11 @@ class NestedLoopJoinBuildSinkOperatorX final private: friend class NestedLoopJoinBuildSinkLocalState; - vectorized::VExprContextSPtrs _filter_src_expr_ctxs; + VExprContextSPtrs _filter_src_expr_ctxs; const bool _is_output_left_side_only; RowDescriptor _row_descriptor; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/nested_loop_join_probe_operator.cpp b/be/src/exec/operator/nested_loop_join_probe_operator.cpp similarity index 89% rename from be/src/pipeline/exec/nested_loop_join_probe_operator.cpp rename to be/src/exec/operator/nested_loop_join_probe_operator.cpp index 76a50ff8169a6a..c142d0c2307bd7 100644 --- a/be/src/pipeline/exec/nested_loop_join_probe_operator.cpp +++ b/be/src/exec/operator/nested_loop_join_probe_operator.cpp @@ -15,21 +15,22 @@ // specific language governing permissions and limitations // under the License. -#include "nested_loop_join_probe_operator.h" +#include "exec/operator/nested_loop_join_probe_operator.h" #include #include "common/cast_set.h" #include "common/exception.h" -#include "pipeline/exec/operator.h" -#include "vec/columns/column_filter_helper.h" -#include "vec/core/block.h" +#include "core/block/block.h" +#include "core/column/column.h" +#include "core/column/column_filter_helper.h" +#include "exec/operator/operator.h" namespace doris { class RuntimeState; } // namespace doris -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" NestedLoopJoinProbeLocalState::NestedLoopJoinProbeLocalState(RuntimeState* state, OperatorXBase* parent) @@ -75,12 +76,12 @@ Status NestedLoopJoinProbeLocalState::close(RuntimeState* state) { state); } -void NestedLoopJoinProbeLocalState::_update_additional_flags(vectorized::Block* block) { +void NestedLoopJoinProbeLocalState::_update_additional_flags(Block* block) { auto& p = _parent->cast(); if (p._is_mark_join) { auto mark_column = block->get_by_position(block->columns() - 1).column->assume_mutable(); if (mark_column->size() < block->rows()) { - vectorized::ColumnFilterHelper(*mark_column).resize_fill(block->rows(), 1); + ColumnFilterHelper(*mark_column).resize_fill(block->rows(), 1); } } } @@ -182,7 +183,7 @@ Status NestedLoopJoinProbeLocalState::generate_join_block_data(RuntimeState* sta } template -void NestedLoopJoinProbeLocalState::_finalize_current_phase(vectorized::Block& block, +void NestedLoopJoinProbeLocalState::_finalize_current_phase(Block& block, size_t batch_size) { auto& p = _parent->cast(); auto dst_columns = block.mutate_columns(); @@ -195,7 +196,7 @@ void NestedLoopJoinProbeLocalState::_finalize_current_phase(vectorized::Block& b for (; i < build_block_sz && column_size < batch_size; i++) { const auto& cur_block = _shared_state->build_blocks[i]; const auto* __restrict cur_visited_flags = - assert_cast( + assert_cast( _shared_state->build_side_visited_flags[i].get()) ->get_data() .data(); @@ -228,12 +229,12 @@ void NestedLoopJoinProbeLocalState::_finalize_current_phase(vectorized::Block& b if (!src_column.column->is_nullable() && dst_columns[p._num_probe_side_columns + j]->is_nullable()) { DCHECK(p._join_op == TJoinOp::FULL_OUTER_JOIN); - assert_cast( + assert_cast( dst_columns[p._num_probe_side_columns + j].get()) ->get_nested_column_ptr() ->insert_indices_from(*src_column.column, selector.data(), selector.data() + selector_idx); - assert_cast( + assert_cast( dst_columns[p._num_probe_side_columns + j].get()) ->get_null_map_column() .get_data() @@ -255,14 +256,14 @@ void NestedLoopJoinProbeLocalState::_finalize_current_phase(vectorized::Block& b if (_cur_probe_row_visited_flags[j] == IsSemi) { new_size++; for (size_t i = 0; i < p._num_probe_side_columns; ++i) { - const vectorized::ColumnWithTypeAndName src_column = + const ColumnWithTypeAndName src_column = _child_block->get_by_position(i); if (!src_column.column->is_nullable() && dst_columns[i]->is_nullable()) { DCHECK(p._join_op == TJoinOp::FULL_OUTER_JOIN); - assert_cast(dst_columns[i].get()) + assert_cast(dst_columns[i].get()) ->get_nested_column_ptr() ->insert_many_from(*src_column.column, j, 1); - assert_cast(dst_columns[i].get()) + assert_cast(dst_columns[i].get()) ->get_null_map_column() .get_data() .resize_fill(new_size, 0); @@ -279,7 +280,7 @@ void NestedLoopJoinProbeLocalState::_finalize_current_phase(vectorized::Block& b } } } else { - vectorized::ColumnFilterHelper mark_column(*dst_columns[dst_columns.size() - 1]); + ColumnFilterHelper mark_column(*dst_columns[dst_columns.size() - 1]); mark_column.reserve(mark_column.size() + _left_side_process_count); DCHECK_LE(_left_block_start_pos + _left_side_process_count, _child_block->rows()); for (int j = _left_block_start_pos; @@ -287,7 +288,7 @@ void NestedLoopJoinProbeLocalState::_finalize_current_phase(vectorized::Block& b mark_column.insert_value(IsSemi == _cur_probe_row_visited_flags[j]); } for (size_t i = 0; i < p._num_probe_side_columns; ++i) { - const vectorized::ColumnWithTypeAndName src_column = + const ColumnWithTypeAndName src_column = _child_block->get_by_position(i); DCHECK(p._join_op != TJoinOp::FULL_OUTER_JOIN); dst_columns[i]->insert_range_from(*src_column.column, _left_block_start_pos, @@ -302,21 +303,21 @@ void NestedLoopJoinProbeLocalState::_finalize_current_phase(vectorized::Block& b block.set_columns(std::move(dst_columns)); } -void NestedLoopJoinProbeLocalState::_append_left_data_with_null(vectorized::Block& block) const { +void NestedLoopJoinProbeLocalState::_append_left_data_with_null(Block& block) const { auto& p = _parent->cast(); auto dst_columns = block.mutate_columns(); DCHECK(p._is_mark_join); for (size_t i = 0; i < p._num_probe_side_columns; ++i) { - const vectorized::ColumnWithTypeAndName& src_column = _child_block->get_by_position(i); + const ColumnWithTypeAndName& src_column = _child_block->get_by_position(i); if (!src_column.column->is_nullable() && dst_columns[i]->is_nullable()) { auto origin_sz = dst_columns[i]->size(); DCHECK(p._join_op == TJoinOp::RIGHT_OUTER_JOIN || p._join_op == TJoinOp::FULL_OUTER_JOIN); - assert_cast(dst_columns[i].get()) + assert_cast(dst_columns[i].get()) ->get_nested_column_ptr() ->insert_range_from(*src_column.column, _left_block_start_pos, _left_side_process_count); - assert_cast(dst_columns[i].get()) + assert_cast(dst_columns[i].get()) ->get_null_map_column() .get_data() .resize_fill(origin_sz + 1, 0); @@ -329,27 +330,27 @@ void NestedLoopJoinProbeLocalState::_append_left_data_with_null(vectorized::Bloc dst_columns[p._num_probe_side_columns + i]->insert_many_defaults(_left_side_process_count); } auto& mark_column = *dst_columns[dst_columns.size() - 1]; - vectorized::ColumnFilterHelper(mark_column) + ColumnFilterHelper(mark_column) .resize_fill(mark_column.size() + _left_side_process_count, 0); block.set_columns(std::move(dst_columns)); } void NestedLoopJoinProbeLocalState::_process_left_child_block( - vectorized::Block& block, const vectorized::Block& now_process_build_block) const { + Block& block, const Block& now_process_build_block) const { SCOPED_TIMER(_output_temp_blocks_timer); auto& p = _parent->cast(); auto dst_columns = block.mutate_columns(); const size_t max_added_rows = now_process_build_block.rows(); for (size_t i = 0; i < p._num_probe_side_columns; ++i) { - const vectorized::ColumnWithTypeAndName& src_column = _child_block->get_by_position(i); + const ColumnWithTypeAndName& src_column = _child_block->get_by_position(i); if (!src_column.column->is_nullable() && dst_columns[i]->is_nullable()) { auto origin_sz = dst_columns[i]->size(); DCHECK(p._join_op == TJoinOp::RIGHT_OUTER_JOIN || p._join_op == TJoinOp::FULL_OUTER_JOIN); - assert_cast(dst_columns[i].get()) + assert_cast(dst_columns[i].get()) ->get_nested_column_ptr() ->insert_many_from(*src_column.column, _left_block_pos, max_added_rows); - assert_cast(dst_columns[i].get()) + assert_cast(dst_columns[i].get()) ->get_null_map_column() .get_data() .resize_fill(origin_sz + max_added_rows, 0); @@ -359,18 +360,18 @@ void NestedLoopJoinProbeLocalState::_process_left_child_block( } } for (size_t i = 0; i < p._num_build_side_columns; ++i) { - const vectorized::ColumnWithTypeAndName& src_column = + const ColumnWithTypeAndName& src_column = now_process_build_block.get_by_position(i); if (!src_column.column->is_nullable() && dst_columns[p._num_probe_side_columns + i]->is_nullable()) { auto origin_sz = dst_columns[p._num_probe_side_columns + i]->size(); DCHECK(p._join_op == TJoinOp::LEFT_OUTER_JOIN || p._join_op == TJoinOp::FULL_OUTER_JOIN); - assert_cast( + assert_cast( dst_columns[p._num_probe_side_columns + i].get()) ->get_nested_column_ptr() ->insert_range_from(*src_column.column.get(), 0, max_added_rows); - assert_cast( + assert_cast( dst_columns[p._num_probe_side_columns + i].get()) ->get_null_map_column() .get_data() @@ -398,11 +399,11 @@ Status NestedLoopJoinProbeOperatorX::init(const TPlanNode& tnode, RuntimeState* if (tnode.nested_loop_join_node.__isset.join_conjuncts && !tnode.nested_loop_join_node.join_conjuncts.empty()) { - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees( + RETURN_IF_ERROR(VExpr::create_expr_trees( tnode.nested_loop_join_node.join_conjuncts, _join_conjuncts)); } else if (tnode.nested_loop_join_node.__isset.vjoin_conjunct) { - vectorized::VExprContextSPtr context; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree( + VExprContextSPtr context; + RETURN_IF_ERROR(VExpr::create_expr_tree( tnode.nested_loop_join_node.vjoin_conjunct, context)); _join_conjuncts.emplace_back(context); } @@ -417,7 +418,7 @@ Status NestedLoopJoinProbeOperatorX::prepare(RuntimeState* state) { } _num_probe_side_columns = _child->row_desc().num_materialized_slots(); _num_build_side_columns = _build_side_child->row_desc().num_materialized_slots(); - return vectorized::VExpr::open(_join_conjuncts, state); + return VExpr::open(_join_conjuncts, state); } bool NestedLoopJoinProbeOperatorX::need_more_input_data(RuntimeState* state) const { @@ -427,7 +428,7 @@ bool NestedLoopJoinProbeOperatorX::need_more_input_data(RuntimeState* state) con local_state._join_block.rows() == 0; } -Status NestedLoopJoinProbeOperatorX::push(doris::RuntimeState* state, vectorized::Block* block, +Status NestedLoopJoinProbeOperatorX::push(doris::RuntimeState* state, Block* block, bool eos) const { auto& local_state = get_local_state(state); COUNTER_UPDATE(local_state._probe_rows_counter, block->rows()); @@ -450,13 +451,13 @@ Status NestedLoopJoinProbeOperatorX::push(doris::RuntimeState* state, vectorized SCOPED_TIMER(local_state._loop_join_timer); RETURN_IF_ERROR( std::visit(func, local_state._shared_state->join_op_variants, - vectorized::make_bool_variant(_match_all_build || _is_right_semi_anti), - vectorized::make_bool_variant(_match_all_probe || _is_left_semi_anti))); + make_bool_variant(_match_all_build || _is_right_semi_anti), + make_bool_variant(_match_all_probe || _is_left_semi_anti))); } return Status::OK(); } -Status NestedLoopJoinProbeOperatorX::pull(RuntimeState* state, vectorized::Block* block, +Status NestedLoopJoinProbeOperatorX::pull(RuntimeState* state, Block* block, bool* eos) const { auto& local_state = get_local_state(state); if (_is_output_left_side_only) { @@ -496,8 +497,8 @@ Status NestedLoopJoinProbeOperatorX::pull(RuntimeState* state, vectorized::Block SCOPED_PEAK_MEM(&local_state._estimate_memory_usage); RETURN_IF_ERROR(std::visit( func, local_state._shared_state->join_op_variants, - vectorized::make_bool_variant(_match_all_build || _is_right_semi_anti), - vectorized::make_bool_variant(_match_all_probe || _is_left_semi_anti))); + make_bool_variant(_match_all_build || _is_right_semi_anti), + make_bool_variant(_match_all_probe || _is_left_semi_anti))); } } @@ -505,4 +506,4 @@ Status NestedLoopJoinProbeOperatorX::pull(RuntimeState* state, vectorized::Block return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/nested_loop_join_probe_operator.h b/be/src/exec/operator/nested_loop_join_probe_operator.h similarity index 87% rename from be/src/pipeline/exec/nested_loop_join_probe_operator.h rename to be/src/exec/operator/nested_loop_join_probe_operator.h index 72f419a936cb94..d841efe9565b06 100644 --- a/be/src/pipeline/exec/nested_loop_join_probe_operator.h +++ b/be/src/exec/operator/nested_loop_join_probe_operator.h @@ -23,14 +23,13 @@ #include "common/cast_set.h" #include "common/status.h" -#include "operator.h" -#include "pipeline/exec/join_probe_operator.h" +#include "exec/operator/join_probe_operator.h" +#include "exec/operator/operator.h" #include "util/simd/bits.h" namespace doris { class RuntimeState; -namespace pipeline { #include "common/compile_check_begin.h" class NestedLoopJoinProbeOperatorX; class NestedLoopJoinProbeLocalState final @@ -53,15 +52,15 @@ class NestedLoopJoinProbeLocalState final private: friend class NestedLoopJoinProbeOperatorX; - void _update_additional_flags(vectorized::Block* block); + void _update_additional_flags(Block* block); template - void _finalize_current_phase(vectorized::Block& block, size_t batch_size); + void _finalize_current_phase(Block& block, size_t batch_size); void _reset_with_next_probe_row(); - void _append_left_data_with_null(vectorized::Block& block) const; - void _process_left_child_block(vectorized::Block& block, - const vectorized::Block& now_process_build_block) const; + void _append_left_data_with_null(Block& block) const; + void _process_left_child_block(Block& block, + const Block& now_process_build_block) const; template - void _do_filtering_and_update_visited_flags_impl(vectorized::Block* block, + void _do_filtering_and_update_visited_flags_impl(Block* block, uint32_t column_to_keep, size_t build_block_idx, size_t processed_blocks_num, bool materialize, @@ -71,7 +70,7 @@ class NestedLoopJoinProbeLocalState final if constexpr (SetBuildSideFlag) { for (size_t i = 0; i < processed_blocks_num; i++) { auto& build_side_flag = - assert_cast( + assert_cast( _shared_state->build_side_visited_flags[build_block_idx].get()) ->get_data(); auto* __restrict build_side_flag_data = build_side_flag.data(); @@ -106,7 +105,7 @@ class NestedLoopJoinProbeLocalState final if (materialize) { SCOPED_TIMER(_filtered_by_join_conjuncts_timer); - vectorized::Block::filter_block_internal(block, filter, column_to_keep); + Block::filter_block_internal(block, filter, column_to_keep); } else { CLEAR_BLOCK } @@ -114,7 +113,7 @@ class NestedLoopJoinProbeLocalState final // need exception safety template - Status _do_filtering_and_update_visited_flags(vectorized::Block* block, bool materialize) { + Status _do_filtering_and_update_visited_flags(Block* block, bool materialize) { // The number of columns will not exceed the range of u32. uint32_t column_to_keep = cast_set(block->columns()); // If we need to set visited flags for build side, @@ -125,11 +124,11 @@ class NestedLoopJoinProbeLocalState final : _current_build_pos - 1; size_t processed_blocks_num = _build_offset_stack.size(); if (LIKELY(!_join_conjuncts.empty() && block->rows() > 0)) { - vectorized::IColumn::Filter filter(block->rows(), 1); + IColumn::Filter filter(block->rows(), 1); bool can_filter_all = false; { SCOPED_TIMER(_join_conjuncts_evaluation_timer); - RETURN_IF_ERROR(vectorized::VExprContext::execute_conjuncts( + RETURN_IF_ERROR(VExprContext::execute_conjuncts( _join_conjuncts, nullptr, IgnoreNull, block, &filter, &can_filter_all)); } @@ -150,7 +149,7 @@ class NestedLoopJoinProbeLocalState final if constexpr (SetBuildSideFlag) { for (size_t i = 0; i < processed_blocks_num; i++) { auto& build_side_flag = - assert_cast( + assert_cast( _shared_state->build_side_visited_flags[build_block_idx].get()) ->get_data(); auto* __restrict build_side_flag_data = build_side_flag.data(); @@ -171,7 +170,7 @@ class NestedLoopJoinProbeLocalState final CLEAR_BLOCK } } - vectorized::Block::erase_useless_column(block, column_to_keep); + Block::erase_useless_column(block, column_to_keep); return Status::OK(); } @@ -183,11 +182,11 @@ class NestedLoopJoinProbeLocalState final // Visited flags for current row in probe side. std::vector _cur_probe_row_visited_flags; size_t _current_build_pos = 0; - vectorized::MutableColumns _dst_columns; + MutableColumns _dst_columns; std::stack _build_offset_stack; std::stack _probe_offset_stack; uint64_t _output_null_idx_build_side = 0; - vectorized::VExprContextSPtrs _join_conjuncts; + VExprContextSPtrs _join_conjuncts; RuntimeProfile::Counter* _loop_join_timer = nullptr; RuntimeProfile::Counter* _output_temp_blocks_timer = nullptr; @@ -204,8 +203,8 @@ class NestedLoopJoinProbeOperatorX final Status init(const TPlanNode& tnode, RuntimeState* state) override; Status prepare(RuntimeState* state) override; - Status push(RuntimeState* state, vectorized::Block* input_block, bool eos) const override; - Status pull(doris::RuntimeState* state, vectorized::Block* output_block, + Status push(RuntimeState* state, Block* input_block, bool eos) const override; + Status pull(doris::RuntimeState* state, Block* output_block, bool* eos) const override; const RowDescriptor& intermediate_row_desc() const override { return _old_version_flag ? _row_descriptor : *_intermediate_row_desc; @@ -231,12 +230,11 @@ class NestedLoopJoinProbeOperatorX final private: friend class NestedLoopJoinProbeLocalState; bool _is_output_left_side_only; - vectorized::VExprContextSPtrs _join_conjuncts; + VExprContextSPtrs _join_conjuncts; size_t _num_probe_side_columns = 0; size_t _num_build_side_columns = 0; const bool _old_version_flag; }; -} // namespace pipeline } // namespace doris #include "common/compile_check_end.h" \ No newline at end of file diff --git a/be/src/pipeline/exec/olap_scan_operator.cpp b/be/src/exec/operator/olap_scan_operator.cpp similarity index 94% rename from be/src/pipeline/exec/olap_scan_operator.cpp rename to be/src/exec/operator/olap_scan_operator.cpp index 6fa5f52c0e8fbf..bd63d33a59dbf9 100644 --- a/be/src/pipeline/exec/olap_scan_operator.cpp +++ b/be/src/exec/operator/olap_scan_operator.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/exec/olap_scan_operator.h" +#include "exec/operator/olap_scan_operator.h" #include @@ -28,27 +28,27 @@ #include "cloud/cloud_tablet.h" #include "cloud/cloud_tablet_hotspot.h" #include "cloud/config.h" +#include "exec/operator/scan_operator.h" +#include "exec/runtime_filter/runtime_filter_consumer_helper.h" +#include "exec/scan/olap_scanner.h" +#include "exec/scan/parallel_scanner_builder.h" +#include "exprs/function/in.h" +#include "exprs/score_runtime.h" +#include "exprs/vectorized_fn_call.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" +#include "exprs/vslot_ref.h" #include "io/cache/block_file_cache_profile.h" -#include "olap/parallel_scanner_builder.h" -#include "olap/rowset/segment_v2/ann_index/ann_topn_runtime.h" -#include "olap/storage_engine.h" -#include "olap/tablet_manager.h" -#include "pipeline/exec/scan_operator.h" -#include "pipeline/query_cache/query_cache.h" +#include "runtime/query_cache/query_cache.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" -#include "runtime_filter/runtime_filter_consumer_helper.h" #include "service/backend_options.h" -#include "util/runtime_profile.h" +#include "storage/index/ann/ann_topn_runtime.h" +#include "storage/storage_engine.h" +#include "storage/tablet/tablet_manager.h" #include "util/to_string.h" -#include "vec/exec/scan/olap_scanner.h" -#include "vec/exprs/score_runtime.h" -#include "vec/exprs/vectorized_fn_call.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/exprs/vslot_ref.h" -#include "vec/functions/in.h" - -namespace doris::pipeline { + +namespace doris { #include "common/compile_check_begin.h" Status OlapScanLocalState::init(RuntimeState* state, LocalStateInfo& info) { @@ -58,9 +58,9 @@ Status OlapScanLocalState::init(RuntimeState* state, LocalStateInfo& info) { const doris::TExpr& ordering_expr = olap_scan_node.score_sort_info.ordering_exprs.front(); const bool asc = olap_scan_node.score_sort_info.is_asc_order[0]; const size_t limit = olap_scan_node.score_sort_limit; - std::shared_ptr ordering_expr_ctx; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(ordering_expr, ordering_expr_ctx)); - _score_runtime = vectorized::ScoreRuntime::create_shared(ordering_expr_ctx, asc, limit); + std::shared_ptr ordering_expr_ctx; + RETURN_IF_ERROR(VExpr::create_expr_tree(ordering_expr, ordering_expr_ctx)); + _score_runtime = ScoreRuntime::create_shared(ordering_expr_ctx, asc, limit); } if (olap_scan_node.__isset.ann_sort_info || olap_scan_node.__isset.ann_sort_limit) { @@ -73,8 +73,8 @@ Status OlapScanLocalState::init(RuntimeState* state, LocalStateInfo& info) { DCHECK(olap_scan_node.ann_sort_info.is_asc_order.size() == 1); const bool asc = olap_scan_node.ann_sort_info.is_asc_order[0]; const size_t limit = olap_scan_node.ann_sort_limit; - std::shared_ptr ordering_expr_ctx; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(ordering_expr, ordering_expr_ctx)); + std::shared_ptr ordering_expr_ctx; + RETURN_IF_ERROR(VExpr::create_expr_tree(ordering_expr, ordering_expr_ctx)); _ann_topn_runtime = segment_v2::AnnTopNRuntime::create_shared(asc, limit, ordering_expr_ctx); } @@ -96,20 +96,19 @@ Status OlapScanLocalState::init(RuntimeState* state, LocalStateInfo& info) { } PushDownType OlapScanLocalState::_should_push_down_binary_predicate( - vectorized::VectorizedFnCall* fn_call, vectorized::VExprContext* expr_ctx, - vectorized::Field& constant_val, const std::set fn_name) const { + VectorizedFnCall* fn_call, VExprContext* expr_ctx, Field& constant_val, + const std::set fn_name) const { if (!fn_name.contains(fn_call->fn().name.function_name)) { return PushDownType::UNACCEPTABLE; } const auto& children = fn_call->children(); DCHECK(children.size() == 2); - DCHECK_EQ(vectorized::VExpr::expr_without_cast(children[0])->node_type(), - TExprNodeType::SLOT_REF); + DCHECK_EQ(VExpr::expr_without_cast(children[0])->node_type(), TExprNodeType::SLOT_REF); if (children[1]->is_constant()) { std::shared_ptr const_col_wrapper; THROW_IF_ERROR(children[1]->get_const_col(expr_ctx, &const_col_wrapper)); const auto* const_column = - assert_cast(const_col_wrapper->column_ptr.get()); + assert_cast(const_col_wrapper->column_ptr.get()); constant_val = const_column->operator[](0); return PushDownType::ACCEPTABLE; } else { @@ -408,8 +407,8 @@ bool OlapScanLocalState::_is_key_column(const std::string& key_name) { return res != p._olap_scan_node.key_column_name.end(); } -Status OlapScanLocalState::_should_push_down_function_filter(vectorized::VectorizedFnCall* fn_call, - vectorized::VExprContext* expr_ctx, +Status OlapScanLocalState::_should_push_down_function_filter(VectorizedFnCall* fn_call, + VExprContext* expr_ctx, StringRef* constant_str, doris::FunctionContext** fn_ctx, PushDownType& pdt) { @@ -424,8 +423,7 @@ Status OlapScanLocalState::_should_push_down_function_filter(vectorized::Vectori DCHECK(func_cxt != nullptr); DCHECK(children.size() == 2); for (size_t i = 0; i < children.size(); i++) { - if (vectorized::VExpr::expr_without_cast(children[i])->node_type() != - TExprNodeType::SLOT_REF) { + if (VExpr::expr_without_cast(children[i])->node_type() != TExprNodeType::SLOT_REF) { // not a slot ref(column) continue; } @@ -437,8 +435,8 @@ Status OlapScanLocalState::_should_push_down_function_filter(vectorized::Vectori DCHECK(is_string_type(children[1 - i]->data_type()->get_primitive_type())); std::shared_ptr const_col_wrapper; RETURN_IF_ERROR(children[1 - i]->get_const_col(expr_ctx, &const_col_wrapper)); - if (const auto* const_column = check_and_get_column( - const_col_wrapper->column_ptr.get())) { + if (const auto* const_column = + check_and_get_column(const_col_wrapper->column_ptr.get())) { *constant_str = const_column->get_data_at(0); } else { pdt = PushDownType::UNACCEPTABLE; @@ -463,7 +461,7 @@ bool OlapScanLocalState::_storage_no_merge() { p._olap_scan_node.enable_unique_key_merge_on_write)); } -Status OlapScanLocalState::_init_scanners(std::list* scanners) { +Status OlapScanLocalState::_init_scanners(std::list* scanners) { if (_scan_ranges.empty()) { _eos = true; _scan_dependency->set_ready(); @@ -532,7 +530,7 @@ Status OlapScanLocalState::_init_scanners(std::list* sc RETURN_IF_ERROR(scanner_builder.build_scanners(*scanners)); for (auto& scanner : *scanners) { - auto* olap_scanner = assert_cast(scanner.get()); + auto* olap_scanner = assert_cast(scanner.get()); RETURN_IF_ERROR(olap_scanner->init(state(), _conjuncts)); } @@ -582,17 +580,17 @@ Status OlapScanLocalState::_init_scanners(std::list* sc for (auto& split : _read_sources[scan_range_idx].rs_splits) { split.rs_reader = split.rs_reader->clone(); } - auto scanner = vectorized::OlapScanner::create_shared( - this, vectorized::OlapScanner::Params { - state(), - _scanner_profile.get(), - scanner_ranges, - _tablets[scan_range_idx].tablet, - version, - _read_sources[scan_range_idx], - p._limit, - p._olap_scan_node.is_preaggregation, - }); + auto scanner = + OlapScanner::create_shared(this, OlapScanner::Params { + state(), + _scanner_profile.get(), + scanner_ranges, + _tablets[scan_range_idx].tablet, + version, + _read_sources[scan_range_idx], + p._limit, + p._olap_scan_node.is_preaggregation, + }); RETURN_IF_ERROR(scanner->init(state(), _conjuncts)); scanners->push_back(std::move(scanner)); } @@ -794,9 +792,8 @@ Status OlapScanLocalState::open(RuntimeState* state) { const SlotDescriptor* slot_desc = pair.second; std::shared_ptr virtual_col_expr = slot_desc->get_virtual_column_expr(); if (virtual_col_expr) { - std::shared_ptr virtual_column_expr_ctx; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(*virtual_col_expr, - virtual_column_expr_ctx)); + std::shared_ptr virtual_column_expr_ctx; + RETURN_IF_ERROR(VExpr::create_expr_tree(*virtual_col_expr, virtual_column_expr_ctx)); RETURN_IF_ERROR(virtual_column_expr_ctx->prepare(state, p.intermediate_row_desc())); RETURN_IF_ERROR(virtual_column_expr_ctx->open(state)); @@ -1011,4 +1008,4 @@ OlapScanOperatorX::OlapScanOperatorX(ObjectPool* pool, const TPlanNode& tnode, i } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/olap_scan_operator.h b/be/src/exec/operator/olap_scan_operator.h similarity index 93% rename from be/src/pipeline/exec/olap_scan_operator.h rename to be/src/exec/operator/olap_scan_operator.h index 5077b46b7cb819..c3b4e8838cf16d 100644 --- a/be/src/pipeline/exec/olap_scan_operator.h +++ b/be/src/exec/operator/olap_scan_operator.h @@ -23,16 +23,16 @@ #include "cloud/cloud_tablet.h" #include "common/status.h" -#include "olap/tablet_reader.h" -#include "operator.h" -#include "pipeline/exec/scan_operator.h" -#include "util/runtime_profile.h" +#include "exec/operator/operator.h" +#include "exec/operator/scan_operator.h" +#include "runtime/runtime_profile.h" +#include "storage/tablet/tablet_reader.h" -namespace doris::vectorized { +namespace doris { class OlapScanner; -} // namespace doris::vectorized +} // namespace doris -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class OlapScanOperatorX; @@ -63,7 +63,7 @@ class OlapScanLocalState final : public ScanLocalState { Status open(RuntimeState* state) override; private: - friend class vectorized::OlapScanner; + friend class OlapScanner; Status _sync_cloud_tablets(RuntimeState* state); void set_scan_ranges(RuntimeState* state, @@ -72,8 +72,7 @@ class OlapScanLocalState final : public ScanLocalState { Status _process_conjuncts(RuntimeState* state) override; bool _is_key_column(const std::string& col_name) override; - Status _should_push_down_function_filter(vectorized::VectorizedFnCall* fn_call, - vectorized::VExprContext* expr_ctx, + Status _should_push_down_function_filter(VectorizedFnCall* fn_call, VExprContext* expr_ctx, StringRef* constant_str, doris::FunctionContext** fn_ctx, PushDownType& pdt) override; @@ -87,8 +86,7 @@ class OlapScanLocalState final : public ScanLocalState { return PushDownType::ACCEPTABLE; } - PushDownType _should_push_down_is_null_predicate( - vectorized::VectorizedFnCall* fn_call) const override { + PushDownType _should_push_down_is_null_predicate(VectorizedFnCall* fn_call) const override { return fn_call->fn().name.function_name == "is_null_pred" || fn_call->fn().name.function_name == "is_not_null_pred" ? PushDownType::ACCEPTABLE @@ -98,14 +96,14 @@ class OlapScanLocalState final : public ScanLocalState { return PushDownType::ACCEPTABLE; } PushDownType _should_push_down_binary_predicate( - vectorized::VectorizedFnCall* fn_call, vectorized::VExprContext* expr_ctx, - vectorized::Field& constant_val, const std::set fn_name) const override; + VectorizedFnCall* fn_call, VExprContext* expr_ctx, Field& constant_val, + const std::set fn_name) const override; bool _should_push_down_common_expr() override; bool _storage_no_merge() override; - bool _push_down_topn(const vectorized::RuntimePredicate& predicate) override { + bool _push_down_topn(const RuntimePredicate& predicate) override { if (!predicate.target_is_slot(_parent->node_id())) { return false; } @@ -117,7 +115,7 @@ class OlapScanLocalState final : public ScanLocalState { return _is_key_column(predicate.get_col_name(_parent->node_id())); } - Status _init_scanners(std::list* scanners) override; + Status _init_scanners(std::list* scanners) override; Status _build_key_ranges_and_filters(); @@ -313,10 +311,10 @@ class OlapScanLocalState final : public ScanLocalState { std::vector _tablets; std::vector _read_sources; - std::map _slot_id_to_virtual_column_expr; + std::map _slot_id_to_virtual_column_expr; std::map _slot_id_to_index_in_block; // this map is needed for scanner opening. - std::map _slot_id_to_col_type; + std::map _slot_id_to_col_type; }; class OlapScanOperatorX final : public ScanOperatorX { @@ -341,4 +339,4 @@ class OlapScanOperatorX final : public ScanOperatorX { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/olap_table_sink_operator.h b/be/src/exec/operator/olap_table_sink_operator.h similarity index 76% rename from be/src/pipeline/exec/olap_table_sink_operator.h rename to be/src/exec/operator/olap_table_sink_operator.h index 755fa6cdc21781..55b45e8a55ee85 100644 --- a/be/src/pipeline/exec/olap_table_sink_operator.h +++ b/be/src/exec/operator/olap_table_sink_operator.h @@ -17,18 +17,18 @@ #pragma once -#include "operator.h" -#include "vec/sink/writer/vtablet_writer.h" +#include "exec/operator/operator.h" +#include "exec/sink/writer/vtablet_writer.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class OlapTableSinkOperatorX; class OlapTableSinkLocalState final - : public AsyncWriterSink { + : public AsyncWriterSink { public: - using Base = AsyncWriterSink; + using Base = AsyncWriterSink; using Parent = OlapTableSinkOperatorX; ENABLE_FACTORY_CREATOR(OlapTableSinkLocalState); OlapTableSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state) @@ -48,17 +48,17 @@ class OlapTableSinkOperatorX final : public DataSinkOperatorXrows()); @@ -68,13 +68,13 @@ class OlapTableSinkOperatorX final : public DataSinkOperatorX - requires(std::is_base_of_v) + requires(std::is_base_of_v) friend class AsyncWriterSink; const RowDescriptor& _row_desc; - vectorized::VExprContextSPtrs _output_vexpr_ctxs; + VExprContextSPtrs _output_vexpr_ctxs; const std::vector& _t_output_expr; ObjectPool* _pool = nullptr; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/olap_table_sink_v2_operator.h b/be/src/exec/operator/olap_table_sink_v2_operator.h similarity index 77% rename from be/src/pipeline/exec/olap_table_sink_v2_operator.h rename to be/src/exec/operator/olap_table_sink_v2_operator.h index af49c34d581db4..0426a7b59d4f14 100644 --- a/be/src/pipeline/exec/olap_table_sink_v2_operator.h +++ b/be/src/exec/operator/olap_table_sink_v2_operator.h @@ -17,18 +17,18 @@ #pragma once -#include "operator.h" -#include "vec/sink/writer/vtablet_writer_v2.h" +#include "exec/operator/operator.h" +#include "exec/sink/writer/vtablet_writer_v2.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class OlapTableSinkV2OperatorX; class OlapTableSinkV2LocalState final - : public AsyncWriterSink { + : public AsyncWriterSink { public: - using Base = AsyncWriterSink; + using Base = AsyncWriterSink; using Parent = OlapTableSinkV2OperatorX; ENABLE_FACTORY_CREATOR(OlapTableSinkV2LocalState); OlapTableSinkV2LocalState(DataSinkOperatorXBase* parent, RuntimeState* state) @@ -49,17 +49,17 @@ class OlapTableSinkV2OperatorX final : public DataSinkOperatorXrows()); @@ -74,13 +74,13 @@ class OlapTableSinkV2OperatorX final : public DataSinkOperatorX - requires(std::is_base_of_v) + requires(std::is_base_of_v) friend class AsyncWriterSink; const RowDescriptor& _row_desc; - vectorized::VExprContextSPtrs _output_vexpr_ctxs; + VExprContextSPtrs _output_vexpr_ctxs; const std::vector& _t_output_expr; ObjectPool* _pool = nullptr; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/operator.cpp b/be/src/exec/operator/operator.cpp similarity index 82% rename from be/src/pipeline/exec/operator.cpp rename to be/src/exec/operator/operator.cpp index ff874075602749..88c238941013f0 100644 --- a/be/src/pipeline/exec/operator.cpp +++ b/be/src/exec/operator/operator.cpp @@ -15,81 +15,81 @@ // specific language governing permissions and limitations // under the License. -#include "operator.h" +#include "exec/operator/operator.h" #include "common/status.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/aggregation_sink_operator.h" -#include "pipeline/exec/aggregation_source_operator.h" -#include "pipeline/exec/analytic_sink_operator.h" -#include "pipeline/exec/analytic_source_operator.h" -#include "pipeline/exec/assert_num_rows_operator.h" -#include "pipeline/exec/blackhole_sink_operator.h" -#include "pipeline/exec/cache_sink_operator.h" -#include "pipeline/exec/cache_source_operator.h" -#include "pipeline/exec/datagen_operator.h" -#include "pipeline/exec/dict_sink_operator.h" -#include "pipeline/exec/distinct_streaming_aggregation_operator.h" -#include "pipeline/exec/empty_set_operator.h" -#include "pipeline/exec/es_scan_operator.h" -#include "pipeline/exec/exchange_sink_operator.h" -#include "pipeline/exec/exchange_source_operator.h" -#include "pipeline/exec/file_scan_operator.h" -#include "pipeline/exec/group_commit_block_sink_operator.h" -#include "pipeline/exec/group_commit_scan_operator.h" -#include "pipeline/exec/hashjoin_build_sink.h" -#include "pipeline/exec/hashjoin_probe_operator.h" -#include "pipeline/exec/hive_table_sink_operator.h" -#include "pipeline/exec/iceberg_table_sink_operator.h" -#include "pipeline/exec/jdbc_scan_operator.h" -#include "pipeline/exec/jdbc_table_sink_operator.h" -#include "pipeline/exec/local_merge_sort_source_operator.h" -#include "pipeline/exec/materialization_opertor.h" -#include "pipeline/exec/maxcompute_table_sink_operator.h" -#include "pipeline/exec/memory_scratch_sink_operator.h" -#include "pipeline/exec/meta_scan_operator.h" -#include "pipeline/exec/mock_operator.h" -#include "pipeline/exec/mock_scan_operator.h" -#include "pipeline/exec/multi_cast_data_stream_sink.h" -#include "pipeline/exec/multi_cast_data_stream_source.h" -#include "pipeline/exec/nested_loop_join_build_operator.h" -#include "pipeline/exec/nested_loop_join_probe_operator.h" -#include "pipeline/exec/olap_scan_operator.h" -#include "pipeline/exec/olap_table_sink_operator.h" -#include "pipeline/exec/olap_table_sink_v2_operator.h" -#include "pipeline/exec/partition_sort_sink_operator.h" -#include "pipeline/exec/partition_sort_source_operator.h" -#include "pipeline/exec/partitioned_aggregation_sink_operator.h" -#include "pipeline/exec/partitioned_aggregation_source_operator.h" -#include "pipeline/exec/partitioned_hash_join_probe_operator.h" -#include "pipeline/exec/partitioned_hash_join_sink_operator.h" -#include "pipeline/exec/repeat_operator.h" -#include "pipeline/exec/result_file_sink_operator.h" -#include "pipeline/exec/result_sink_operator.h" -#include "pipeline/exec/schema_scan_operator.h" -#include "pipeline/exec/select_operator.h" -#include "pipeline/exec/set_probe_sink_operator.h" -#include "pipeline/exec/set_sink_operator.h" -#include "pipeline/exec/set_source_operator.h" -#include "pipeline/exec/sort_sink_operator.h" -#include "pipeline/exec/sort_source_operator.h" -#include "pipeline/exec/spill_iceberg_table_sink_operator.h" -#include "pipeline/exec/spill_sort_sink_operator.h" -#include "pipeline/exec/spill_sort_source_operator.h" -#include "pipeline/exec/streaming_aggregation_operator.h" -#include "pipeline/exec/table_function_operator.h" -#include "pipeline/exec/tvf_table_sink_operator.h" -#include "pipeline/exec/union_sink_operator.h" -#include "pipeline/exec/union_source_operator.h" -#include "pipeline/local_exchange/local_exchange_sink_operator.h" -#include "pipeline/local_exchange/local_exchange_source_operator.h" -#include "pipeline/pipeline.h" +#include "exec/common/util.hpp" +#include "exec/exchange/local_exchange_sink_operator.h" +#include "exec/exchange/local_exchange_source_operator.h" +#include "exec/operator/aggregation_sink_operator.h" +#include "exec/operator/aggregation_source_operator.h" +#include "exec/operator/analytic_sink_operator.h" +#include "exec/operator/analytic_source_operator.h" +#include "exec/operator/assert_num_rows_operator.h" +#include "exec/operator/blackhole_sink_operator.h" +#include "exec/operator/cache_sink_operator.h" +#include "exec/operator/cache_source_operator.h" +#include "exec/operator/datagen_operator.h" +#include "exec/operator/dict_sink_operator.h" +#include "exec/operator/distinct_streaming_aggregation_operator.h" +#include "exec/operator/empty_set_operator.h" +#include "exec/operator/es_scan_operator.h" +#include "exec/operator/exchange_sink_operator.h" +#include "exec/operator/exchange_source_operator.h" +#include "exec/operator/file_scan_operator.h" +#include "exec/operator/group_commit_block_sink_operator.h" +#include "exec/operator/group_commit_scan_operator.h" +#include "exec/operator/hashjoin_build_sink.h" +#include "exec/operator/hashjoin_probe_operator.h" +#include "exec/operator/hive_table_sink_operator.h" +#include "exec/operator/iceberg_table_sink_operator.h" +#include "exec/operator/jdbc_scan_operator.h" +#include "exec/operator/jdbc_table_sink_operator.h" +#include "exec/operator/local_merge_sort_source_operator.h" +#include "exec/operator/materialization_opertor.h" +#include "exec/operator/maxcompute_table_sink_operator.h" +#include "exec/operator/memory_scratch_sink_operator.h" +#include "exec/operator/meta_scan_operator.h" +#include "exec/operator/mock_operator.h" +#include "exec/operator/mock_scan_operator.h" +#include "exec/operator/multi_cast_data_stream_sink.h" +#include "exec/operator/multi_cast_data_stream_source.h" +#include "exec/operator/nested_loop_join_build_operator.h" +#include "exec/operator/nested_loop_join_probe_operator.h" +#include "exec/operator/olap_scan_operator.h" +#include "exec/operator/olap_table_sink_operator.h" +#include "exec/operator/olap_table_sink_v2_operator.h" +#include "exec/operator/partition_sort_sink_operator.h" +#include "exec/operator/partition_sort_source_operator.h" +#include "exec/operator/partitioned_aggregation_sink_operator.h" +#include "exec/operator/partitioned_aggregation_source_operator.h" +#include "exec/operator/partitioned_hash_join_probe_operator.h" +#include "exec/operator/partitioned_hash_join_sink_operator.h" +#include "exec/operator/repeat_operator.h" +#include "exec/operator/result_file_sink_operator.h" +#include "exec/operator/result_sink_operator.h" +#include "exec/operator/schema_scan_operator.h" +#include "exec/operator/select_operator.h" +#include "exec/operator/set_probe_sink_operator.h" +#include "exec/operator/set_sink_operator.h" +#include "exec/operator/set_source_operator.h" +#include "exec/operator/sort_sink_operator.h" +#include "exec/operator/sort_source_operator.h" +#include "exec/operator/spill_iceberg_table_sink_operator.h" +#include "exec/operator/spill_sort_sink_operator.h" +#include "exec/operator/spill_sort_source_operator.h" +#include "exec/operator/streaming_aggregation_operator.h" +#include "exec/operator/table_function_operator.h" +#include "exec/operator/tvf_table_sink_operator.h" +#include "exec/operator/union_sink_operator.h" +#include "exec/operator/union_source_operator.h" +#include "exec/pipeline/dependency.h" +#include "exec/pipeline/pipeline.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" +#include "runtime/runtime_profile.h" #include "util/debug_util.h" -#include "util/runtime_profile.h" #include "util/string_util.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/utils/util.hpp" namespace doris { #include "common/compile_check_begin.h" @@ -97,7 +97,7 @@ class RowDescriptor; class RuntimeState; } // namespace doris -namespace doris::pipeline { +namespace doris { Status OperatorBase::close(RuntimeState* state) { if (_is_closed) { @@ -197,8 +197,8 @@ Status OperatorXBase::init(const TPlanNode& tnode, RuntimeState* state) { return Status::InternalError("vconjunct is not supported yet"); } else if (tnode.__isset.conjuncts) { for (const auto& conjunct : tnode.conjuncts) { - vectorized::VExprContextSPtr context; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(conjunct, context)); + VExprContextSPtr context; + RETURN_IF_ERROR(VExpr::create_expr_tree(conjunct, context)); _conjuncts.emplace_back(context); } } @@ -206,14 +206,14 @@ Status OperatorXBase::init(const TPlanNode& tnode, RuntimeState* state) { // create the projections expr if (tnode.__isset.projections) { DCHECK(tnode.__isset.output_tuple_id); - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(tnode.projections, _projections)); + RETURN_IF_ERROR(VExpr::create_expr_trees(tnode.projections, _projections)); } if (!tnode.intermediate_projections_list.empty()) { DCHECK(tnode.__isset.projections) << "no final projections"; _intermediate_projections.reserve(tnode.intermediate_projections_list.size()); for (const auto& tnode_projections : tnode.intermediate_projections_list) { - vectorized::VExprContextSPtrs projections; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(tnode_projections, projections)); + VExprContextSPtrs projections; + RETURN_IF_ERROR(VExpr::create_expr_trees(tnode_projections, projections)); _intermediate_projections.push_back(projections); } } @@ -231,29 +231,29 @@ Status OperatorXBase::prepare(RuntimeState* state) { }; for (int i = 0; i < _intermediate_projections.size(); i++) { - RETURN_IF_ERROR(vectorized::VExpr::prepare(_intermediate_projections[i], state, + RETURN_IF_ERROR(VExpr::prepare(_intermediate_projections[i], state, intermediate_row_desc(i))); } - RETURN_IF_ERROR(vectorized::VExpr::prepare(_projections, state, projections_row_desc())); + RETURN_IF_ERROR(VExpr::prepare(_projections, state, projections_row_desc())); if (has_output_row_desc()) { RETURN_IF_ERROR( - vectorized::VExpr::check_expr_output_type(_projections, *_output_row_descriptor)); + VExpr::check_expr_output_type(_projections, *_output_row_descriptor)); } for (auto& conjunct : _conjuncts) { RETURN_IF_ERROR(conjunct->open(state)); } - RETURN_IF_ERROR(vectorized::VExpr::open(_projections, state)); + RETURN_IF_ERROR(VExpr::open(_projections, state)); for (auto& projections : _intermediate_projections) { - RETURN_IF_ERROR(vectorized::VExpr::open(projections, state)); + RETURN_IF_ERROR(VExpr::open(projections, state)); } if (_child && !is_source()) { RETURN_IF_ERROR(_child->prepare(state)); } - if (vectorized::VExpr::contains_blockable_function(_conjuncts) || - vectorized::VExpr::contains_blockable_function(_projections)) { + if (VExpr::contains_blockable_function(_conjuncts) || + VExpr::contains_blockable_function(_projections)) { _blockable = true; } @@ -286,22 +286,22 @@ void PipelineXLocalStateBase::clear_origin_block() { _origin_block.clear_column_data(_parent->intermediate_row_desc().num_materialized_slots()); } -Status PipelineXLocalStateBase::filter_block(const vectorized::VExprContextSPtrs& expr_contexts, - vectorized::Block* block, size_t column_to_keep) { - RETURN_IF_ERROR(vectorized::VExprContext::filter_block(expr_contexts, block, column_to_keep)); +Status PipelineXLocalStateBase::filter_block(const VExprContextSPtrs& expr_contexts, + Block* block, size_t column_to_keep) { + RETURN_IF_ERROR(VExprContext::filter_block(expr_contexts, block, column_to_keep)); - _estimate_memory_usage += vectorized::VExprContext::get_memory_usage(expr_contexts); + _estimate_memory_usage += VExprContext::get_memory_usage(expr_contexts); return Status::OK(); } bool PipelineXLocalStateBase::is_blockable() const { return std::any_of( _projections.begin(), _projections.end(), - [&](vectorized::VExprContextSPtr expr) -> bool { return expr->is_blockable(); }); + [&](VExprContextSPtr expr) -> bool { return expr->is_blockable(); }); } -Status OperatorXBase::do_projections(RuntimeState* state, vectorized::Block* origin_block, - vectorized::Block* output_block) const { +Status OperatorXBase::do_projections(RuntimeState* state, Block* origin_block, + Block* output_block) const { auto* local_state = state->get_local_state(operator_id()); SCOPED_TIMER(local_state->exec_time_counter()); SCOPED_TIMER(local_state->_projection_timer); @@ -309,25 +309,25 @@ Status OperatorXBase::do_projections(RuntimeState* state, vectorized::Block* ori if (rows == 0) { return Status::OK(); } - vectorized::Block input_block = *origin_block; + Block input_block = *origin_block; size_t bytes_usage = 0; - vectorized::ColumnsWithTypeAndName new_columns; + ColumnsWithTypeAndName new_columns; for (const auto& projections : local_state->_intermediate_projections) { new_columns.resize(projections.size()); for (int i = 0; i < projections.size(); i++) { RETURN_IF_ERROR(projections[i]->execute(&input_block, new_columns[i])); } - vectorized::Block tmp_block {new_columns}; + Block tmp_block {new_columns}; bytes_usage += tmp_block.allocated_bytes(); input_block.swap(tmp_block); } DCHECK_EQ(rows, input_block.rows()); - auto insert_column_datas = [&](auto& to, vectorized::ColumnPtr& from, size_t rows) { + auto insert_column_datas = [&](auto& to, ColumnPtr& from, size_t rows) { if (to->is_nullable() && !from->is_nullable()) { if (_keep_origin || !from->is_exclusive()) { - auto& null_column = reinterpret_cast(*to); + auto& null_column = reinterpret_cast(*to); null_column.get_nested_column().insert_range_from(*from, 0, rows); null_column.get_null_map_column().get_data().resize_fill(rows, 0); bytes_usage += null_column.allocated_bytes(); @@ -344,9 +344,8 @@ Status OperatorXBase::do_projections(RuntimeState* state, vectorized::Block* ori } }; - using namespace vectorized; - vectorized::MutableBlock mutable_block = - vectorized::VectorizedUtils::build_mutable_mem_reuse_block(output_block, + MutableBlock mutable_block = + VectorizedUtils::build_mutable_mem_reuse_block(output_block, *_output_row_descriptor); if (rows != 0) { auto& mutable_columns = mutable_block.mutable_columns(); @@ -371,7 +370,7 @@ Status OperatorXBase::do_projections(RuntimeState* state, vectorized::Block* ori return Status::OK(); } -Status OperatorXBase::get_block_after_projects(RuntimeState* state, vectorized::Block* block, +Status OperatorXBase::get_block_after_projects(RuntimeState* state, Block* block, bool* eos) { DBUG_EXECUTE_IF("Pipeline::return_empty_block", { if (this->_op_name == "AGGREGATION_OPERATOR" || this->_op_name == "HASH_JOIN_OPERATOR" || @@ -408,7 +407,7 @@ Status OperatorXBase::get_block_after_projects(RuntimeState* state, vectorized:: return status; } -void PipelineXLocalStateBase::reached_limit(vectorized::Block* block, bool* eos) { +void PipelineXLocalStateBase::reached_limit(Block* block, bool* eos) { if (_parent->_limit != -1 and _num_rows_returned + block->rows() >= _parent->_limit) { block->set_num_rows(_parent->_limit - _num_rows_returned); *eos = true; @@ -688,14 +687,14 @@ Status PipelineXSinkLocalState::close(RuntimeState* state, Status e } template -Status StreamingOperatorX::get_block(RuntimeState* state, vectorized::Block* block, +Status StreamingOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { RETURN_IF_ERROR(OperatorX::_child->get_block_after_projects(state, block, eos)); return pull(state, block, eos); } template -Status StatefulOperatorX::get_block(RuntimeState* state, vectorized::Block* block, +Status StatefulOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { auto& local_state = get_local_state(state); if (need_more_input_data(state)) { @@ -727,7 +726,7 @@ Status StatefulOperatorX::get_block(RuntimeState* state, vectori } template - requires(std::is_base_of_v) + requires(std::is_base_of_v) Status AsyncWriterSink::init(RuntimeState* state, LocalSinkStateInfo& info) { RETURN_IF_ERROR(Base::init(state, info)); _async_writer_dependency = Dependency::create_shared(_parent->operator_id(), _parent->node_id(), @@ -741,7 +740,7 @@ Status AsyncWriterSink::init(RuntimeState* state, LocalSinkState } template - requires(std::is_base_of_v) + requires(std::is_base_of_v) Status AsyncWriterSink::open(RuntimeState* state) { RETURN_IF_ERROR(Base::open(state)); _output_vexpr_ctxs.resize(_parent->cast()._output_vexpr_ctxs.size()); @@ -754,14 +753,14 @@ Status AsyncWriterSink::open(RuntimeState* state) { } template - requires(std::is_base_of_v) -Status AsyncWriterSink::sink(RuntimeState* state, vectorized::Block* block, + requires(std::is_base_of_v) +Status AsyncWriterSink::sink(RuntimeState* state, Block* block, bool eos) { return _writer->sink(block, eos); } template - requires(std::is_base_of_v) + requires(std::is_base_of_v) Status AsyncWriterSink::close(RuntimeState* state, Status exec_status) { if (_closed) { return Status::OK(); @@ -904,16 +903,16 @@ template class PipelineXLocalState; template class PipelineXLocalState; template class PipelineXLocalState; -template class AsyncWriterSink; -template class AsyncWriterSink; -template class AsyncWriterSink; -template class AsyncWriterSink; -template class AsyncWriterSink; -template class AsyncWriterSink; -template class AsyncWriterSink; +template class AsyncWriterSink; +template class AsyncWriterSink; +template class AsyncWriterSink; +template class AsyncWriterSink; +template class AsyncWriterSink; +template class AsyncWriterSink; -template class AsyncWriterSink; -template class AsyncWriterSink; +template class AsyncWriterSink; +template class AsyncWriterSink; #ifdef BE_TEST template class OperatorX; @@ -921,4 +920,4 @@ template class DataSinkOperatorX; #endif #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/operator.h b/be/src/exec/operator/operator.h similarity index 95% rename from be/src/pipeline/exec/operator.h rename to be/src/exec/operator/operator.h index 080b8647a3665d..da759d95f2fc11 100644 --- a/be/src/pipeline/exec/operator.h +++ b/be/src/exec/operator/operator.h @@ -31,31 +31,29 @@ #include "common/be_mock_util.h" #include "common/logging.h" #include "common/status.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/operator.h" -#include "pipeline/exec/spill_utils.h" -#include "pipeline/local_exchange/local_exchanger.h" +#include "core/block/block.h" +#include "exec/exchange/local_exchanger.h" +#include "exec/exchange/vdata_stream_recvr.h" +#include "exec/operator/operator.h" +#include "exec/operator/spill_utils.h" +#include "exec/pipeline/dependency.h" #include "runtime/memory/mem_tracker.h" #include "runtime/query_context.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" #include "runtime/thread_context.h" -#include "util/runtime_profile.h" -#include "vec/core/block.h" -#include "vec/runtime/vdata_stream_recvr.h" namespace doris { #include "common/compile_check_begin.h" class RowDescriptor; class RuntimeState; class TDataSink; -namespace vectorized { class AsyncResultWriter; class ScoreRuntime; class AnnTopNRuntime; -} // namespace vectorized } // namespace doris -namespace doris::pipeline { +namespace doris { class OperatorBase; class OperatorXBase; @@ -236,7 +234,7 @@ class PipelineXLocalStateBase { // If use projection, we should clear `_origin_block`. void clear_origin_block(); - void reached_limit(vectorized::Block* block, bool* eos); + void reached_limit(Block* block, bool* eos); RuntimeProfile* operator_profile() { return _operator_profile.get(); } RuntimeProfile* common_profile() { return _common_profile.get(); } RuntimeProfile* custom_profile() { return _custom_profile.get(); } @@ -245,8 +243,8 @@ class PipelineXLocalStateBase { RuntimeProfile::Counter* memory_used_counter() { return _memory_used_counter; } OperatorXBase* parent() { return _parent; } RuntimeState* state() { return _state; } - vectorized::VExprContextSPtrs& conjuncts() { return _conjuncts; } - vectorized::VExprContextSPtrs& projections() { return _projections; } + VExprContextSPtrs& conjuncts() { return _conjuncts; } + VExprContextSPtrs& projections() { return _projections; } [[nodiscard]] int64_t num_rows_returned() const { return _num_rows_returned; } void add_num_rows_returned(int64_t delta) { _num_rows_returned += delta; } void set_num_rows_returned(int64_t value) { _num_rows_returned = value; } @@ -261,8 +259,8 @@ class PipelineXLocalStateBase { // override in Scan MultiCastSink virtual std::vector execution_dependencies() { return {}; } - Status filter_block(const vectorized::VExprContextSPtrs& expr_contexts, - vectorized::Block* block, size_t column_to_keep); + Status filter_block(const VExprContextSPtrs& expr_contexts, + Block* block, size_t column_to_keep); int64_t& estimate_memory_usage() { return _estimate_memory_usage; } @@ -316,16 +314,16 @@ class PipelineXLocalStateBase { OperatorXBase* _parent = nullptr; RuntimeState* _state = nullptr; - vectorized::VExprContextSPtrs _conjuncts; - vectorized::VExprContextSPtrs _projections; - std::shared_ptr _score_runtime; + VExprContextSPtrs _conjuncts; + VExprContextSPtrs _projections; + std::shared_ptr _score_runtime; std::shared_ptr _ann_topn_runtime; // Used in common subexpression elimination to compute intermediate results. - std::vector _intermediate_projections; + std::vector _intermediate_projections; bool _closed = false; std::atomic _terminated = false; - vectorized::Block _origin_block; + Block _origin_block; }; template @@ -663,7 +661,7 @@ class DataSinkOperatorXBase : public OperatorBase { return result.value()->is_finished(); } - [[nodiscard]] virtual Status sink(RuntimeState* state, vectorized::Block* block, bool eos) = 0; + [[nodiscard]] virtual Status sink(RuntimeState* state, Block* block, bool eos) = 0; [[nodiscard]] virtual Status setup_local_state(RuntimeState* state, LocalSinkStateInfo& info) = 0; @@ -729,7 +727,7 @@ class DataSinkOperatorXBase : public OperatorBase { protected: template - requires(std::is_base_of_v) + requires(std::is_base_of_v) friend class AsyncWriterSink; // _operator_id : the current Operator's ID, which is not visible to the user. // _node_id : the plan node ID corresponding to the Operator, which is visible on the profile. @@ -922,7 +920,7 @@ class OperatorXBase : public OperatorBase { Status prepare(RuntimeState* state) override; Status terminate(RuntimeState* state) override; - [[nodiscard]] virtual Status get_block(RuntimeState* state, vectorized::Block* block, + [[nodiscard]] virtual Status get_block(RuntimeState* state, Block* block, bool* eos) = 0; Status close(RuntimeState* state) override; @@ -979,8 +977,8 @@ class OperatorXBase : public OperatorBase { [[nodiscard]] OperatorPtr get_child() { return _child; } - [[nodiscard]] vectorized::VExprContextSPtrs& conjuncts() { return _conjuncts; } - [[nodiscard]] vectorized::VExprContextSPtrs& projections() { return _projections; } + [[nodiscard]] VExprContextSPtrs& conjuncts() { return _conjuncts; } + [[nodiscard]] VExprContextSPtrs& projections() { return _projections; } [[nodiscard]] virtual RowDescriptor& row_descriptor() { return _row_descriptor; } [[nodiscard]] int operator_id() const { return _operator_id; } @@ -1000,11 +998,11 @@ class OperatorXBase : public OperatorBase { bool has_output_row_desc() const { return _output_row_descriptor != nullptr; } [[nodiscard]] virtual Status get_block_after_projects(RuntimeState* state, - vectorized::Block* block, bool* eos); + Block* block, bool* eos); /// Only use in vectorized exec engine try to do projections to trans _row_desc -> _output_row_desc - Status do_projections(RuntimeState* state, vectorized::Block* origin_block, - vectorized::Block* output_block) const; + Status do_projections(RuntimeState* state, Block* origin_block, + Block* output_block) const; void set_parallel_tasks(int parallel_tasks) { _parallel_tasks = parallel_tasks; } int parallel_tasks() const { return _parallel_tasks; } @@ -1028,10 +1026,10 @@ class OperatorXBase : public OperatorBase { private: // The expr of operator set to private permissions, as cannot be executed concurrently, // should use local state's expr. - vectorized::VExprContextSPtrs _conjuncts; - vectorized::VExprContextSPtrs _projections; + VExprContextSPtrs _conjuncts; + VExprContextSPtrs _projections; // Used in common subexpression elimination to compute intermediate results. - std::vector _intermediate_projections; + std::vector _intermediate_projections; protected: RowDescriptor _row_descriptor; @@ -1118,9 +1116,9 @@ class StreamingOperatorX : public OperatorX { virtual ~StreamingOperatorX() = default; - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override; + Status get_block(RuntimeState* state, Block* block, bool* eos) override; - virtual Status pull(RuntimeState* state, vectorized::Block* block, bool* eos) = 0; + virtual Status pull(RuntimeState* state, Block* block, bool* eos) = 0; }; /** @@ -1144,18 +1142,18 @@ class StatefulOperatorX : public OperatorX { using OperatorX::get_local_state; - [[nodiscard]] Status get_block(RuntimeState* state, vectorized::Block* block, + [[nodiscard]] Status get_block(RuntimeState* state, Block* block, bool* eos) override; - [[nodiscard]] virtual Status pull(RuntimeState* state, vectorized::Block* block, + [[nodiscard]] virtual Status pull(RuntimeState* state, Block* block, bool* eos) const = 0; - [[nodiscard]] virtual Status push(RuntimeState* state, vectorized::Block* input_block, + [[nodiscard]] virtual Status push(RuntimeState* state, Block* input_block, bool eos) const = 0; bool need_more_input_data(RuntimeState* state) const override { return true; } }; template - requires(std::is_base_of_v) + requires(std::is_base_of_v) class AsyncWriterSink : public PipelineXSinkLocalState { public: using Base = PipelineXSinkLocalState; @@ -1170,7 +1168,7 @@ class AsyncWriterSink : public PipelineXSinkLocalState { Status open(RuntimeState* state) override; - Status sink(RuntimeState* state, vectorized::Block* block, bool eos); + Status sink(RuntimeState* state, Block* block, bool eos); std::vector dependencies() const override { return {_async_writer_dependency.get()}; @@ -1180,7 +1178,7 @@ class AsyncWriterSink : public PipelineXSinkLocalState { Dependency* finishdependency() override { return _finish_dependency.get(); } protected: - vectorized::VExprContextSPtrs _output_vexpr_ctxs; + VExprContextSPtrs _output_vexpr_ctxs; std::unique_ptr _writer; std::shared_ptr _async_writer_dependency; @@ -1221,7 +1219,7 @@ class DummyOperator final : public OperatorX { [[nodiscard]] bool is_source() const override { return true; } - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override { + Status get_block(RuntimeState* state, Block* block, bool* eos) override { *eos = _eos; return Status::OK(); } @@ -1271,7 +1269,7 @@ class DummySinkOperatorX final : public DataSinkOperatorX { public: DummySinkOperatorX(int op_id, int node_id, int dest_id) : DataSinkOperatorX(op_id, node_id, dest_id) {} - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos) override { + Status sink(RuntimeState* state, Block* in_block, bool eos) override { return _return_eof ? Status::Error("source have closed") : Status::OK(); } @@ -1297,4 +1295,4 @@ class DummySinkOperatorX final : public DataSinkOperatorX { #endif #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/partition_sort_sink_operator.cpp b/be/src/exec/operator/partition_sort_sink_operator.cpp similarity index 91% rename from be/src/pipeline/exec/partition_sort_sink_operator.cpp rename to be/src/exec/operator/partition_sort_sink_operator.cpp index e3d6f8748b9b39..7bcd90d6fd970b 100644 --- a/be/src/pipeline/exec/partition_sort_sink_operator.cpp +++ b/be/src/exec/operator/partition_sort_sink_operator.cpp @@ -15,17 +15,17 @@ // specific language governing permissions and limitations // under the License. -#include "partition_sort_sink_operator.h" +#include "exec/operator/partition_sort_sink_operator.h" #include #include #include "common/status.h" -#include "partition_sort_source_operator.h" -#include "vec/common/hash_table/hash.h" +#include "exec/common/hash_table/hash.h" +#include "exec/operator/partition_sort_source_operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" Status PartitionSortSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& info) { @@ -90,8 +90,8 @@ Status PartitionSortSinkOperatorX::init(const TPlanNode& tnode, RuntimeState* st } //partition by key if (tnode.partition_sort_node.__isset.partition_exprs) { - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees( - tnode.partition_sort_node.partition_exprs, _partition_expr_ctxs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(tnode.partition_sort_node.partition_exprs, + _partition_expr_ctxs)); } return Status::OK(); @@ -100,14 +100,13 @@ Status PartitionSortSinkOperatorX::init(const TPlanNode& tnode, RuntimeState* st Status PartitionSortSinkOperatorX::prepare(RuntimeState* state) { RETURN_IF_ERROR(DataSinkOperatorX::prepare(state)); RETURN_IF_ERROR(_vsort_exec_exprs.prepare(state, _child->row_desc(), _row_descriptor)); - RETURN_IF_ERROR(vectorized::VExpr::prepare(_partition_expr_ctxs, state, _child->row_desc())); + RETURN_IF_ERROR(VExpr::prepare(_partition_expr_ctxs, state, _child->row_desc())); RETURN_IF_ERROR(_vsort_exec_exprs.open(state)); - RETURN_IF_ERROR(vectorized::VExpr::open(_partition_expr_ctxs, state)); + RETURN_IF_ERROR(VExpr::open(_partition_expr_ctxs, state)); return Status::OK(); } -Status PartitionSortSinkOperatorX::sink(RuntimeState* state, vectorized::Block* input_block, - bool eos) { +Status PartitionSortSinkOperatorX::sink(RuntimeState* state, Block* input_block, bool eos) { auto& local_state = get_local_state(state); auto current_rows = input_block->rows(); SCOPED_TIMER(local_state.exec_time_counter()); @@ -179,9 +178,9 @@ Status PartitionSortSinkOperatorX::sink(RuntimeState* state, vectorized::Block* } Status PartitionSortSinkOperatorX::_split_block_by_partition( - vectorized::Block* input_block, PartitionSortSinkLocalState& local_state, bool eos) { - vectorized::ColumnRawPtrs key_columns_raw_ptr(_partition_exprs_num); - vectorized::Columns key_columns(_partition_exprs_num); + Block* input_block, PartitionSortSinkLocalState& local_state, bool eos) { + ColumnRawPtrs key_columns_raw_ptr(_partition_exprs_num); + Columns key_columns(_partition_exprs_num); for (int i = 0; i < _partition_exprs_num; ++i) { RETURN_IF_ERROR(_partition_expr_ctxs[i]->execute(input_block, key_columns[i])); key_columns_raw_ptr[i] = key_columns[i].get(); @@ -193,21 +192,21 @@ Status PartitionSortSinkOperatorX::_split_block_by_partition( size_t PartitionSortSinkOperatorX::get_reserve_mem_size(RuntimeState* state, bool eos) { auto& local_state = get_local_state(state); auto rows = state->batch_size(); - size_t reserve_mem_size = std::visit( - vectorized::Overload {[&](std::monostate&) -> size_t { return 0; }, - [&](auto& agg_method) -> size_t { - return agg_method.hash_table->estimate_memory(rows); - }}, - local_state._partitioned_data->method_variant); + size_t reserve_mem_size = + std::visit(Overload {[&](std::monostate&) -> size_t { return 0; }, + [&](auto& agg_method) -> size_t { + return agg_method.hash_table->estimate_memory(rows); + }}, + local_state._partitioned_data->method_variant); reserve_mem_size += rows * sizeof(size_t); // hash values return reserve_mem_size; } Status PartitionSortSinkOperatorX::_emplace_into_hash_table( - const vectorized::ColumnRawPtrs& key_columns, vectorized::Block* input_block, + const ColumnRawPtrs& key_columns, Block* input_block, PartitionSortSinkLocalState& local_state, bool eos) { return std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) -> Status { return Status::InternalError("Unit hash table"); }, @@ -302,4 +301,4 @@ bool PartitionSortSinkLocalState::check_whether_need_passthrough() { // NOLINTEND(readability-simplify-boolean-expr) #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/partition_sort_sink_operator.h b/be/src/exec/operator/partition_sort_sink_operator.h similarity index 84% rename from be/src/pipeline/exec/partition_sort_sink_operator.h rename to be/src/exec/operator/partition_sort_sink_operator.h index da5cf9db69e0f9..989e9de6d3a992 100644 --- a/be/src/pipeline/exec/partition_sort_sink_operator.h +++ b/be/src/exec/operator/partition_sort_sink_operator.h @@ -19,11 +19,11 @@ #include -#include "operator.h" -#include "pipeline/common/partition_sort_utils.h" -#include "vec/common/sort/partition_sorter.h" +#include "exec/common/partition_sort_utils.h" +#include "exec/operator/operator.h" +#include "exec/sort/partition_sorter.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class PartitionSortSinkOperatorX; @@ -34,7 +34,7 @@ class PartitionSortSinkLocalState : public PipelineXSinkLocalState(parent, state), _partitioned_data(std::make_unique()), - _agg_arena_pool(std::make_unique()) {} + _agg_arena_pool(std::make_unique()) {} Status init(RuntimeState* state, LocalSinkStateInfo& info) override; @@ -42,13 +42,13 @@ class PartitionSortSinkLocalState : public PipelineXSinkLocalState _value_places; int _num_partition = 0; std::unique_ptr _partitioned_data; - std::unique_ptr _agg_arena_pool; + std::unique_ptr _agg_arena_pool; int _partition_exprs_num = 0; std::shared_ptr _partition_sort_info = nullptr; TPartTopNPhase::type _topn_phase; @@ -92,7 +92,7 @@ class PartitionSortSinkOperatorX final : public DataSinkOperatorX _distribute_exprs; // Expressions and parameters used for build _sort_description - vectorized::VSortExecExprs _vsort_exec_exprs; + VSortExecExprs _vsort_exec_exprs; std::vector _is_asc_order; std::vector _nulls_first; - Status _split_block_by_partition(vectorized::Block* input_block, - PartitionSortSinkLocalState& local_state, bool eos); - Status _emplace_into_hash_table(const vectorized::ColumnRawPtrs& key_columns, - vectorized::Block* input_block, + Status _split_block_by_partition(Block* input_block, PartitionSortSinkLocalState& local_state, + bool eos); + Status _emplace_into_hash_table(const ColumnRawPtrs& key_columns, Block* input_block, PartitionSortSinkLocalState& local_state, bool eos); }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/partition_sort_source_operator.cpp b/be/src/exec/operator/partition_sort_source_operator.cpp similarity index 95% rename from be/src/pipeline/exec/partition_sort_source_operator.cpp rename to be/src/exec/operator/partition_sort_source_operator.cpp index 127498c18e30cb..eeaf4683c5a7e1 100644 --- a/be/src/pipeline/exec/partition_sort_source_operator.cpp +++ b/be/src/exec/operator/partition_sort_source_operator.cpp @@ -15,16 +15,14 @@ // specific language governing permissions and limitations // under the License. -#include "partition_sort_source_operator.h" +#include "exec/operator/partition_sort_source_operator.h" -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace pipeline { - Status PartitionSortSourceLocalState::init(RuntimeState* state, LocalStateInfo& info) { RETURN_IF_ERROR(PipelineXLocalState::init(state, info)); SCOPED_TIMER(exec_time_counter()); @@ -35,7 +33,7 @@ Status PartitionSortSourceLocalState::init(RuntimeState* state, LocalStateInfo& return Status::OK(); } -Status PartitionSortSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* output_block, +Status PartitionSortSourceOperatorX::get_block(RuntimeState* state, Block* output_block, bool* eos) { RETURN_IF_CANCELLED(state); auto& local_state = get_local_state(state); @@ -81,8 +79,7 @@ Status PartitionSortSourceOperatorX::get_block(RuntimeState* state, vectorized:: return Status::OK(); } -Status PartitionSortSourceOperatorX::get_sorted_block(RuntimeState* state, - vectorized::Block* output_block, +Status PartitionSortSourceOperatorX::get_sorted_block(RuntimeState* state, Block* output_block, PartitionSortSourceLocalState& local_state) { SCOPED_TIMER(local_state._get_sorted_timer); //sorter output data one by one @@ -107,6 +104,5 @@ Status PartitionSortSourceOperatorX::get_sorted_block(RuntimeState* state, return Status::OK(); } -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/exec/partition_sort_source_operator.h b/be/src/exec/operator/partition_sort_source_operator.h similarity index 90% rename from be/src/pipeline/exec/partition_sort_source_operator.h rename to be/src/exec/operator/partition_sort_source_operator.h index cddd4de7e11f41..ce78b4bdbcdc5f 100644 --- a/be/src/pipeline/exec/partition_sort_source_operator.h +++ b/be/src/exec/operator/partition_sort_source_operator.h @@ -20,14 +20,12 @@ #include #include "common/status.h" -#include "operator.h" +#include "exec/operator/operator.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace pipeline { - class PartitionSortSourceOperatorX; class PartitionSortSourceLocalState final : public PipelineXLocalState { @@ -55,16 +53,15 @@ class PartitionSortSourceOperatorX final : public OperatorX @@ -23,25 +23,25 @@ #include #include -#include "aggregation_sink_operator.h" #include "common/status.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/spill_utils.h" -#include "pipeline/pipeline_task.h" +#include "exec/operator/aggregation_sink_operator.h" +#include "exec/operator/spill_utils.h" +#include "exec/pipeline/dependency.h" +#include "exec/pipeline/pipeline_task.h" +#include "exec/spill/spill_stream.h" +#include "exec/spill/spill_stream_manager.h" #include "runtime/fragment_mgr.h" +#include "runtime/runtime_profile.h" #include "util/pretty_printer.h" -#include "util/runtime_profile.h" -#include "vec/spill/spill_stream.h" -#include "vec/spill/spill_stream_manager.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" PartitionedAggSinkLocalState::PartitionedAggSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state) : Base(parent, state) {} Status PartitionedAggSinkLocalState::init(doris::RuntimeState* state, - doris::pipeline::LocalSinkStateInfo& info) { + doris::LocalSinkStateInfo& info) { RETURN_IF_ERROR(Base::init(state, info)); SCOPED_TIMER(Base::exec_time_counter()); @@ -132,8 +132,7 @@ Status PartitionedAggSinkOperatorX::prepare(RuntimeState* state) { return _agg_sink_operator->prepare(state); } -Status PartitionedAggSinkOperatorX::sink(doris::RuntimeState* state, vectorized::Block* in_block, - bool eos) { +Status PartitionedAggSinkOperatorX::sink(doris::RuntimeState* state, Block* in_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)in_block->rows()); @@ -169,7 +168,7 @@ Status PartitionedAggSinkOperatorX::sink(doris::RuntimeState* state, vectorized: local_state._dependency->set_ready_to_read(); } } else if (local_state._shared_state->is_spilled) { - if (revocable_mem_size(state) >= vectorized::SpillStream::MAX_SPILL_WRITE_BATCH_MEM) { + if (revocable_mem_size(state) >= SpillStream::MAX_SPILL_WRITE_BATCH_MEM) { return revoke_memory(state, nullptr); } } @@ -236,8 +235,8 @@ size_t PartitionedAggSinkOperatorX::get_reserve_mem_size(RuntimeState* state, bo template Status PartitionedAggSinkLocalState::to_block(HashTableCtxType& context, std::vector& keys, - std::vector& values, - const vectorized::AggregateDataPtr null_key_data) { + std::vector& values, + const AggregateDataPtr null_key_data) { SCOPED_TIMER(_spill_serialize_hash_table_timer); context.insert_keys_into_columns(keys, key_columns_, (uint32_t)keys.size()); @@ -261,7 +260,7 @@ Status PartitionedAggSinkLocalState::to_block(HashTableCtxType& context, std::ve value_columns_[i], values.size()); } - vectorized::ColumnsWithTypeAndName key_columns_with_schema; + ColumnsWithTypeAndName key_columns_with_schema; for (int i = 0; i < key_columns_.size(); ++i) { key_columns_with_schema.emplace_back( std::move(key_columns_[i]), @@ -270,7 +269,7 @@ Status PartitionedAggSinkLocalState::to_block(HashTableCtxType& context, std::ve } key_block_ = key_columns_with_schema; - vectorized::ColumnsWithTypeAndName value_columns_with_schema; + ColumnsWithTypeAndName value_columns_with_schema; for (int i = 0; i < value_columns_.size(); ++i) { value_columns_with_schema.emplace_back( std::move(value_columns_[i]), value_data_types_[i], @@ -292,9 +291,9 @@ Status PartitionedAggSinkLocalState::to_block(HashTableCtxType& context, std::ve template Status PartitionedAggSinkLocalState::_spill_partition( RuntimeState* state, HashTableCtxType& context, AggSpillPartitionSPtr& spill_partition, - std::vector& keys, std::vector& values, - const vectorized::AggregateDataPtr null_key_data, bool is_last) { - vectorized::SpillStreamSPtr spill_stream; + std::vector& keys, std::vector& values, + const AggregateDataPtr null_key_data, bool is_last) { + SpillStreamSPtr spill_stream; auto status = spill_partition->get_spill_stream(state, Base::_parent->node_id(), Base::operator_profile(), spill_stream); RETURN_IF_ERROR(status); @@ -304,7 +303,7 @@ Status PartitionedAggSinkLocalState::_spill_partition( if (is_last) { std::vector tmp_keys; - std::vector tmp_values; + std::vector tmp_values; keys.swap(tmp_keys); values.swap(tmp_values); @@ -344,7 +343,7 @@ Status PartitionedAggSinkLocalState::_spill_hash_table(RuntimeState* state, // `spill_batch_rows` will be between 4k and 1M // and each block to spill will not be larger than 32MB(`MAX_SPILL_WRITE_BATCH_MEM`) const auto spill_batch_rows = std::min( - 1024 * 1024, std::max(4096, vectorized::SpillStream::MAX_SPILL_WRITE_BATCH_MEM * + 1024 * 1024, std::max(4096, SpillStream::MAX_SPILL_WRITE_BATCH_MEM * total_rows / size_to_revoke_)); VLOG_DEBUG << "Query: " << print_id(state->query_id()) << ", node: " << _parent->node_id() @@ -386,9 +385,8 @@ Status PartitionedAggSinkLocalState::_spill_hash_table(RuntimeState* state, status = _spill_partition( state, context, Base::_shared_state->spill_partitions[i], spill_infos[i].keys_, spill_infos[i].values_, - spill_null_key_data - ? hash_table.template get_null_key_data() - : nullptr, + spill_null_key_data ? hash_table.template get_null_key_data() + : nullptr, true); RETURN_IF_ERROR(status); } @@ -440,8 +438,7 @@ Status PartitionedAggSinkLocalState::_execute_spill_process(RuntimeState* state, auto* runtime_state = _runtime_state.get(); auto* agg_data = parent._agg_sink_operator->get_agg_data(runtime_state); - status = std::visit( - vectorized::Overload {[&](std::monostate& arg) -> Status { + status = std::visit(Overload {[&](std::monostate& arg) -> Status { return Status::InternalError("Unit hash table"); }, [&](auto& agg_method) -> Status { @@ -449,7 +446,7 @@ Status PartitionedAggSinkLocalState::_execute_spill_process(RuntimeState* state, RETURN_IF_CATCH_EXCEPTION(return _spill_hash_table( state, agg_method, hash_table, size_to_revoke, _eos)); }}, - agg_data->method_variant); + agg_data->method_variant); RETURN_IF_ERROR(status); status = parent._agg_sink_operator->reset_hash_table(runtime_state); return status; @@ -500,27 +497,27 @@ void PartitionedAggSinkLocalState::_reset_tmp_data() { void PartitionedAggSinkLocalState::_clear_tmp_data() { { - vectorized::Block empty_block; + Block empty_block; block_.swap(empty_block); } { - vectorized::Block empty_block; + Block empty_block; key_block_.swap(empty_block); } { - vectorized::Block empty_block; + Block empty_block; value_block_.swap(empty_block); } { - vectorized::MutableColumns cols; + MutableColumns cols; key_columns_.swap(cols); } { - vectorized::MutableColumns cols; + MutableColumns cols; value_columns_.swap(cols); } - vectorized::DataTypes tmp_value_data_types; + DataTypes tmp_value_data_types; value_data_types_.swap(tmp_value_data_types); } @@ -529,4 +526,4 @@ bool PartitionedAggSinkLocalState::is_blockable() const { } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/partitioned_aggregation_sink_operator.h b/be/src/exec/operator/partitioned_aggregation_sink_operator.h similarity index 83% rename from be/src/pipeline/exec/partitioned_aggregation_sink_operator.h rename to be/src/exec/operator/partitioned_aggregation_sink_operator.h index 827655e4c3d130..2130ec9471de9e 100644 --- a/be/src/pipeline/exec/partitioned_aggregation_sink_operator.h +++ b/be/src/exec/operator/partitioned_aggregation_sink_operator.h @@ -19,16 +19,16 @@ #include #include -#include "aggregation_sink_operator.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/operator.h" +#include "exec/operator/aggregation_sink_operator.h" +#include "exec/operator/operator.h" +#include "exec/pipeline/dependency.h" +#include "exec/spill/spill_stream.h" +#include "exec/spill/spill_stream_manager.h" +#include "exprs/vectorized_agg_fn.h" +#include "exprs/vexpr.h" #include "util/pretty_printer.h" -#include "vec/exprs/vectorized_agg_fn.h" -#include "vec/exprs/vexpr.h" -#include "vec/spill/spill_stream.h" -#include "vec/spill/spill_stream_manager.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class PartitionedAggSinkOperatorX; class PartitionedAggSinkLocalState @@ -61,7 +61,7 @@ class PartitionedAggSinkLocalState template struct TmpSpillInfo { std::vector keys_; - std::vector values_; + std::vector values_; }; template @@ -71,13 +71,12 @@ class PartitionedAggSinkLocalState template Status _spill_partition(RuntimeState* state, HashTableCtxType& context, AggSpillPartitionSPtr& spill_partition, std::vector& keys, - std::vector& values, - const vectorized::AggregateDataPtr null_key_data, bool is_last); + std::vector& values, + const AggregateDataPtr null_key_data, bool is_last); template Status to_block(HashTableCtxType& context, std::vector& keys, - std::vector& values, - const vectorized::AggregateDataPtr null_key_data); + std::vector& values, const AggregateDataPtr null_key_data); void _reset_tmp_data(); void _clear_tmp_data(); @@ -86,12 +85,12 @@ class PartitionedAggSinkLocalState std::unique_ptr _runtime_state; // temp structures during spilling - vectorized::MutableColumns key_columns_; - vectorized::MutableColumns value_columns_; - vectorized::DataTypes value_data_types_; - vectorized::Block block_; - vectorized::Block key_block_; - vectorized::Block value_block_; + MutableColumns key_columns_; + MutableColumns value_columns_; + DataTypes value_data_types_; + Block block_; + Block key_block_; + Block value_block_; std::unique_ptr _internal_runtime_profile; RuntimeProfile::Counter* _memory_usage_reserved = nullptr; @@ -115,7 +114,7 @@ class PartitionedAggSinkOperatorX : public DataSinkOperatorX #include -#include "aggregation_source_operator.h" #include "common/exception.h" #include "common/logging.h" #include "common/status.h" -#include "pipeline/exec/aggregation_source_operator.h" -#include "pipeline/exec/operator.h" -#include "pipeline/exec/spill_utils.h" -#include "pipeline/pipeline_task.h" +#include "exec/operator/aggregation_source_operator.h" +#include "exec/operator/operator.h" +#include "exec/operator/spill_utils.h" +#include "exec/pipeline/pipeline_task.h" +#include "exec/spill/spill_stream.h" +#include "exec/spill/spill_stream_manager.h" #include "runtime/fragment_mgr.h" -#include "util/runtime_profile.h" -#include "vec/spill/spill_stream.h" -#include "vec/spill/spill_stream_manager.h" +#include "runtime/runtime_profile.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" PartitionedAggLocalState::PartitionedAggLocalState(RuntimeState* state, OperatorXBase* parent) @@ -136,8 +135,7 @@ bool PartitionedAggSourceOperatorX::is_shuffled_operator() const { return _agg_source_operator->is_shuffled_operator(); } -Status PartitionedAggSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* block, - bool* eos) { +Status PartitionedAggSourceOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { auto& local_state = get_local_state(state); local_state.copy_shared_spill_profile(); Status status; @@ -258,7 +256,7 @@ Status PartitionedAggLocalState::_recover_spill_data_from_disk(RuntimeState* sta !state->is_cancelled() && !has_agg_data) { auto& stream = _shared_state->spill_partitions[0]->spill_streams_[0]; stream->set_read_counters(operator_profile()); - vectorized::Block block; + Block block; bool eos = false; while (!eos && !state->is_cancelled()) { { @@ -278,8 +276,7 @@ Status PartitionedAggLocalState::_recover_spill_data_from_disk(RuntimeState* sta accumulated_blocks_size += block.allocated_bytes(); _blocks.emplace_back(std::move(block)); - if (accumulated_blocks_size >= - vectorized::SpillStream::MAX_SPILL_WRITE_BATCH_MEM) { + if (accumulated_blocks_size >= SpillStream::MAX_SPILL_WRITE_BATCH_MEM) { break; } } @@ -351,4 +348,4 @@ bool PartitionedAggLocalState::is_blockable() const { } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/exec/operator/partitioned_aggregation_source_operator.h b/be/src/exec/operator/partitioned_aggregation_source_operator.h new file mode 100644 index 00000000000000..f91e6c1bd5db96 --- /dev/null +++ b/be/src/exec/operator/partitioned_aggregation_source_operator.h @@ -0,0 +1,102 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +#pragma once + +#include + +#include "common/status.h" +#include "exec/operator/operator.h" + +namespace doris { +#include "common/compile_check_begin.h" +class RuntimeState; + +class PartitionedAggSourceOperatorX; +class PartitionedAggLocalState; + +class PartitionedAggLocalState MOCK_REMOVE(final) + : public PipelineXSpillLocalState { +public: + ENABLE_FACTORY_CREATOR(PartitionedAggLocalState); + using Base = PipelineXSpillLocalState; + using Parent = PartitionedAggSourceOperatorX; + PartitionedAggLocalState(RuntimeState* state, OperatorXBase* parent); + ~PartitionedAggLocalState() override = default; + + Status init(RuntimeState* state, LocalStateInfo& info) override; + Status open(RuntimeState* state) override; + Status close(RuntimeState* state) override; + + Status recover_blocks_from_disk(RuntimeState* state, bool& has_data); + Status setup_in_memory_agg_op(RuntimeState* state); + + template + void update_profile(RuntimeProfile* child_profile); + + bool is_blockable() const override; + +private: + Status _recover_spill_data_from_disk(RuntimeState* state, const UniqueId& query_id); + +protected: + friend class PartitionedAggSourceOperatorX; + std::unique_ptr _runtime_state; + + bool _opened = false; + std::unique_ptr> _spill_merge_promise; + std::future _spill_merge_future; + bool _current_partition_eos = true; + bool _need_to_merge_data_for_current_partition = true; + + std::vector _blocks; + + std::unique_ptr _internal_runtime_profile; +}; + +class AggSourceOperatorX; +class PartitionedAggSourceOperatorX : public OperatorX { +public: + using Base = OperatorX; + PartitionedAggSourceOperatorX(ObjectPool* pool, const TPlanNode& tnode, int operator_id, + const DescriptorTbl& descs); + ~PartitionedAggSourceOperatorX() override = default; + + Status init(const TPlanNode& tnode, RuntimeState* state) override; + + Status prepare(RuntimeState* state) override; + + Status close(RuntimeState* state) override; + + Status get_block(RuntimeState* state, Block* block, bool* eos) override; + + bool is_source() const override { return true; } + + bool is_serial_operator() const override; + void update_operator(const TPlanNode& tnode, bool followed_by_shuffled_operator, + bool require_bucket_distribution) override; + + DataDistribution required_data_distribution(RuntimeState* state) const override; + bool is_colocated_operator() const override; + bool is_shuffled_operator() const override; + +private: + friend class PartitionedAggLocalState; + + std::unique_ptr _agg_source_operator; +}; +#include "common/compile_check_end.h" +} // namespace doris diff --git a/be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp b/be/src/exec/operator/partitioned_hash_join_probe_operator.cpp similarity index 95% rename from be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp rename to be/src/exec/operator/partitioned_hash_join_probe_operator.cpp index 4faa327a93e7af..69950ad41a7db3 100644 --- a/be/src/pipeline/exec/partitioned_hash_join_probe_operator.cpp +++ b/be/src/exec/operator/partitioned_hash_join_probe_operator.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "partitioned_hash_join_probe_operator.h" +#include "exec/operator/partitioned_hash_join_probe_operator.h" #include #include @@ -26,20 +26,19 @@ #include "common/exception.h" #include "common/logging.h" #include "common/status.h" -#include "pipeline/pipeline_task.h" +#include "core/block/block.h" +#include "exec/pipeline/pipeline_task.h" +#include "exec/spill/spill_stream.h" +#include "exec/spill/spill_stream_manager.h" #include "runtime/fragment_mgr.h" -#include "util/runtime_profile.h" -#include "vec/core/block.h" -#include "vec/spill/spill_stream.h" -#include "vec/spill/spill_stream_manager.h" +#include "runtime/runtime_profile.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" PartitionedHashJoinProbeLocalState::PartitionedHashJoinProbeLocalState(RuntimeState* state, OperatorXBase* parent) - : PipelineXSpillLocalState(state, parent), - _child_block(vectorized::Block::create_unique()) {} + : PipelineXSpillLocalState(state, parent), _child_block(Block::create_unique()) {} Status PartitionedHashJoinProbeLocalState::init(RuntimeState* state, LocalStateInfo& info) { RETURN_IF_ERROR(PipelineXSpillLocalState::init(state, info)); @@ -176,7 +175,7 @@ Status PartitionedHashJoinProbeLocalState::_execute_spill_probe_blocks(RuntimeSt auto& partitioned_block = _partitioned_blocks[partition_index]; if (partitioned_block) { const auto size = partitioned_block->allocated_bytes(); - if (size >= vectorized::SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { + if (size >= SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { blocks.emplace_back(partitioned_block->to_block()); partitioned_block.reset(); } else { @@ -196,7 +195,7 @@ Status PartitionedHashJoinProbeLocalState::_execute_spill_probe_blocks(RuntimeSt std::numeric_limits::max(), operator_profile())); } - auto merged_block = vectorized::MutableBlock::create_unique(std::move(blocks.back())); + auto merged_block = MutableBlock::create_unique(std::move(blocks.back())); blocks.pop_back(); while (!blocks.empty() && !state->is_cancelled()) { @@ -292,7 +291,7 @@ Status PartitionedHashJoinProbeLocalState::recover_build_blocks_from_disk(Runtim print_id(state->query_id()), _parent->node_id(), state->task_id(), partition_index); Status status; while (!eos) { - vectorized::Block block; + Block block; DBUG_EXECUTE_IF("fault_inject::partitioned_hash_join_probe::recover_build_blocks", { status = Status::Error( "fault_inject partitioned_hash_join_probe " @@ -321,7 +320,7 @@ Status PartitionedHashJoinProbeLocalState::recover_build_blocks_from_disk(Runtim } if (!_recovered_build_block) { - _recovered_build_block = vectorized::MutableBlock::create_unique(std::move(block)); + _recovered_build_block = MutableBlock::create_unique(std::move(block)); } else { DCHECK_EQ(_recovered_build_block->columns(), block.columns()); status = _recovered_build_block->merge(std::move(block)); @@ -331,7 +330,7 @@ Status PartitionedHashJoinProbeLocalState::recover_build_blocks_from_disk(Runtim } if (_recovered_build_block->allocated_bytes() >= - vectorized::SpillStream::MAX_SPILL_WRITE_BATCH_MEM) { + SpillStream::MAX_SPILL_WRITE_BATCH_MEM) { break; } } @@ -418,7 +417,7 @@ Status PartitionedHashJoinProbeLocalState::recover_probe_blocks_from_disk(Runtim auto read_func = [this, query_id, partition_index, &spilled_stream, &blocks] { SCOPED_TIMER(_recovery_probe_timer); - vectorized::Block block; + Block block; bool eos = false; Status st; DBUG_EXECUTE_IF("fault_inject::partitioned_hash_join_probe::recover_probe_blocks", { @@ -438,7 +437,7 @@ Status PartitionedHashJoinProbeLocalState::recover_probe_blocks_from_disk(Runtim blocks.emplace_back(std::move(block)); } - if (read_size >= vectorized::SpillStream::MAX_SPILL_WRITE_BATCH_MEM) { + if (read_size >= SpillStream::MAX_SPILL_WRITE_BATCH_MEM) { break; } } @@ -530,7 +529,7 @@ Status PartitionedHashJoinProbeOperatorX::prepare(RuntimeState* state) { return Status::OK(); } -Status PartitionedHashJoinProbeOperatorX::push(RuntimeState* state, vectorized::Block* input_block, +Status PartitionedHashJoinProbeOperatorX::push(RuntimeState* state, Block* input_block, bool eos) const { auto& local_state = get_local_state(state); const auto rows = input_block->rows(); @@ -566,8 +565,7 @@ Status PartitionedHashJoinProbeOperatorX::push(RuntimeState* state, vectorized:: } if (!partitioned_blocks[i]) { - partitioned_blocks[i] = - vectorized::MutableBlock::create_unique(input_block->clone_empty()); + partitioned_blocks[i] = MutableBlock::create_unique(input_block->clone_empty()); } RETURN_IF_ERROR(partitioned_blocks[i]->add_rows(input_block, partition_indexes[i].data(), partition_indexes[i].data() + count)); @@ -636,7 +634,7 @@ Status PartitionedHashJoinProbeOperatorX::_setup_internal_operators( auto& partitioned_block = local_state._shared_state->partitioned_build_blocks[local_state._partition_cursor]; - vectorized::Block block; + Block block; if (partitioned_block && partitioned_block->rows() > 0) { block = partitioned_block->to_block(); partitioned_block.reset(); @@ -658,8 +656,8 @@ Status PartitionedHashJoinProbeOperatorX::_setup_internal_operators( return Status::OK(); } -Status PartitionedHashJoinProbeOperatorX::pull(doris::RuntimeState* state, - vectorized::Block* output_block, bool* eos) const { +Status PartitionedHashJoinProbeOperatorX::pull(doris::RuntimeState* state, Block* output_block, + bool* eos) const { auto& local_state = get_local_state(state); const auto partition_index = local_state._partition_cursor; @@ -702,7 +700,7 @@ Status PartitionedHashJoinProbeOperatorX::pull(doris::RuntimeState* state, RETURN_IF_ERROR( local_state.recover_probe_blocks_from_disk(state, partition_index, has_data)); if (!has_data) { - vectorized::Block block; + Block block; RETURN_IF_ERROR(_inner_probe_operator->push(runtime_state, &block, true)); VLOG_DEBUG << fmt::format( "Query:{}, hash join probe:{}, task:{}," @@ -770,8 +768,8 @@ size_t PartitionedHashJoinProbeOperatorX::revocable_mem_size(RuntimeState* state size_t PartitionedHashJoinProbeOperatorX::_revocable_mem_size(RuntimeState* state, bool force) const { - const auto spill_size_threshold = force ? vectorized::SpillStream::MIN_SPILL_WRITE_BATCH_MEM - : vectorized::SpillStream::MAX_SPILL_WRITE_BATCH_MEM; + const auto spill_size_threshold = + force ? SpillStream::MIN_SPILL_WRITE_BATCH_MEM : SpillStream::MAX_SPILL_WRITE_BATCH_MEM; auto& local_state = get_local_state(state); size_t mem_size = 0; auto& probe_blocks = local_state._probe_blocks; @@ -798,7 +796,7 @@ size_t PartitionedHashJoinProbeOperatorX::get_reserve_mem_size(RuntimeState* sta return Base::get_reserve_mem_size(state); } - size_t size_to_reserve = vectorized::SpillStream::MAX_SPILL_WRITE_BATCH_MEM; + size_t size_to_reserve = SpillStream::MAX_SPILL_WRITE_BATCH_MEM; if (local_state._need_to_setup_internal_operators) { const size_t rows = @@ -835,16 +833,15 @@ bool PartitionedHashJoinProbeOperatorX::_should_revoke_memory(RuntimeState* stat const auto revocable_size = _revocable_mem_size(state); if (local_state.low_memory_mode()) { - return revocable_size >= vectorized::SpillStream::MIN_SPILL_WRITE_BATCH_MEM; + return revocable_size >= SpillStream::MIN_SPILL_WRITE_BATCH_MEM; } else { - return revocable_size >= vectorized::SpillStream::MAX_SPILL_WRITE_BATCH_MEM; + return revocable_size >= SpillStream::MAX_SPILL_WRITE_BATCH_MEM; } } return false; } -Status PartitionedHashJoinProbeOperatorX::get_block(RuntimeState* state, vectorized::Block* block, - bool* eos) { +Status PartitionedHashJoinProbeOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { *eos = false; auto& local_state = get_local_state(state); local_state.copy_shared_spill_profile(); @@ -908,4 +905,4 @@ Status PartitionedHashJoinProbeOperatorX::get_block(RuntimeState* state, vectori } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/partitioned_hash_join_probe_operator.h b/be/src/exec/operator/partitioned_hash_join_probe_operator.h similarity index 86% rename from be/src/pipeline/exec/partitioned_hash_join_probe_operator.h rename to be/src/exec/operator/partitioned_hash_join_probe_operator.h index 167dc1bd00c5e9..10530d5c8ad283 100644 --- a/be/src/pipeline/exec/partitioned_hash_join_probe_operator.h +++ b/be/src/exec/operator/partitioned_hash_join_probe_operator.h @@ -22,19 +22,17 @@ #include "common/be_mock_util.h" #include "common/status.h" -#include "operator.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/hashjoin_build_sink.h" -#include "pipeline/exec/hashjoin_probe_operator.h" -#include "pipeline/exec/join_build_sink_operator.h" -#include "pipeline/exec/spill_utils.h" +#include "exec/operator/hashjoin_build_sink.h" +#include "exec/operator/hashjoin_probe_operator.h" +#include "exec/operator/join_build_sink_operator.h" +#include "exec/operator/operator.h" +#include "exec/operator/spill_utils.h" +#include "exec/pipeline/dependency.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace pipeline { - class PartitionedHashJoinProbeOperatorX; class PartitionedHashJoinProbeLocalState MOCK_REMOVE(final) @@ -90,16 +88,16 @@ class PartitionedHashJoinProbeLocalState MOCK_REMOVE(final) std::shared_ptr _in_mem_shared_state_sptr; uint32_t _partition_cursor {0}; - std::unique_ptr _child_block; + std::unique_ptr _child_block; bool _child_eos {false}; - std::vector> _partitioned_blocks; - std::unique_ptr _recovered_build_block; - std::map> _probe_blocks; + std::vector> _partitioned_blocks; + std::unique_ptr _recovered_build_block; + std::map> _probe_blocks; - std::vector _probe_spilling_streams; + std::vector _probe_spilling_streams; - std::unique_ptr _partitioner; + std::unique_ptr _partitioner; std::unique_ptr _internal_runtime_profile; bool _need_to_setup_internal_operators {true}; @@ -132,12 +130,10 @@ class PartitionedHashJoinProbeOperatorX final Status init(const TPlanNode& tnode, RuntimeState* state) override; Status prepare(RuntimeState* state) override; - [[nodiscard]] Status get_block(RuntimeState* state, vectorized::Block* block, - bool* eos) override; + [[nodiscard]] Status get_block(RuntimeState* state, Block* block, bool* eos) override; - Status push(RuntimeState* state, vectorized::Block* input_block, bool eos) const override; - Status pull(doris::RuntimeState* state, vectorized::Block* output_block, - bool* eos) const override; + Status push(RuntimeState* state, Block* input_block, bool eos) const override; + Status pull(doris::RuntimeState* state, Block* output_block, bool* eos) const override; bool need_more_input_data(RuntimeState* state) const override; DataDistribution required_data_distribution(RuntimeState* /*state*/) const override { @@ -203,9 +199,8 @@ class PartitionedHashJoinProbeOperatorX final const DescriptorTbl _descriptor_tbl; const uint32_t _partition_count; - std::unique_ptr _partitioner; + std::unique_ptr _partitioner; }; -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/exec/partitioned_hash_join_sink_operator.cpp b/be/src/exec/operator/partitioned_hash_join_sink_operator.cpp similarity index 93% rename from be/src/pipeline/exec/partitioned_hash_join_sink_operator.cpp rename to be/src/exec/operator/partitioned_hash_join_sink_operator.cpp index b0595952a49636..a702421ae08640 100644 --- a/be/src/pipeline/exec/partitioned_hash_join_sink_operator.cpp +++ b/be/src/exec/operator/partitioned_hash_join_sink_operator.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "partitioned_hash_join_sink_operator.h" +#include "exec/operator/partitioned_hash_join_sink_operator.h" #include @@ -24,20 +24,20 @@ #include "common/logging.h" #include "common/status.h" -#include "pipeline/exec/operator.h" -#include "pipeline/exec/spill_utils.h" -#include "pipeline/pipeline_task.h" +#include "exec/operator/operator.h" +#include "exec/operator/spill_utils.h" +#include "exec/pipeline/pipeline_task.h" +#include "exec/spill/spill_stream.h" +#include "exec/spill/spill_stream_manager.h" #include "runtime/fragment_mgr.h" +#include "runtime/runtime_profile.h" #include "util/pretty_printer.h" -#include "util/runtime_profile.h" -#include "vec/spill/spill_stream.h" -#include "vec/spill/spill_stream_manager.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" Status PartitionedHashJoinSinkLocalState::init(doris::RuntimeState* state, - doris::pipeline::LocalSinkStateInfo& info) { + doris::LocalSinkStateInfo& info) { RETURN_IF_ERROR(PipelineXSpillSinkLocalState::init(state, info)); SCOPED_TIMER(exec_time_counter()); SCOPED_TIMER(_init_timer); @@ -115,7 +115,7 @@ size_t PartitionedHashJoinSinkLocalState::revocable_mem_size(RuntimeState* state for (auto& block : partitioned_blocks) { if (block) { auto block_bytes = block->allocated_bytes(); - if (block_bytes >= vectorized::SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { + if (block_bytes >= SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { mem_size += block_bytes; } } @@ -150,7 +150,7 @@ size_t PartitionedHashJoinSinkLocalState::get_reserve_mem_size(RuntimeState* sta size_t size_to_reserve = 0; auto& p = _parent->cast(); if (_shared_state->is_spilled) { - size_to_reserve = p._partition_count * vectorized::SpillStream::MIN_SPILL_WRITE_BATCH_MEM; + size_to_reserve = p._partition_count * SpillStream::MIN_SPILL_WRITE_BATCH_MEM; } else { if (_shared_state->inner_runtime_state) { size_to_reserve = p._inner_sink_operator->get_reserve_mem_size( @@ -166,8 +166,8 @@ Dependency* PartitionedHashJoinSinkLocalState::finishdependency() { return _finish_dependency.get(); } -Status PartitionedHashJoinSinkLocalState::_execute_spill_unpartitioned_block( - RuntimeState* state, vectorized::Block&& build_block) { +Status PartitionedHashJoinSinkLocalState::_execute_spill_unpartitioned_block(RuntimeState* state, + Block&& build_block) { Defer defer1 {[&]() { update_memory_usage(); }}; auto& p = _parent->cast(); auto& partitioned_blocks = _shared_state->partitioned_build_blocks; @@ -208,11 +208,9 @@ Status PartitionedHashJoinSinkLocalState::_execute_spill_unpartitioned_block( auto* begin = partitions_indexes[partition_idx].data(); auto* end = begin + partitions_indexes[partition_idx].size(); auto& partition_block = partitioned_blocks[partition_idx]; - vectorized::SpillStreamSPtr& spilling_stream = - _shared_state->spilled_streams[partition_idx]; + SpillStreamSPtr& spilling_stream = _shared_state->spilled_streams[partition_idx]; if (UNLIKELY(!partition_block)) { - partition_block = - vectorized::MutableBlock::create_unique(build_block.clone_empty()); + partition_block = MutableBlock::create_unique(build_block.clone_empty()); } int64_t old_mem = partition_block->allocated_bytes(); @@ -226,8 +224,7 @@ Status PartitionedHashJoinSinkLocalState::_execute_spill_unpartitioned_block( if (partition_block->rows() >= reserved_size || is_last_block) { auto block = partition_block->to_block(); RETURN_IF_ERROR(spilling_stream->spill_block(state, block, false)); - partition_block = - vectorized::MutableBlock::create_unique(build_block.clone_empty()); + partition_block = MutableBlock::create_unique(build_block.clone_empty()); COUNTER_UPDATE(_memory_used_counter, -new_mem); } else { COUNTER_UPDATE(_memory_used_counter, new_mem - old_mem); @@ -269,7 +266,7 @@ Status PartitionedHashJoinSinkLocalState::_revoke_unpartitioned_block( } const auto& row_desc = p._child->row_desc(); const auto num_slots = row_desc.num_slots(); - vectorized::Block build_block; + Block build_block; int64_t block_old_mem = 0; if (inner_sink_state) { build_block = inner_sink_state->_build_side_mutable_block.to_block(); @@ -293,7 +290,7 @@ Status PartitionedHashJoinSinkLocalState::_revoke_unpartitioned_block( } if (build_block.columns() > num_slots) { - vectorized::Block::erase_useless_column(&build_block, num_slots); + Block::erase_useless_column(&build_block, num_slots); COUNTER_UPDATE(_memory_used_counter, build_block.allocated_bytes() - block_old_mem); } @@ -367,12 +364,12 @@ Status PartitionedHashJoinSinkLocalState::_execute_spill_partitioned_blocks(Runt SCOPED_TIMER(_spill_build_timer); for (size_t i = 0; i != _shared_state->partitioned_build_blocks.size(); ++i) { - vectorized::SpillStreamSPtr& spilling_stream = _shared_state->spilled_streams[i]; + SpillStreamSPtr& spilling_stream = _shared_state->spilled_streams[i]; DCHECK(spilling_stream != nullptr); auto& mutable_block = _shared_state->partitioned_build_blocks[i]; if (!mutable_block || - mutable_block->allocated_bytes() < vectorized::SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { + mutable_block->allocated_bytes() < SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { continue; } @@ -419,8 +416,7 @@ Status PartitionedHashJoinSinkLocalState::_finish_spilling() { return Status::OK(); } -Status PartitionedHashJoinSinkLocalState::_partition_block(RuntimeState* state, - vectorized::Block* in_block, +Status PartitionedHashJoinSinkLocalState::_partition_block(RuntimeState* state, Block* in_block, size_t begin, size_t end) { const auto rows = in_block->rows(); if (!rows) { @@ -450,8 +446,7 @@ Status PartitionedHashJoinSinkLocalState::_partition_block(RuntimeState* state, } if (UNLIKELY(!partitioned_blocks[i])) { - partitioned_blocks[i] = - vectorized::MutableBlock::create_unique(in_block->clone_empty()); + partitioned_blocks[i] = MutableBlock::create_unique(in_block->clone_empty()); } RETURN_IF_ERROR(partitioned_blocks[i]->add_rows(in_block, partition_indexes[i].data(), partition_indexes[i].data() + count)); @@ -463,15 +458,15 @@ Status PartitionedHashJoinSinkLocalState::_partition_block(RuntimeState* state, return Status::OK(); } -Status PartitionedHashJoinSinkLocalState::_spill_to_disk( - uint32_t partition_index, const vectorized::SpillStreamSPtr& spilling_stream) { +Status PartitionedHashJoinSinkLocalState::_spill_to_disk(uint32_t partition_index, + const SpillStreamSPtr& spilling_stream) { auto& partitioned_block = _shared_state->partitioned_build_blocks[partition_index]; if (!_state->is_cancelled()) { auto block = partitioned_block->to_block(); int64_t block_mem_usage = block.allocated_bytes(); Defer defer {[&]() { COUNTER_UPDATE(memory_used_counter(), -block_mem_usage); }}; - partitioned_block = vectorized::MutableBlock::create_unique(block.clone_empty()); + partitioned_block = MutableBlock::create_unique(block.clone_empty()); return spilling_stream->spill_block(state(), block, false); } else { return _state->cancel_reason(); @@ -502,8 +497,8 @@ Status PartitionedHashJoinSinkOperatorX::init(const TPlanNode& tnode, RuntimeSta const std::vector& eq_join_conjuncts = tnode.hash_join_node.eq_join_conjuncts; std::vector partition_exprs; for (const auto& eq_join_conjunct : eq_join_conjuncts) { - vectorized::VExprContextSPtr ctx; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(eq_join_conjunct.right, ctx)); + VExprContextSPtr ctx; + RETURN_IF_ERROR(VExpr::create_expr_tree(eq_join_conjunct.right, ctx)); _build_exprs.emplace_back(eq_join_conjunct.right); partition_exprs.emplace_back(eq_join_conjunct.right); } @@ -601,8 +596,7 @@ static bool is_revocable_mem_high_watermark(RuntimeState* state, size_t revocabl (double)query_mem_limit / 100.0 * revocable_memory_high_watermark_percent; } -Status PartitionedHashJoinSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block, - bool eos) { +Status PartitionedHashJoinSinkOperatorX::sink(RuntimeState* state, Block* in_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); @@ -673,7 +667,7 @@ Status PartitionedHashJoinSinkOperatorX::sink(RuntimeState* state, vectorized::B RETURN_IF_ERROR(local_state._partition_block(state, in_block, 0, rows)); if (eos) { return revoke_memory(state, nullptr); - } else if (revocable_mem_size(state) > vectorized::SpillStream::MAX_SPILL_WRITE_BATCH_MEM) { + } else if (revocable_mem_size(state) > SpillStream::MAX_SPILL_WRITE_BATCH_MEM) { return revoke_memory(state, nullptr); } } else { @@ -733,4 +727,4 @@ bool PartitionedHashJoinSinkLocalState::is_blockable() const { } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/partitioned_hash_join_sink_operator.h b/be/src/exec/operator/partitioned_hash_join_sink_operator.h similarity index 88% rename from be/src/pipeline/exec/partitioned_hash_join_sink_operator.h rename to be/src/exec/operator/partitioned_hash_join_sink_operator.h index 59eed7aac6637b..cd355ef1b5f68c 100644 --- a/be/src/pipeline/exec/partitioned_hash_join_sink_operator.h +++ b/be/src/exec/operator/partitioned_hash_join_sink_operator.h @@ -21,21 +21,19 @@ #include "common/be_mock_util.h" #include "common/status.h" -#include "operator.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/hashjoin_build_sink.h" -#include "pipeline/exec/hashjoin_probe_operator.h" -#include "pipeline/exec/join_build_sink_operator.h" -#include "pipeline/exec/spill_utils.h" -#include "vec/core/block.h" -#include "vec/runtime/partitioner.h" +#include "core/block/block.h" +#include "exec/operator/hashjoin_build_sink.h" +#include "exec/operator/hashjoin_probe_operator.h" +#include "exec/operator/join_build_sink_operator.h" +#include "exec/operator/operator.h" +#include "exec/operator/spill_utils.h" +#include "exec/partitioner/partitioner.h" +#include "exec/pipeline/dependency.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace pipeline { - class PartitionedHashJoinSinkOperatorX; class PartitionedHashJoinSinkLocalState @@ -62,16 +60,14 @@ class PartitionedHashJoinSinkLocalState PartitionedHashJoinSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state) : PipelineXSpillSinkLocalState(parent, state) {} - Status _spill_to_disk(uint32_t partition_index, - const vectorized::SpillStreamSPtr& spilling_stream); + Status _spill_to_disk(uint32_t partition_index, const SpillStreamSPtr& spilling_stream); - Status _partition_block(RuntimeState* state, vectorized::Block* in_block, size_t begin, - size_t end); + Status _partition_block(RuntimeState* state, Block* in_block, size_t begin, size_t end); Status _revoke_unpartitioned_block(RuntimeState* state, const std::shared_ptr& spill_context); - Status _execute_spill_unpartitioned_block(RuntimeState* state, vectorized::Block&& build_block); + Status _execute_spill_unpartitioned_block(RuntimeState* state, Block&& build_block); Status _finish_spilling(); @@ -86,7 +82,7 @@ class PartitionedHashJoinSinkLocalState bool _child_eos {false}; - std::unique_ptr _partitioner; + std::unique_ptr _partitioner; std::unique_ptr _internal_runtime_profile; std::shared_ptr _finish_dependency; @@ -114,7 +110,7 @@ class PartitionedHashJoinSinkOperatorX Status prepare(RuntimeState* state) override; - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos) override; + Status sink(RuntimeState* state, Block* in_block, bool eos) override; bool should_dry_run(RuntimeState* state) override { return false; } @@ -177,9 +173,8 @@ class PartitionedHashJoinSinkOperatorX const TPlanNode _tnode; const DescriptorTbl _descriptor_tbl; const uint32_t _partition_count; - std::unique_ptr _partitioner; + std::unique_ptr _partitioner; }; -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/pipeline/exec/repeat_operator.cpp b/be/src/exec/operator/repeat_operator.cpp similarity index 81% rename from be/src/pipeline/exec/repeat_operator.cpp rename to be/src/exec/operator/repeat_operator.cpp index 124fd01d446e11..0294f51d2c2b08 100644 --- a/be/src/pipeline/exec/repeat_operator.cpp +++ b/be/src/exec/operator/repeat_operator.cpp @@ -15,27 +15,25 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline/exec/repeat_operator.h" +#include "exec/operator/repeat_operator.h" #include #include "common/logging.h" -#include "pipeline/exec/operator.h" -#include "vec/common/assert_cast.h" -#include "vec/core/block.h" -#include "vec/core/column_with_type_and_name.h" +#include "core/assert_cast.h" +#include "core/block/block.h" +#include "core/block/column_with_type_and_name.h" +#include "exec/operator/operator.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; } // namespace doris -namespace doris::pipeline { +namespace doris { RepeatLocalState::RepeatLocalState(RuntimeState* state, OperatorXBase* parent) - : Base(state, parent), - _child_block(vectorized::Block::create_unique()), - _repeat_id_idx(0) {} + : Base(state, parent), _child_block(Block::create_unique()), _repeat_id_idx(0) {} Status RepeatLocalState::open(RuntimeState* state) { SCOPED_TIMER(exec_time_counter()); @@ -61,7 +59,7 @@ Status RepeatLocalState::init(RuntimeState* state, LocalStateInfo& info) { Status RepeatOperatorX::init(const TPlanNode& tnode, RuntimeState* state) { RETURN_IF_ERROR(OperatorXBase::init(tnode, state)); - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(tnode.repeat_node.exprs, _expr_ctxs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(tnode.repeat_node.exprs, _expr_ctxs)); for (const auto& slot_idx : _grouping_list) { if (slot_idx.size() < _repeat_id_list_size) { return Status::InternalError( @@ -82,8 +80,8 @@ Status RepeatOperatorX::prepare(RuntimeState* state) { for (const auto& slot_desc : output_tuple_desc->slots()) { _output_slots.push_back(slot_desc); } - RETURN_IF_ERROR(vectorized::VExpr::prepare(_expr_ctxs, state, _child->row_desc())); - RETURN_IF_ERROR(vectorized::VExpr::open(_expr_ctxs, state)); + RETURN_IF_ERROR(VExpr::prepare(_expr_ctxs, state, _child->row_desc())); + RETURN_IF_ERROR(VExpr::open(_expr_ctxs, state)); return Status::OK(); } @@ -106,8 +104,8 @@ bool RepeatOperatorX::need_more_input_data(RuntimeState* state) const { return !local_state._child_block->rows() && !local_state._child_eos; } -Status RepeatLocalState::get_repeated_block(vectorized::Block* input_block, int repeat_id_idx, - vectorized::Block* output_block) { +Status RepeatLocalState::get_repeated_block(Block* input_block, int repeat_id_idx, + Block* output_block) { auto& p = _parent->cast(); DCHECK(input_block != nullptr); DCHECK_EQ(output_block->rows(), 0); @@ -115,8 +113,7 @@ Status RepeatLocalState::get_repeated_block(vectorized::Block* input_block, int size_t input_column_size = input_block->columns(); size_t output_column_size = p._output_slots.size(); DCHECK_LT(input_column_size, output_column_size); - auto m_block = vectorized::VectorizedUtils::build_mutable_mem_reuse_block(output_block, - p._output_slots); + auto m_block = VectorizedUtils::build_mutable_mem_reuse_block(output_block, p._output_slots); auto& output_columns = m_block.mutable_columns(); /* Fill all slots according to child, for example:select tc1,tc2,sum(tc3) from t1 group by grouping sets((tc1),(tc2)); * insert into t1 values(1,2,1),(1,3,1),(2,1,1),(3,1,1); @@ -126,16 +123,15 @@ Status RepeatLocalState::get_repeated_block(vectorized::Block* input_block, int */ size_t cur_col = 0; for (size_t i = 0; i < input_column_size; i++) { - const vectorized::ColumnWithTypeAndName& src_column = input_block->get_by_position(i); + const ColumnWithTypeAndName& src_column = input_block->get_by_position(i); const auto slot_id = p._output_slots[cur_col]->id(); const bool is_repeat_slot = p._all_slot_ids.contains(slot_id); const bool is_set_null_slot = !p._slot_id_set_list[repeat_id_idx].contains(slot_id); const auto row_size = src_column.column->size(); - vectorized::ColumnPtr src = src_column.column; + ColumnPtr src = src_column.column; if (is_repeat_slot) { DCHECK(p._output_slots[cur_col]->is_nullable()); - auto* nullable_column = - assert_cast(output_columns[cur_col].get()); + auto* nullable_column = assert_cast(output_columns[cur_col].get()); if (is_set_null_slot) { // is_set_null_slot = true, output all null nullable_column->insert_many_defaults(row_size); @@ -164,22 +160,21 @@ Status RepeatLocalState::get_repeated_block(vectorized::Block* input_block, int } Status RepeatLocalState::add_grouping_id_column(std::size_t rows, std::size_t& cur_col, - vectorized::MutableColumns& columns, - int repeat_id_idx) { + MutableColumns& columns, int repeat_id_idx) { auto& p = _parent->cast(); for (auto slot_idx = 0; slot_idx < p._grouping_list.size(); slot_idx++) { DCHECK_LT(slot_idx, p._output_slots.size()); int64_t val = p._grouping_list[slot_idx][repeat_id_idx]; auto* column_ptr = columns[cur_col].get(); DCHECK(!p._output_slots[cur_col]->is_nullable()); - auto* col = assert_cast(column_ptr); + auto* col = assert_cast(column_ptr); col->insert_many_vals(val, rows); cur_col++; } return Status::OK(); } -Status RepeatOperatorX::push(RuntimeState* state, vectorized::Block* input_block, bool eos) const { +Status RepeatOperatorX::push(RuntimeState* state, Block* input_block, bool eos) const { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state._evaluate_input_timer); local_state._child_eos = eos; @@ -188,10 +183,10 @@ Status RepeatOperatorX::push(RuntimeState* state, vectorized::Block* input_block DCHECK(!intermediate_block || intermediate_block->rows() == 0); if (input_block->rows() > 0) { SCOPED_PEAK_MEM(&local_state._estimate_memory_usage); - intermediate_block = vectorized::Block::create_unique(); + intermediate_block = Block::create_unique(); for (auto& expr : expr_ctxs) { - vectorized::ColumnWithTypeAndName result_data; + ColumnWithTypeAndName result_data; RETURN_IF_ERROR(expr->execute(input_block, result_data)); result_data.column = result_data.column->convert_to_full_column_if_const(); intermediate_block->insert(result_data); @@ -202,8 +197,7 @@ Status RepeatOperatorX::push(RuntimeState* state, vectorized::Block* input_block return Status::OK(); } -Status RepeatOperatorX::pull(doris::RuntimeState* state, vectorized::Block* output_block, - bool* eos) const { +Status RepeatOperatorX::pull(doris::RuntimeState* state, Block* output_block, bool* eos) const { auto& local_state = get_local_state(state); auto& _repeat_id_idx = local_state._repeat_id_idx; auto& _child_block = *local_state._child_block; @@ -236,8 +230,8 @@ Status RepeatOperatorX::pull(doris::RuntimeState* state, vectorized::Block* outp _repeat_id_idx = 0; } } else if (local_state._expr_ctxs.empty()) { - auto m_block = vectorized::VectorizedUtils::build_mutable_mem_reuse_block( - output_block, _output_slots); + auto m_block = + VectorizedUtils::build_mutable_mem_reuse_block(output_block, _output_slots); auto rows = _child_block.rows(); auto& columns = m_block.mutable_columns(); @@ -256,8 +250,8 @@ Status RepeatOperatorX::pull(doris::RuntimeState* state, vectorized::Block* outp { SCOPED_TIMER(local_state._filter_timer); - RETURN_IF_ERROR(vectorized::VExprContext::filter_block(local_state._conjuncts, output_block, - output_block->columns())); + RETURN_IF_ERROR(VExprContext::filter_block(local_state._conjuncts, output_block, + output_block->columns())); } *eos = _child_eos && _child_block.rows() == 0; @@ -266,4 +260,4 @@ Status RepeatOperatorX::pull(doris::RuntimeState* state, vectorized::Block* outp } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/repeat_operator.h b/be/src/exec/operator/repeat_operator.h similarity index 79% rename from be/src/pipeline/exec/repeat_operator.h rename to be/src/exec/operator/repeat_operator.h index 32726a14008ffc..78afb626971714 100644 --- a/be/src/pipeline/exec/repeat_operator.h +++ b/be/src/exec/operator/repeat_operator.h @@ -20,14 +20,12 @@ #include #include "common/status.h" -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace pipeline { - class RepeatOperatorX; class RepeatLocalState final : public PipelineXLocalState { @@ -40,21 +38,20 @@ class RepeatLocalState final : public PipelineXLocalState { Status init(RuntimeState* state, LocalStateInfo& info) override; Status open(RuntimeState* state) override; - Status get_repeated_block(vectorized::Block* child_block, int repeat_id_idx, - vectorized::Block* output_block); + Status get_repeated_block(Block* child_block, int repeat_id_idx, Block* output_block); - Status add_grouping_id_column(std::size_t rows, std::size_t& cur_col, - vectorized::MutableColumns& columns, int repeat_id_idx); + Status add_grouping_id_column(std::size_t rows, std::size_t& cur_col, MutableColumns& columns, + int repeat_id_idx); private: friend class RepeatOperatorX; template friend class StatefulOperatorX; - std::unique_ptr _child_block; + std::unique_ptr _child_block; bool _child_eos = false; int _repeat_id_idx; - std::unique_ptr _intermediate_block; - vectorized::VExprContextSPtrs _expr_ctxs; + std::unique_ptr _intermediate_block; + VExprContextSPtrs _expr_ctxs; RuntimeProfile::Counter* _evaluate_input_timer = nullptr; RuntimeProfile::Counter* _get_repeat_data_timer = nullptr; @@ -74,8 +71,8 @@ class RepeatOperatorX final : public StatefulOperatorX { Status prepare(RuntimeState* state) override; bool need_more_input_data(RuntimeState* state) const override; - Status pull(RuntimeState* state, vectorized::Block* output_block, bool* eos) const override; - Status push(RuntimeState* state, vectorized::Block* input_block, bool eos) const override; + Status pull(RuntimeState* state, Block* output_block, bool* eos) const override; + Status push(RuntimeState* state, Block* input_block, bool eos) const override; private: friend class RepeatLocalState; @@ -91,9 +88,8 @@ class RepeatOperatorX final : public StatefulOperatorX { std::vector _output_slots; - vectorized::VExprContextSPtrs _expr_ctxs; + VExprContextSPtrs _expr_ctxs; }; -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/pipeline/exec/result_file_sink_operator.cpp b/be/src/exec/operator/result_file_sink_operator.cpp similarity index 88% rename from be/src/pipeline/exec/result_file_sink_operator.cpp rename to be/src/exec/operator/result_file_sink_operator.cpp index 0e2667c752f129..dc282a53fcbbda 100644 --- a/be/src/pipeline/exec/result_file_sink_operator.cpp +++ b/be/src/exec/operator/result_file_sink_operator.cpp @@ -15,24 +15,24 @@ // specific language governing permissions and limitations // under the License. -#include "result_file_sink_operator.h" +#include "exec/operator/result_file_sink_operator.h" #include #include -#include "pipeline/exec/exchange_sink_buffer.h" -#include "pipeline/exec/operator.h" -#include "pipeline/exec/result_sink_operator.h" +#include "exec/exchange/vdata_stream_sender.h" +#include "exec/operator/exchange_sink_buffer.h" +#include "exec/operator/operator.h" +#include "exec/operator/result_sink_operator.h" #include "runtime/result_block_buffer.h" #include "runtime/result_buffer_mgr.h" -#include "vec/sink/vdata_stream_sender.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" ResultFileSinkLocalState::ResultFileSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state) - : AsyncWriterSink(parent, state) {} + : AsyncWriterSink(parent, state) {} ResultFileSinkOperatorX::ResultFileSinkOperatorX(int operator_id, const RowDescriptor& row_desc, const std::vector& t_output_expr) @@ -69,18 +69,18 @@ Status ResultFileSinkOperatorX::init(const TDataSink& tsink) { _header = sink.header; // From the thrift expressions create the real exprs. - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(_t_output_expr, _output_vexpr_ctxs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(_t_output_expr, _output_vexpr_ctxs)); return Status::OK(); } Status ResultFileSinkOperatorX::prepare(RuntimeState* state) { RETURN_IF_ERROR(DataSinkOperatorX::prepare(state)); - RETURN_IF_ERROR(vectorized::VExpr::prepare(_output_vexpr_ctxs, state, _row_desc)); + RETURN_IF_ERROR(VExpr::prepare(_output_vexpr_ctxs, state, _row_desc)); if (state->query_options().enable_parallel_outfile) { RETURN_IF_ERROR(state->exec_env()->result_mgr()->create_sender( state->query_id(), _buf_size, &_sender, state, false, nullptr)); } - return vectorized::VExpr::open(_output_vexpr_ctxs, state); + return VExpr::open(_output_vexpr_ctxs, state); } Status ResultFileSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& info) { @@ -101,7 +101,7 @@ Status ResultFileSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& i _sender->set_dependency(state->fragment_instance_id(), _dependency->shared_from_this()); // create writer - _writer.reset(new (std::nothrow) vectorized::VFileResultWriter( + _writer.reset(new (std::nothrow) VFileResultWriter( p._file_opts.get(), p._storage_type, state->fragment_instance_id(), _output_vexpr_ctxs, _sender, nullptr, state->return_object_data_as_binary(), p._output_row_descriptor, _async_writer_dependency, _finish_dependency)); @@ -142,7 +142,7 @@ Status ResultFileSinkLocalState::close(RuntimeState* state, Status exec_status) return Base::close(state, exec_status); } -Status ResultFileSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block, bool eos) { +Status ResultFileSinkOperatorX::sink(RuntimeState* state, Block* in_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)in_block->rows()); @@ -150,4 +150,4 @@ Status ResultFileSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_ } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/result_file_sink_operator.h b/be/src/exec/operator/result_file_sink_operator.h similarity index 81% rename from be/src/pipeline/exec/result_file_sink_operator.h rename to be/src/exec/operator/result_file_sink_operator.h index ae474ee54c49b4..2f4bcb8e2c8321 100644 --- a/be/src/pipeline/exec/result_file_sink_operator.h +++ b/be/src/exec/operator/result_file_sink_operator.h @@ -17,21 +17,21 @@ #pragma once -#include "operator.h" -#include "vec/sink/writer/vfile_result_writer.h" +#include "exec/operator/operator.h" +#include "exec/sink/writer/vfile_result_writer.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class BroadcastPBlockHolder; -} // namespace doris::vectorized +} // namespace doris -namespace doris::pipeline { +namespace doris { class ResultFileSinkOperatorX; class ResultFileSinkLocalState final - : public AsyncWriterSink { + : public AsyncWriterSink { public: - using Base = AsyncWriterSink; + using Base = AsyncWriterSink; ENABLE_FACTORY_CREATOR(ResultFileSinkLocalState); ResultFileSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state); ~ResultFileSinkLocalState() override; @@ -46,7 +46,7 @@ class ResultFileSinkLocalState final std::shared_ptr _sender; - std::shared_ptr _block_holder; + std::shared_ptr _block_holder; int _sender_id; }; @@ -62,12 +62,12 @@ class ResultFileSinkOperatorX final : public DataSinkOperatorX - requires(std::is_base_of_v) + requires(std::is_base_of_v) friend class AsyncWriterSink; const RowDescriptor& _row_desc; @@ -85,9 +85,9 @@ class ResultFileSinkOperatorX final : public DataSinkOperatorX _sender = nullptr; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/result_sink_operator.cpp b/be/src/exec/operator/result_sink_operator.cpp similarity index 89% rename from be/src/pipeline/exec/result_sink_operator.cpp rename to be/src/exec/operator/result_sink_operator.cpp index 76cdb64823990e..b361cb7b6e1f90 100644 --- a/be/src/pipeline/exec/result_sink_operator.cpp +++ b/be/src/exec/operator/result_sink_operator.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "result_sink_operator.h" +#include "exec/operator/result_sink_operator.h" #include #include @@ -23,18 +23,18 @@ #include #include "common/config.h" +#include "exec/operator/operator.h" #include "exec/rowid_fetcher.h" -#include "pipeline/exec/operator.h" +#include "exec/sink/writer/varrow_flight_result_writer.h" +#include "exec/sink/writer/vmysql_result_writer.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" +#include "format/arrow/arrow_row_batch.h" #include "runtime/exec_env.h" #include "runtime/result_block_buffer.h" #include "runtime/result_buffer_mgr.h" -#include "util/arrow/row_batch.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/sink/varrow_flight_result_writer.h" -#include "vec/sink/vmysql_result_writer.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" Status ResultSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& info) { @@ -77,13 +77,13 @@ Status ResultSinkLocalState::open(RuntimeState* state) { // create writer based on sink type switch (p._sink_type) { case TResultSinkType::MYSQL_PROTOCOL: { - _writer.reset(new (std::nothrow) vectorized::VMysqlResultWriter( + _writer.reset(new (std::nothrow) VMysqlResultWriter( _sender, _output_vexpr_ctxs, custom_profile(), state->mysql_row_binary_format())); break; } case TResultSinkType::ARROW_FLIGHT_PROTOCOL: { - _writer.reset(new (std::nothrow) vectorized::VArrowFlightResultWriter( - _sender, _output_vexpr_ctxs, custom_profile())); + _writer.reset(new (std::nothrow) VArrowFlightResultWriter(_sender, _output_vexpr_ctxs, + custom_profile())); break; } default: @@ -115,9 +115,9 @@ Status ResultSinkOperatorX::prepare(RuntimeState* state) { RETURN_IF_ERROR(DataSinkOperatorX::prepare(state)); // prepare output_expr // From the thrift expressions create the real exprs. - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(_t_output_expr, _output_vexpr_ctxs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(_t_output_expr, _output_vexpr_ctxs)); // Prepare the exprs to run. - RETURN_IF_ERROR(vectorized::VExpr::prepare(_output_vexpr_ctxs, state, _row_desc)); + RETURN_IF_ERROR(VExpr::prepare(_output_vexpr_ctxs, state, _row_desc)); if (state->query_options().enable_parallel_result_sink) { std::shared_ptr arrow_schema; @@ -130,10 +130,10 @@ Status ResultSinkOperatorX::prepare(RuntimeState* state) { state->query_id(), _result_sink_buffer_size_rows, &_sender, state, _sink_type == TResultSinkType::ARROW_FLIGHT_PROTOCOL, arrow_schema)); } - return vectorized::VExpr::open(_output_vexpr_ctxs, state); + return VExpr::open(_output_vexpr_ctxs, state); } -Status ResultSinkOperatorX::sink(RuntimeState* state, vectorized::Block* block, bool eos) { +Status ResultSinkOperatorX::sink(RuntimeState* state, Block* block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)block->rows()); @@ -153,8 +153,7 @@ Status ResultSinkOperatorX::sink(RuntimeState* state, vectorized::Block* block, return Status::OK(); } -Status ResultSinkOperatorX::_second_phase_fetch_data(RuntimeState* state, - vectorized::Block* final_block) { +Status ResultSinkOperatorX::_second_phase_fetch_data(RuntimeState* state, Block* final_block) { auto row_id_col = final_block->get_by_position(final_block->columns() - 1); CHECK(row_id_col.name == BeConsts::ROWID_COL); auto* tuple_desc = _row_desc.tuple_descriptors()[0]; @@ -208,4 +207,4 @@ Status ResultSinkLocalState::close(RuntimeState* state, Status exec_status) { } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/result_sink_operator.h b/be/src/exec/operator/result_sink_operator.h similarity index 94% rename from be/src/pipeline/exec/result_sink_operator.h rename to be/src/exec/operator/result_sink_operator.h index a7911a63b95d95..752e6a367c9678 100644 --- a/be/src/pipeline/exec/result_sink_operator.h +++ b/be/src/exec/operator/result_sink_operator.h @@ -20,16 +20,14 @@ #include #include -#include "operator.h" +#include "exec/operator/operator.h" +#include "exec/sink/writer/result_writer.h" #include "runtime/result_block_buffer.h" -#include "runtime/result_writer.h" namespace doris { #include "common/compile_check_begin.h" class ResultBlockBufferBase; -namespace pipeline { - struct ResultFileOptions { // [[deprecated]] bool is_local_file; @@ -143,7 +141,7 @@ class ResultSinkLocalState final : public PipelineXSinkLocalState _sender = nullptr; std::shared_ptr _writer = nullptr; @@ -158,12 +156,12 @@ class ResultSinkOperatorX final : public DataSinkOperatorX const std::vector& select_exprs, const TResultSink& sink); Status prepare(RuntimeState* state) override; - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos) override; + Status sink(RuntimeState* state, Block* in_block, bool eos) override; private: friend class ResultSinkLocalState; - Status _second_phase_fetch_data(RuntimeState* state, vectorized::Block* final_block); + Status _second_phase_fetch_data(RuntimeState* state, Block* final_block); const TResultSinkType::type _sink_type; const int _result_sink_buffer_size_rows; // set file options when sink type is FILE @@ -174,7 +172,7 @@ class ResultSinkOperatorX final : public DataSinkOperatorX // Owned by the RuntimeState. const std::vector& _t_output_expr; - vectorized::VExprContextSPtrs _output_vexpr_ctxs; + VExprContextSPtrs _output_vexpr_ctxs; // for fetch data by rowids const TFetchOption _fetch_option; @@ -182,6 +180,5 @@ class ResultSinkOperatorX final : public DataSinkOperatorX std::shared_ptr _sender = nullptr; }; -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/pipeline/exec/scan_operator.cpp b/be/src/exec/operator/scan_operator.cpp similarity index 90% rename from be/src/pipeline/exec/scan_operator.cpp rename to be/src/exec/operator/scan_operator.cpp index eb6e69697ab7c6..07af9e39d20e13 100644 --- a/be/src/pipeline/exec/scan_operator.cpp +++ b/be/src/exec/operator/scan_operator.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "scan_operator.h" +#include "exec/operator/scan_operator.h" #include #include @@ -25,36 +25,35 @@ #include #include "common/global_types.h" -#include "olap/null_predicate.h" -#include "olap/predicate_creator.h" -#include "pipeline/exec/es_scan_operator.h" -#include "pipeline/exec/file_scan_operator.h" -#include "pipeline/exec/group_commit_scan_operator.h" -#include "pipeline/exec/jdbc_scan_operator.h" -#include "pipeline/exec/meta_scan_operator.h" -#include "pipeline/exec/mock_scan_operator.h" -#include "pipeline/exec/olap_scan_operator.h" -#include "pipeline/exec/operator.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_array.h" +#include "exec/operator/es_scan_operator.h" +#include "exec/operator/file_scan_operator.h" +#include "exec/operator/group_commit_scan_operator.h" +#include "exec/operator/jdbc_scan_operator.h" +#include "exec/operator/meta_scan_operator.h" +#include "exec/operator/mock_scan_operator.h" +#include "exec/operator/olap_scan_operator.h" +#include "exec/operator/operator.h" +#include "exec/runtime_filter/runtime_filter_consumer_helper.h" +#include "exec/scan/scanner_context.h" +#include "exprs/function/in.h" +#include "exprs/vcast_expr.h" +#include "exprs/vectorized_fn_call.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" +#include "exprs/vexpr_fwd.h" +#include "exprs/vin_predicate.h" +#include "exprs/virtual_slot_ref.h" +#include "exprs/vruntimefilter_wrapper.h" +#include "exprs/vslot_ref.h" +#include "exprs/vtopn_pred.h" #include "runtime/descriptors.h" -#include "runtime/types.h" -#include "runtime_filter/runtime_filter_consumer_helper.h" -#include "util/runtime_profile.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_array.h" -#include "vec/exec/scan/scanner_context.h" -#include "vec/exprs/vcast_expr.h" -#include "vec/exprs/vectorized_fn_call.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/exprs/vin_predicate.h" -#include "vec/exprs/virtual_slot_ref.h" -#include "vec/exprs/vruntimefilter_wrapper.h" -#include "vec/exprs/vslot_ref.h" -#include "vec/exprs/vtopn_pred.h" -#include "vec/functions/in.h" - -namespace doris::pipeline { +#include "runtime/runtime_profile.h" +#include "storage/predicate/null_predicate.h" +#include "storage/predicate/predicate_creator.h" + +namespace doris { #include "common/compile_check_begin.h" @@ -87,7 +86,7 @@ Status ScanLocalStateBase::update_late_arrival_runtime_filter(RuntimeState* stat return Status::OK(); } -Status ScanLocalStateBase::clone_conjunct_ctxs(vectorized::VExprContextSPtrs& scanner_conjuncts) { +Status ScanLocalStateBase::clone_conjunct_ctxs(VExprContextSPtrs& scanner_conjuncts) { // Lock needed because _conjuncts can be accessed concurrently by multiple scanner threads std::unique_lock lock(_conjuncts_lock); scanner_conjuncts.resize(_conjuncts.size()); @@ -128,7 +127,7 @@ int ScanLocalStateBase::min_scanners_concurrency(RuntimeState* state) const { (state->query_parallel_instance_num() / _parent->parallelism(state)); } -vectorized::ScannerScheduler* ScanLocalStateBase::scan_scheduler(RuntimeState* state) const { +ScannerScheduler* ScanLocalStateBase::scan_scheduler(RuntimeState* state) const { return state->get_query_ctx()->get_scan_scheduler(); } @@ -220,7 +219,7 @@ static std::string predicates_to_string( static void init_slot_value_range( phmap::flat_hash_map& slot_id_to_value_range, - SlotDescriptor* slot, const vectorized::DataTypePtr type_desc) { + SlotDescriptor* slot, const DataTypePtr type_desc) { switch (type_desc->get_primitive_type()) { #define M(NAME) \ case TYPE_##NAME: { \ @@ -273,8 +272,8 @@ Status ScanLocalState::_normalize_conjuncts(RuntimeState* state) { for (auto& slot : slots) { auto type = slot->type()->get_primitive_type(); if (type == TYPE_ARRAY) { - type = assert_cast( - vectorized::remove_nullable(slot->type()).get()) + type = assert_cast( + remove_nullable(slot->type()).get()) ->get_nested_type() ->get_primitive_type(); if (type == TYPE_ARRAY) { @@ -299,12 +298,12 @@ Status ScanLocalState::_normalize_conjuncts(RuntimeState* state) { for (auto it = _conjuncts.begin(); it != _conjuncts.end();) { auto& conjunct = *it; if (conjunct->root()) { - vectorized::VExprSPtr new_root; + VExprSPtr new_root; RETURN_IF_ERROR(_normalize_predicate(conjunct.get(), conjunct->root(), new_root)); if (new_root) { conjunct->set_root(new_root); if (_should_push_down_common_expr() && - vectorized::VExpr::is_acting_on_a_slot(*(conjunct->root()))) { + VExpr::is_acting_on_a_slot(*(conjunct->root()))) { _common_expr_ctxs_push_down.emplace_back(conjunct); it = _conjuncts.erase(it); continue; @@ -349,12 +348,12 @@ Status ScanLocalState::_normalize_conjuncts(RuntimeState* state) { } template -Status ScanLocalState::_normalize_predicate(vectorized::VExprContext* context, - const vectorized::VExprSPtr& root, - vectorized::VExprSPtr& output_expr) { +Status ScanLocalState::_normalize_predicate(VExprContext* context, + const VExprSPtr& root, + VExprSPtr& output_expr) { auto expr_root = root->is_rf_wrapper() ? root->get_impl() : root; PushDownType pdt = PushDownType::UNACCEPTABLE; - if (dynamic_cast(expr_root.get())) { + if (dynamic_cast(expr_root.get())) { // If the expr has virtual slot ref, we need to keep it in the tree. output_expr = expr_root; return Status::OK(); @@ -367,14 +366,14 @@ Status ScanLocalState::_normalize_predicate(vectorized::VExprContext* c output_expr = nullptr; return Status::OK(); } - std::shared_ptr slotref; + std::shared_ptr slotref; for (const auto& child : expr_root->children()) { - if (vectorized::VExpr::expr_without_cast(child)->node_type() != TExprNodeType::SLOT_REF) { + if (VExpr::expr_without_cast(child)->node_type() != TExprNodeType::SLOT_REF) { // not a slot ref(column) continue; } - slotref = std::dynamic_pointer_cast( - vectorized::VExpr::expr_without_cast(child)); + slotref = std::dynamic_pointer_cast( + VExpr::expr_without_cast(child)); } if (_is_predicate_acting_on_slot(expr_root->children(), &slot, &range)) { Status status = Status::OK(); @@ -385,7 +384,7 @@ Status ScanLocalState::_normalize_predicate(vectorized::VExprContext* c Defer attach_defer = [&]() { if (pdt != PushDownType::UNACCEPTABLE && root->is_rf_wrapper()) { auto* rf_expr = - assert_cast(root.get()); + assert_cast(root.get()); _slot_id_to_predicates[slot->id()].back()->attach_profile_counter( rf_expr->filter_id(), rf_expr->predicate_filtered_rows_counter(), @@ -471,7 +470,7 @@ Status ScanLocalState::_normalize_predicate(vectorized::VExprContext* c template Status ScanLocalState::_normalize_bloom_filter( - vectorized::VExprContext* expr_ctx, const vectorized::VExprSPtr& root, SlotDescriptor* slot, + VExprContext* expr_ctx, const VExprSPtr& root, SlotDescriptor* slot, std::vector>& predicates, PushDownType* pdt) { std::shared_ptr pred = nullptr; Defer defer = [&]() { @@ -500,7 +499,7 @@ Status ScanLocalState::_normalize_bloom_filter( template Status ScanLocalState::_normalize_topn_filter( - vectorized::VExprContext* expr_ctx, const vectorized::VExprSPtr& root, SlotDescriptor* slot, + VExprContext* expr_ctx, const VExprSPtr& root, SlotDescriptor* slot, std::vector>& predicates, PushDownType* pdt) { std::shared_ptr pred = nullptr; Defer defer = [&]() { @@ -517,7 +516,7 @@ Status ScanLocalState::_normalize_topn_filter( if (*pdt != PushDownType::UNACCEPTABLE) { auto& p = _parent->cast(); auto& tmp = _state->get_query_ctx()->get_runtime_predicate( - assert_cast(root.get())->source_node_id()); + assert_cast(root.get())->source_node_id()); if (_push_down_topn(tmp)) { pred = tmp.get_predicate(p.node_id()); } @@ -527,7 +526,7 @@ Status ScanLocalState::_normalize_topn_filter( template Status ScanLocalState::_normalize_bitmap_filter( - vectorized::VExprContext* expr_ctx, const vectorized::VExprSPtr& root, SlotDescriptor* slot, + VExprContext* expr_ctx, const VExprSPtr& root, SlotDescriptor* slot, std::vector>& predicates, PushDownType* pdt) { std::shared_ptr pred = nullptr; Defer defer = [&]() { @@ -555,12 +554,12 @@ Status ScanLocalState::_normalize_bitmap_filter( } template -Status ScanLocalState::_normalize_function_filters(vectorized::VExprContext* expr_ctx, +Status ScanLocalState::_normalize_function_filters(VExprContext* expr_ctx, SlotDescriptor* slot, PushDownType* pdt) { auto expr = expr_ctx->root()->is_rf_wrapper() ? expr_ctx->root()->get_impl() : expr_ctx->root(); bool opposite = false; - vectorized::VExpr* fn_expr = expr.get(); + VExpr* fn_expr = expr.get(); if (TExprNodeType::COMPOUND_PRED == expr->node_type() && expr->fn().name.function_name == "not") { fn_expr = fn_expr->children()[0].get(); @@ -572,7 +571,7 @@ Status ScanLocalState::_normalize_function_filters(vectorized::VExprCon StringRef val; PushDownType temp_pdt; RETURN_IF_ERROR(_should_push_down_function_filter( - assert_cast(fn_expr), expr_ctx, &val, &fn_ctx, + assert_cast(fn_expr), expr_ctx, &val, &fn_ctx, temp_pdt)); if (temp_pdt != PushDownType::UNACCEPTABLE) { std::string col = slot->col_name(); @@ -585,15 +584,15 @@ Status ScanLocalState::_normalize_function_filters(vectorized::VExprCon // only one level cast expr could push down for variant type // check if expr is cast and it's children is slot -static bool is_valid_push_down_cast(const vectorized::VExprSPtrs& children) { - auto slot_expr = vectorized::VExpr::expr_without_cast(children[0]); +static bool is_valid_push_down_cast(const VExprSPtrs& children) { + auto slot_expr = VExpr::expr_without_cast(children[0]); return slot_expr->data_type()->get_primitive_type() == PrimitiveType::TYPE_VARIANT && children[0]->node_type() == TExprNodeType::CAST_EXPR && children[0]->children().at(0)->is_slot_ref(); } template -bool ScanLocalState::_is_predicate_acting_on_slot(const vectorized::VExprSPtrs& children, +bool ScanLocalState::_is_predicate_acting_on_slot(const VExprSPtrs& children, SlotDescriptor** slot_desc, ColumnValueRangeType** range) { // children[0] must be slot ref or cast(slot(variant) as type) @@ -602,9 +601,9 @@ bool ScanLocalState::_is_predicate_acting_on_slot(const vectorized::VEx // not a slot ref(column) return false; } - std::shared_ptr slot_ref = - std::dynamic_pointer_cast( - vectorized::VExpr::expr_without_cast(children[0])); + std::shared_ptr slot_ref = + std::dynamic_pointer_cast( + VExpr::expr_without_cast(children[0])); *slot_desc = _parent->cast()._slot_id_to_slot_desc[slot_ref->slot_id()]; auto entry = _slot_id_to_predicates.find(slot_ref->slot_id()); @@ -640,7 +639,7 @@ std::string ScanLocalState::debug_string(int indentation_level) const { } template -Status ScanLocalState::_eval_const_conjuncts(vectorized::VExprContext* expr_ctx, +Status ScanLocalState::_eval_const_conjuncts(VExprContext* expr_ctx, PushDownType* pdt) { auto vexpr = expr_ctx->root()->is_rf_wrapper() ? expr_ctx->root()->get_impl() : expr_ctx->root(); @@ -649,7 +648,7 @@ Status ScanLocalState::_eval_const_conjuncts(vectorized::VExprContext* if (vexpr->is_constant()) { std::shared_ptr const_col_wrapper; RETURN_IF_ERROR(vexpr->get_const_col(expr_ctx, &const_col_wrapper)); - if (const auto* const_column = check_and_get_column( + if (const auto* const_column = check_and_get_column( const_col_wrapper->column_ptr.get())) { constant_val = const_column->get_data_at(0).data; if (constant_val == nullptr || !*reinterpret_cast(constant_val)) { @@ -657,7 +656,7 @@ Status ScanLocalState::_eval_const_conjuncts(vectorized::VExprContext* _eos = true; _scan_dependency->set_ready(); } - } else if (const auto* bool_column = check_and_get_column( + } else if (const auto* bool_column = check_and_get_column( const_col_wrapper->column_ptr.get())) { // TODO: If `vexpr->is_constant()` is true, a const column is expected here. // But now we still don't cover all predicates for const expression. @@ -692,7 +691,7 @@ Status ScanLocalState::_eval_const_conjuncts(vectorized::VExprContext* template template Status ScanLocalState::_normalize_in_predicate( - vectorized::VExprContext* expr_ctx, const vectorized::VExprSPtr& root, SlotDescriptor* slot, + VExprContext* expr_ctx, const VExprSPtr& root, SlotDescriptor* slot, std::vector>& predicates, ColumnValueRange& range, PushDownType* pdt) { std::shared_ptr pred = nullptr; @@ -730,10 +729,10 @@ Status ScanLocalState::_normalize_in_predicate( is_in = true; } else { // normal in predicate - auto* tmp = assert_cast(root.get()); + auto* tmp = assert_cast(root.get()); // begin to push InPredicate value into ColumnValueRange - auto* state = reinterpret_cast( + auto* state = reinterpret_cast( expr_ctx->fn_context(tmp->fn_context_index()) ->get_function_state(FunctionContext::FRAGMENT_LOCAL)); @@ -768,13 +767,13 @@ Status ScanLocalState::_normalize_in_predicate( if constexpr (is_string_type(T)) { const auto* str_value = reinterpret_cast(value); RETURN_IF_ERROR(_change_value_range(is_in, temp_range, - vectorized::Field::create_field(std::string( + Field::create_field(std::string( str_value->data, str_value->size)), fn, is_in ? "in" : "not_in")); } else { RETURN_IF_ERROR(_change_value_range( is_in, temp_range, - vectorized::Field::create_field( + Field::create_field( *reinterpret_cast::CppType*>( value)), fn, is_in ? "in" : "not_in")); @@ -805,7 +804,7 @@ Status ScanLocalState::_normalize_in_predicate( template template Status ScanLocalState::_normalize_binary_predicate( - vectorized::VExprContext* expr_ctx, const vectorized::VExprSPtr& root, SlotDescriptor* slot, + VExprContext* expr_ctx, const VExprSPtr& root, SlotDescriptor* slot, std::vector>& predicates, ColumnValueRange& range, PushDownType* pdt) { std::shared_ptr pred = nullptr; @@ -827,15 +826,15 @@ Status ScanLocalState::_normalize_binary_predicate( DCHECK(!root->is_rf_wrapper()) << root->debug_string(); DCHECK(TExprNodeType::BINARY_PRED == root->node_type()) << root->debug_string(); DCHECK(root->get_num_children() == 2); - vectorized::Field value; + Field value; *pdt = _should_push_down_binary_predicate( - assert_cast(root.get()), expr_ctx, value, + assert_cast(root.get()), expr_ctx, value, {"eq", "ne", "lt", "gt", "le", "ge"}); if (*pdt == PushDownType::UNACCEPTABLE) { return Status::OK(); } const std::string& function_name = - assert_cast(root.get())->fn().name.function_name; + assert_cast(root.get())->fn().name.function_name; auto op = to_olap_filter_type(function_name); auto is_equal_op = op == SQLFilterOp::FILTER_EQ || op == SQLFilterOp::FILTER_NE; auto empty_range = ColumnValueRange::create_empty_column_value_range( @@ -918,7 +917,7 @@ template template Status ScanLocalState::_change_value_range(bool is_equal_op, ColumnValueRange& temp_range, - const vectorized::Field& value, + const Field& value, const ChangeFixedValueRangeFunc& func, const std::string& fn_name) { if constexpr (PrimitiveType == TYPE_DATE) { @@ -959,7 +958,7 @@ Status ScanLocalState::_change_value_range(bool is_equal_op, template template Status ScanLocalState::_normalize_is_null_predicate( - vectorized::VExprContext* expr_ctx, const vectorized::VExprSPtr& root, SlotDescriptor* slot, + VExprContext* expr_ctx, const VExprSPtr& root, SlotDescriptor* slot, std::vector>& predicates, ColumnValueRange& range, PushDownType* pdt) { std::shared_ptr pred = nullptr; @@ -974,7 +973,7 @@ Status ScanLocalState::_normalize_is_null_predicate( }; DCHECK(!root->is_rf_wrapper()) << root->debug_string(); DCHECK(TExprNodeType::FUNCTION_CALL == root->node_type()) << root->debug_string(); - if (auto fn_call = dynamic_cast(root.get())) { + if (auto fn_call = dynamic_cast(root.get())) { *pdt = _should_push_down_is_null_predicate(fn_call); } else { *pdt = PushDownType::UNACCEPTABLE; @@ -984,7 +983,7 @@ Status ScanLocalState::_normalize_is_null_predicate( return Status::OK(); } - auto fn_call = assert_cast(root.get()); + auto fn_call = assert_cast(root.get()); if (fn_call->fn().name.function_name == "is_null_pred") { pred = NullPredicate::create_shared( _parent->intermediate_row_desc().get_column_id(slot->id()), slot->col_name(), true, @@ -1007,11 +1006,11 @@ Status ScanLocalState::_normalize_is_null_predicate( template Status ScanLocalState::_prepare_scanners() { - std::list scanners; + std::list scanners; RETURN_IF_ERROR(_init_scanners(&scanners)); // Init scanner wrapper for (auto it = scanners.begin(); it != scanners.end(); ++it) { - _scanners.emplace_back(std::make_shared(*it)); + _scanners.emplace_back(std::make_shared(*it)); } if (scanners.empty()) { _eos = true; @@ -1025,9 +1024,9 @@ Status ScanLocalState::_prepare_scanners() { template Status ScanLocalState::_start_scanners( - const std::list>& scanners) { + const std::list>& scanners) { auto& p = _parent->cast(); - _scanner_ctx = vectorized::ScannerContext::create_shared(state(), this, p._output_tuple_desc, + _scanner_ctx = ScannerContext::create_shared(state(), this, p._output_tuple_desc, p.output_row_descriptor(), scanners, p.limit(), _scan_dependency #ifdef BE_TEST @@ -1102,11 +1101,11 @@ Status ScanLocalState::_get_topn_filters(RuntimeState* state) { for (auto id : get_topn_filter_source_node_ids(state, false)) { const auto& pred = state->get_query_ctx()->get_runtime_predicate(id); - vectorized::VExprSPtr topn_pred; - RETURN_IF_ERROR(vectorized::VTopNPred::create_vtopn_pred(pred.get_texpr(p.node_id()), id, + VExprSPtr topn_pred; + RETURN_IF_ERROR(VTopNPred::create_vtopn_pred(pred.get_texpr(p.node_id()), id, topn_pred)); - vectorized::VExprContextSPtr conjunct = vectorized::VExprContext::create_shared(topn_pred); + VExprContextSPtr conjunct = VExprContext::create_shared(topn_pred); RETURN_IF_ERROR(conjunct->prepare( state, _parent->cast().row_descriptor())); RETURN_IF_ERROR(conjunct->open(state)); @@ -1114,11 +1113,11 @@ Status ScanLocalState::_get_topn_filters(RuntimeState* state) { } for (auto id : get_topn_filter_source_node_ids(state, true)) { const auto& pred = state->get_query_ctx()->get_runtime_predicate(id); - vectorized::VExprSPtr topn_pred; - RETURN_IF_ERROR(vectorized::VTopNPred::create_vtopn_pred(pred.get_texpr(p.node_id()), id, + VExprSPtr topn_pred; + RETURN_IF_ERROR(VTopNPred::create_vtopn_pred(pred.get_texpr(p.node_id()), id, topn_pred)); - vectorized::VExprContextSPtr conjunct = vectorized::VExprContext::create_shared(topn_pred); + VExprContextSPtr conjunct = VExprContext::create_shared(topn_pred); RETURN_IF_ERROR(conjunct->prepare( state, _parent->cast().row_descriptor())); RETURN_IF_ERROR(conjunct->open(state)); @@ -1129,15 +1128,15 @@ Status ScanLocalState::_get_topn_filters(RuntimeState* state) { template void ScanLocalState::_filter_and_collect_cast_type_for_variant( - const vectorized::VExpr* expr, - std::unordered_map>& + const VExpr* expr, + std::unordered_map>& colname_to_cast_types) { auto& p = _parent->cast(); - const auto* cast_expr = dynamic_cast(expr); + const auto* cast_expr = dynamic_cast(expr); if (cast_expr != nullptr) { const auto* src_slot = cast_expr->get_child(0)->node_type() == TExprNodeType::SLOT_REF - ? dynamic_cast(cast_expr->get_child(0).get()) + ? dynamic_cast(cast_expr->get_child(0).get()) : nullptr; if (src_slot == nullptr) { return; @@ -1156,7 +1155,7 @@ void ScanLocalState::_filter_and_collect_cast_type_for_variant( template void ScanLocalState::get_cast_types_for_variants() { - std::unordered_map> colname_to_cast_types; + std::unordered_map> colname_to_cast_types; for (auto it = _conjuncts.begin(); it != _conjuncts.end();) { auto& conjunct = *it; if (conjunct->root()) { @@ -1287,7 +1286,7 @@ Status ScanLocalState::close(RuntimeState* state) { if (_scanner_ctx) { _scanner_ctx->stop_scanners(state); } - std::list> {}.swap(_scanners); + std::list> {}.swap(_scanners); COUNTER_SET(_wait_for_dependency_timer, _scan_dependency->watcher_elapse_time()); COUNTER_SET(_wait_for_rf_timer, rf_time); _helper.collect_realtime_profile(custom_profile()); @@ -1295,7 +1294,7 @@ Status ScanLocalState::close(RuntimeState* state) { } template -Status ScanOperatorX::get_block(RuntimeState* state, vectorized::Block* block, +Status ScanOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); @@ -1372,4 +1371,4 @@ template class ScanOperatorX; template class ScanLocalState; #endif -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/scan_operator.h b/be/src/exec/operator/scan_operator.h similarity index 79% rename from be/src/pipeline/exec/scan_operator.h rename to be/src/exec/operator/scan_operator.h index 3d72ee6f5bd855..8a669d0930abb5 100644 --- a/be/src/pipeline/exec/scan_operator.h +++ b/be/src/exec/operator/scan_operator.h @@ -22,26 +22,25 @@ #include #include "common/status.h" +#include "exec/common/util.hpp" +#include "exec/operator/operator.h" +#include "exec/pipeline/dependency.h" +#include "exec/runtime_filter/runtime_filter_consumer_helper.h" +#include "exec/scan/scan_node.h" +#include "exec/scan/scanner_context.h" #include "exprs/function_filter.h" -#include "olap/filter_olap_param.h" -#include "operator.h" -#include "pipeline/dependency.h" +#include "exprs/vectorized_fn_call.h" +#include "exprs/vin_predicate.h" #include "runtime/descriptors.h" -#include "runtime/types.h" -#include "runtime_filter/runtime_filter_consumer_helper.h" -#include "vec/exec/scan/scan_node.h" -#include "vec/exec/scan/scanner_context.h" -#include "vec/exprs/vectorized_fn_call.h" -#include "vec/exprs/vin_predicate.h" -#include "vec/utils/util.hpp" - -namespace doris::vectorized { +#include "storage/predicate/filter_olap_param.h" + +namespace doris { #include "common/compile_check_begin.h" class ScannerDelegate; class OlapScanner; -} // namespace doris::vectorized +} // namespace doris -namespace doris::pipeline { +namespace doris { enum class PushDownType { // The predicate can not be pushed down to data source @@ -82,19 +81,19 @@ class ScanLocalStateBase : public PipelineXLocalState<> { // https://github.com/apache/doris/pull/44635 [[nodiscard]] virtual int max_scanners_concurrency(RuntimeState* state) const; [[nodiscard]] virtual int min_scanners_concurrency(RuntimeState* state) const; - [[nodiscard]] virtual vectorized::ScannerScheduler* scan_scheduler(RuntimeState* state) const; + [[nodiscard]] virtual ScannerScheduler* scan_scheduler(RuntimeState* state) const; [[nodiscard]] std::string get_name() { return _parent->get_name(); } Status update_late_arrival_runtime_filter(RuntimeState* state, int& arrived_rf_num); - Status clone_conjunct_ctxs(vectorized::VExprContextSPtrs& scanner_conjuncts); + Status clone_conjunct_ctxs(VExprContextSPtrs& scanner_conjuncts); uint64_t get_condition_cache_digest() const { return _condition_cache_digest; } protected: - friend class vectorized::ScannerContext; - friend class vectorized::Scanner; + friend class ScannerContext; + friend class Scanner; virtual Status _init_profile() = 0; @@ -195,15 +194,15 @@ class ScanLocalState : public ScanLocalStateBase { protected: template friend class ScanOperatorX; - friend class vectorized::ScannerContext; - friend class vectorized::Scanner; + friend class ScannerContext; + friend class Scanner; Status _init_profile() override; virtual Status _process_conjuncts(RuntimeState* state) { return _normalize_conjuncts(state); } virtual bool _should_push_down_common_expr() { return false; } virtual bool _storage_no_merge() { return false; } - virtual bool _push_down_topn(const vectorized::RuntimePredicate& predicate) { return false; } + virtual bool _push_down_topn(const RuntimePredicate& predicate) { return false; } virtual bool _is_key_column(const std::string& col_name) { return false; } virtual PushDownType _should_push_down_bloom_filter() const { return PushDownType::UNACCEPTABLE; @@ -215,20 +214,20 @@ class ScanLocalState : public ScanLocalStateBase { return PushDownType::UNACCEPTABLE; } virtual PushDownType _should_push_down_is_null_predicate( - vectorized::VectorizedFnCall* fn_call) const { + VectorizedFnCall* fn_call) const { return PushDownType::UNACCEPTABLE; } virtual PushDownType _should_push_down_in_predicate() const { return PushDownType::UNACCEPTABLE; } virtual PushDownType _should_push_down_binary_predicate( - vectorized::VectorizedFnCall* fn_call, vectorized::VExprContext* expr_ctx, - vectorized::Field& constant_val, const std::set fn_name) const { + VectorizedFnCall* fn_call, VExprContext* expr_ctx, + Field& constant_val, const std::set fn_name) const { return PushDownType::UNACCEPTABLE; } - virtual Status _should_push_down_function_filter(vectorized::VectorizedFnCall* fn_call, - vectorized::VExprContext* expr_ctx, + virtual Status _should_push_down_function_filter(VectorizedFnCall* fn_call, + VExprContext* expr_ctx, StringRef* constant_str, doris::FunctionContext** fn_ctx, PushDownType& pdt) { @@ -241,69 +240,69 @@ class ScanLocalState : public ScanLocalStateBase { // predicate conditions, and scheduling strategy. // So this method needs to be implemented separately by the subclass of ScanNode. // Finally, a set of scanners that have been prepared are returned. - virtual Status _init_scanners(std::list* scanners) { + virtual Status _init_scanners(std::list* scanners) { return Status::OK(); } Status _normalize_conjuncts(RuntimeState* state); // Normalize a conjunct and try to convert it to column predicate recursively. - Status _normalize_predicate(vectorized::VExprContext* context, - const vectorized::VExprSPtr& root, - vectorized::VExprSPtr& output_expr); - bool _is_predicate_acting_on_slot(const vectorized::VExprSPtrs& children, + Status _normalize_predicate(VExprContext* context, + const VExprSPtr& root, + VExprSPtr& output_expr); + bool _is_predicate_acting_on_slot(const VExprSPtrs& children, SlotDescriptor** slot_desc, ColumnValueRangeType** range); - Status _eval_const_conjuncts(vectorized::VExprContext* expr_ctx, PushDownType* pdt); + Status _eval_const_conjuncts(VExprContext* expr_ctx, PushDownType* pdt); template - Status _normalize_in_predicate(vectorized::VExprContext* expr_ctx, - const vectorized::VExprSPtr& root, SlotDescriptor* slot, + Status _normalize_in_predicate(VExprContext* expr_ctx, + const VExprSPtr& root, SlotDescriptor* slot, std::vector>& predicates, ColumnValueRange& range, PushDownType* pdt); template - Status _normalize_binary_predicate(vectorized::VExprContext* expr_ctx, - const vectorized::VExprSPtr& root, SlotDescriptor* slot, + Status _normalize_binary_predicate(VExprContext* expr_ctx, + const VExprSPtr& root, SlotDescriptor* slot, std::vector>& predicates, ColumnValueRange& range, PushDownType* pdt); - Status _normalize_bloom_filter(vectorized::VExprContext* expr_ctx, - const vectorized::VExprSPtr& root, SlotDescriptor* slot, + Status _normalize_bloom_filter(VExprContext* expr_ctx, + const VExprSPtr& root, SlotDescriptor* slot, std::vector>& predicates, PushDownType* pdt); - Status _normalize_topn_filter(vectorized::VExprContext* expr_ctx, - const vectorized::VExprSPtr& root, SlotDescriptor* slot, + Status _normalize_topn_filter(VExprContext* expr_ctx, + const VExprSPtr& root, SlotDescriptor* slot, std::vector>& predicates, PushDownType* pdt); - Status _normalize_bitmap_filter(vectorized::VExprContext* expr_ctx, - const vectorized::VExprSPtr& root, SlotDescriptor* slot, + Status _normalize_bitmap_filter(VExprContext* expr_ctx, + const VExprSPtr& root, SlotDescriptor* slot, std::vector>& predicates, PushDownType* pdt); - Status _normalize_function_filters(vectorized::VExprContext* expr_ctx, SlotDescriptor* slot, + Status _normalize_function_filters(VExprContext* expr_ctx, SlotDescriptor* slot, PushDownType* pdt); template - Status _normalize_is_null_predicate(vectorized::VExprContext* expr_ctx, - const vectorized::VExprSPtr& root, SlotDescriptor* slot, + Status _normalize_is_null_predicate(VExprContext* expr_ctx, + const VExprSPtr& root, SlotDescriptor* slot, std::vector>& predicates, ColumnValueRange& range, PushDownType* pdt); template Status _change_value_range(bool is_equal_op, ColumnValueRange& range, - const vectorized::Field& value, + const Field& value, const ChangeFixedValueRangeFunc& func, const std::string& fn_name); Status _prepare_scanners(); // Submit the scanner to the thread pool and start execution - Status _start_scanners(const std::list>& scanners); + Status _start_scanners(const std::list>& scanners); // For some conjunct there is chance to elimate cast operator // Eg. Variant's sub column could eliminate cast in storage layer if // cast dst column type equals storage column type void get_cast_types_for_variants(); void _filter_and_collect_cast_type_for_variant( - const vectorized::VExpr* expr, - std::unordered_map>& + const VExpr* expr, + std::unordered_map>& colname_to_cast_types); Status _get_topn_filters(RuntimeState* state); @@ -311,16 +310,16 @@ class ScanLocalState : public ScanLocalStateBase { // Stores conjuncts that have been fully pushed down to the storage layer as predicate columns. // These expr contexts are kept alive to prevent their FunctionContext and constant strings // from being freed prematurely. - vectorized::VExprContextSPtrs _stale_expr_ctxs; - vectorized::VExprContextSPtrs _common_expr_ctxs_push_down; + VExprContextSPtrs _stale_expr_ctxs; + VExprContextSPtrs _common_expr_ctxs_push_down; - std::shared_ptr _scanner_ctx = nullptr; + std::shared_ptr _scanner_ctx = nullptr; // Save all function predicates which may be pushed down to data source. std::vector _push_down_functions; // colname -> cast dst type - std::map _cast_types_for_variants; + std::map _cast_types_for_variants; // slot id -> ColumnValueRange // Parsed from conjuncts @@ -333,8 +332,8 @@ class ScanLocalState : public ScanLocalStateBase { std::vector> _filter_dependencies; // ScanLocalState owns the ownership of scanner, scanner context only has its weakptr - std::list> _scanners; - vectorized::Arena _arena; + std::list> _scanners; + Arena _arena; }; template @@ -342,8 +341,8 @@ class ScanOperatorX : public OperatorX { public: Status init(const TPlanNode& tnode, RuntimeState* state) override; Status prepare(RuntimeState* state) override; - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override; - Status get_block_after_projects(RuntimeState* state, vectorized::Block* block, + Status get_block(RuntimeState* state, Block* block, bool* eos) override; + Status get_block_after_projects(RuntimeState* state, Block* block, bool* eos) override { Status status = get_block(state, block, eos); if (status.ok()) { @@ -393,7 +392,7 @@ class ScanOperatorX : public OperatorX { protected: using LocalState = LocalStateType; - friend class vectorized::OlapScanner; + friend class OlapScanner; ScanOperatorX(ObjectPool* pool, const TPlanNode& tnode, int operator_id, const DescriptorTbl& descs, int parallel_tasks = 0); virtual ~ScanOperatorX() = default; @@ -419,7 +418,7 @@ class ScanOperatorX : public OperatorX { // single scanner to avoid too many scanners which will cause lots of useless read. bool _should_run_serial = false; - vectorized::VExprContextSPtrs _common_expr_ctxs_push_down; + VExprContextSPtrs _common_expr_ctxs_push_down; // If sort info is set, push limit to each scanner; int64_t _limit_per_scanner = -1; @@ -438,4 +437,4 @@ class ScanOperatorX : public OperatorX { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/schema_scan_operator.cpp b/be/src/exec/operator/schema_scan_operator.cpp similarity index 90% rename from be/src/pipeline/exec/schema_scan_operator.cpp rename to be/src/exec/operator/schema_scan_operator.cpp index 79987c001de112..be60af084df586 100644 --- a/be/src/pipeline/exec/schema_scan_operator.cpp +++ b/be/src/exec/operator/schema_scan_operator.cpp @@ -15,22 +15,22 @@ // specific language governing permissions and limitations // under the License. -#include "schema_scan_operator.h" +#include "exec/operator/schema_scan_operator.h" #include #include -#include "pipeline/exec/operator.h" -#include "util/runtime_profile.h" -#include "vec/data_types/data_type_factory.hpp" +#include "core/data_type/data_type_factory.hpp" +#include "exec/operator/operator.h" +#include "runtime/runtime_profile.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; } // namespace doris -namespace doris::pipeline { +namespace doris { Status SchemaScanLocalState::init(RuntimeState* state, LocalStateInfo& info) { RETURN_IF_ERROR(PipelineXLocalState<>::init(state, info)); @@ -202,7 +202,7 @@ Status SchemaScanOperatorX::prepare(RuntimeState* state) { return Status::OK(); } -Status SchemaScanOperatorX::get_block(RuntimeState* state, vectorized::Block* block, bool* eos) { +Status SchemaScanOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); RETURN_IF_CANCELLED(state); @@ -215,18 +215,18 @@ Status SchemaScanOperatorX::get_block(RuntimeState* state, vectorized::Block* bl block->clear(); for (int i = 0; i < _slot_num; ++i) { auto* dest_slot_desc = _dest_tuple_desc->slots()[i]; - block->insert(vectorized::ColumnWithTypeAndName( - dest_slot_desc->get_empty_mutable_column(), dest_slot_desc->get_data_type_ptr(), - dest_slot_desc->col_name())); + block->insert(ColumnWithTypeAndName(dest_slot_desc->get_empty_mutable_column(), + dest_slot_desc->get_data_type_ptr(), + dest_slot_desc->col_name())); } // src block columns desc is filled by schema_scanner->get_column_desc. - vectorized::Block src_block; + Block src_block; for (int i = 0; i < columns_desc.size(); ++i) { - auto data_type = vectorized::DataTypeFactory::instance().create_data_type( - columns_desc[i].type, true); - src_block.insert(vectorized::ColumnWithTypeAndName(data_type->create_column(), - data_type, columns_desc[i].name)); + auto data_type = + DataTypeFactory::instance().create_data_type(columns_desc[i].type, true); + src_block.insert(ColumnWithTypeAndName(data_type->create_column(), data_type, + columns_desc[i].name)); } while (true) { RETURN_IF_CANCELLED(state); @@ -251,8 +251,7 @@ Status SchemaScanOperatorX::get_block(RuntimeState* state, vectorized::Block* bl if (src_block.rows()) { // block->check_number_of_rows(); for (int i = 0; i < _slot_num; ++i) { - vectorized::MutableColumnPtr column_ptr = - std::move(*block->get_by_position(i).column).mutate(); + MutableColumnPtr column_ptr = std::move(*block->get_by_position(i).column).mutate(); column_ptr->insert_range_from( *src_block.safe_get_by_position(_slot_offsets[i]).column, 0, src_block.rows()); @@ -268,4 +267,4 @@ Status SchemaScanOperatorX::get_block(RuntimeState* state, vectorized::Block* bl } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/schema_scan_operator.h b/be/src/exec/operator/schema_scan_operator.h similarity index 93% rename from be/src/pipeline/exec/schema_scan_operator.h rename to be/src/exec/operator/schema_scan_operator.h index 0634b9d569330a..c158ff0b087890 100644 --- a/be/src/pipeline/exec/schema_scan_operator.h +++ b/be/src/exec/operator/schema_scan_operator.h @@ -22,15 +22,15 @@ #include #include "common/status.h" -#include "exec/schema_scanner.h" -#include "operator.h" +#include "exec/operator/operator.h" +#include "information_schema/schema_scanner.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; } // namespace doris -namespace doris::pipeline { +namespace doris { class SchemaScanOperatorX; class SchemaScanLocalState final : public PipelineXLocalState<> { @@ -68,7 +68,7 @@ class SchemaScanOperatorX final : public OperatorX { Status init(const TPlanNode& tnode, RuntimeState* state) override; Status prepare(RuntimeState* state) override; - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override; + Status get_block(RuntimeState* state, Block* block, bool* eos) override; [[nodiscard]] bool is_source() const override { return true; } @@ -93,4 +93,4 @@ class SchemaScanOperatorX final : public OperatorX { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/exec/select_operator.h b/be/src/exec/operator/select_operator.h similarity index 92% rename from be/src/pipeline/exec/select_operator.h rename to be/src/exec/operator/select_operator.h index f033c7c0de81a8..16d719ad023e69 100644 --- a/be/src/pipeline/exec/select_operator.h +++ b/be/src/exec/operator/select_operator.h @@ -19,9 +19,9 @@ #include -#include "operator.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class SelectOperatorX; @@ -43,7 +43,7 @@ class SelectOperatorX final : public StreamingOperatorX { const DescriptorTbl& descs) : StreamingOperatorX(pool, tnode, operator_id, descs) {} - Status pull(RuntimeState* state, vectorized::Block* block, bool* eos) override { + Status pull(RuntimeState* state, Block* block, bool* eos) override { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); RETURN_IF_CANCELLED(state); @@ -56,4 +56,4 @@ class SelectOperatorX final : public StreamingOperatorX { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/set_probe_sink_operator.cpp b/be/src/exec/operator/set_probe_sink_operator.cpp similarity index 91% rename from be/src/pipeline/exec/set_probe_sink_operator.cpp rename to be/src/exec/operator/set_probe_sink_operator.cpp index 63136c972662b4..26913e97641e1a 100644 --- a/be/src/pipeline/exec/set_probe_sink_operator.cpp +++ b/be/src/exec/operator/set_probe_sink_operator.cpp @@ -15,26 +15,24 @@ // specific language governing permissions and limitations // under the License. -#include "set_probe_sink_operator.h" +#include "exec/operator/set_probe_sink_operator.h" #include #include -#include "pipeline/exec/operator.h" -#include "pipeline/pipeline_task.h" -#include "vec/common/hash_table/hash_table_set_probe.h" +#include "exec/common/hash_table/hash_table_set_probe.h" +#include "exec/operator/operator.h" +#include "exec/pipeline/pipeline_task.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace vectorized { class Block; -} // namespace vectorized } // namespace doris -namespace doris::pipeline { +namespace doris { template Status SetProbeSinkOperatorX::init(const TPlanNode& tnode, RuntimeState* state) { @@ -51,7 +49,7 @@ Status SetProbeSinkOperatorX::init(const TPlanNode& tnode, Runtime } const auto& texpr = (*result_texpr_lists)[_cur_child_id]; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(texpr, _child_exprs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(texpr, _child_exprs)); return Status::OK(); } @@ -59,13 +57,12 @@ Status SetProbeSinkOperatorX::init(const TPlanNode& tnode, Runtime template Status SetProbeSinkOperatorX::prepare(RuntimeState* state) { RETURN_IF_ERROR(DataSinkOperatorX>::prepare(state)); - RETURN_IF_ERROR(vectorized::VExpr::prepare(_child_exprs, state, _child->row_desc())); - return vectorized::VExpr::open(_child_exprs, state); + RETURN_IF_ERROR(VExpr::prepare(_child_exprs, state, _child->row_desc())); + return VExpr::open(_child_exprs, state); } template -Status SetProbeSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block, - bool eos) { +Status SetProbeSinkOperatorX::sink(RuntimeState* state, Block* in_block, bool eos) { RETURN_IF_CANCELLED(state); auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); @@ -84,8 +81,8 @@ Status SetProbeSinkOperatorX::sink(RuntimeState* state, vectorized using HashTableCtxType = std::decay_t; if constexpr (!std::is_same_v) { SCOPED_TIMER(local_state._probe_timer); - vectorized::HashTableProbe - process_hashtable_ctx(&local_state, probe_rows); + HashTableProbe process_hashtable_ctx( + &local_state, probe_rows); return process_hashtable_ctx.mark_data_in_hashtable(arg); } else { LOG(WARNING) << "Uninited hash table in Set Probe Sink Operator"; @@ -140,8 +137,8 @@ Status SetProbeSinkLocalState::open(RuntimeState* state) { template Status SetProbeSinkOperatorX::_extract_probe_column( - SetProbeSinkLocalState& local_state, vectorized::Block& block, - vectorized::ColumnRawPtrs& raw_ptrs, int child_id) { + SetProbeSinkLocalState& local_state, Block& block, ColumnRawPtrs& raw_ptrs, + int child_id) { auto& build_not_ignore_null = local_state._shared_state->build_not_ignore_null; auto& child_exprs = local_state._child_exprs; @@ -153,7 +150,7 @@ Status SetProbeSinkOperatorX::_extract_probe_column( block.get_by_position(result_col_id).column->convert_to_full_column_if_const(); const auto* column = block.get_by_position(result_col_id).column.get(); - if (const auto* nullable = check_and_get_column(*column)) { + if (const auto* nullable = check_and_get_column(*column)) { if (!build_not_ignore_null[i]) { return Status::InternalError( "SET operator expects a nullable : {} column in column {}, but the " @@ -274,4 +271,4 @@ template class SetProbeSinkOperatorX; template class SetProbeSinkOperatorX; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/set_probe_sink_operator.h b/be/src/exec/operator/set_probe_sink_operator.h similarity index 90% rename from be/src/pipeline/exec/set_probe_sink_operator.h rename to be/src/exec/operator/set_probe_sink_operator.h index 896088fce0df27..bab8fbe536f628 100644 --- a/be/src/pipeline/exec/set_probe_sink_operator.h +++ b/be/src/exec/operator/set_probe_sink_operator.h @@ -20,19 +20,15 @@ #include #include "common/status.h" -#include "operator.h" +#include "exec/operator/operator.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace vectorized { class Block; template struct HashTableProbe; -} // namespace vectorized - -namespace pipeline { template class SetProbeSinkOperatorX; @@ -54,15 +50,15 @@ class SetProbeSinkLocalState final : public PipelineXSinkLocalState; template - friend struct vectorized::HashTableProbe; + friend struct HashTableProbe; int64_t _estimate_memory_usage = 0; //record insert column id during probe std::vector _probe_column_inserted_id; - vectorized::ColumnRawPtrs _probe_columns; + ColumnRawPtrs _probe_columns; // every child has its result expr list - vectorized::VExprContextSPtrs _child_exprs; + VExprContextSPtrs _child_exprs; RuntimeProfile::Counter* _extract_probe_data_timer = nullptr; RuntimeProfile::Counter* _probe_timer = nullptr; @@ -103,7 +99,7 @@ class SetProbeSinkOperatorX final : public DataSinkOperatorX& local_state); - Status _extract_probe_column(SetProbeSinkLocalState& local_state, - vectorized::Block& block, vectorized::ColumnRawPtrs& raw_ptrs, - int child_id); + Status _extract_probe_column(SetProbeSinkLocalState& local_state, Block& block, + ColumnRawPtrs& raw_ptrs, int child_id); void _refresh_hash_table(SetProbeSinkLocalState& local_state); const int _cur_child_id; // every child has its result expr list - vectorized::VExprContextSPtrs _child_exprs; + VExprContextSPtrs _child_exprs; const bool _is_colocate; std::vector _partition_exprs; using OperatorBase::_child; }; -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/pipeline/exec/set_sink_operator.cpp b/be/src/exec/operator/set_sink_operator.cpp similarity index 89% rename from be/src/pipeline/exec/set_sink_operator.cpp rename to be/src/exec/operator/set_sink_operator.cpp index ae2024f831de96..c26265f652d8d2 100644 --- a/be/src/pipeline/exec/set_sink_operator.cpp +++ b/be/src/exec/operator/set_sink_operator.cpp @@ -15,15 +15,15 @@ // specific language governing permissions and limitations // under the License. -#include "set_sink_operator.h" +#include "exec/operator/set_sink_operator.h" #include -#include "pipeline/exec/operator.h" -#include "vec/common/hash_table/hash_table_set_build.h" -#include "vec/core/materialize_block.h" +#include "core/block/materialize_block.h" +#include "exec/common/hash_table/hash_table_set_build.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" template @@ -62,8 +62,7 @@ Status SetSinkLocalState::close(RuntimeState* state, Status exec_s } template -Status SetSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block, - bool eos) { +Status SetSinkOperatorX::sink(RuntimeState* state, Block* in_block, bool eos) { constexpr static auto BUILD_BLOCK_MAX_SIZE = 4 * 1024UL * 1024UL * 1024UL; RETURN_IF_CANCELLED(state); auto& local_state = get_local_state(state); @@ -111,23 +110,22 @@ Status SetSinkOperatorX::sink(RuntimeState* state, vectorized::Blo template Status SetSinkOperatorX::_process_build_block( - SetSinkLocalState& local_state, vectorized::Block& block, - RuntimeState* state) { + SetSinkLocalState& local_state, Block& block, RuntimeState* state) { size_t rows = block.rows(); if (rows == 0) { return Status::OK(); } - vectorized::materialize_block_inplace(block); - vectorized::ColumnRawPtrs raw_ptrs(_child_exprs.size()); + materialize_block_inplace(block); + ColumnRawPtrs raw_ptrs(_child_exprs.size()); RETURN_IF_ERROR(_extract_build_column(local_state, block, raw_ptrs, rows)); auto st = Status::OK(); std::visit( [&](auto&& arg) { using HashTableCtxType = std::decay_t; if constexpr (!std::is_same_v) { - vectorized::HashTableBuild - hash_table_build_process(&local_state, uint32_t(rows), raw_ptrs, state); + HashTableBuild hash_table_build_process( + &local_state, uint32_t(rows), raw_ptrs, state); st = hash_table_build_process(arg, local_state._shared_state->arena); } else { LOG(FATAL) << "FATAL: uninited hash table"; @@ -141,8 +139,8 @@ Status SetSinkOperatorX::_process_build_block( template Status SetSinkOperatorX::_extract_build_column( - SetSinkLocalState& local_state, vectorized::Block& block, - vectorized::ColumnRawPtrs& raw_ptrs, size_t& rows) { + SetSinkLocalState& local_state, Block& block, ColumnRawPtrs& raw_ptrs, + size_t& rows) { // use local state child exprs auto& child_expr = local_state._child_exprs; std::vector result_locs(child_expr.size(), -1); @@ -159,8 +157,7 @@ Status SetSinkOperatorX::_extract_build_column( if (is_all_const) { block.get_by_position(result_col_id).column = - assert_cast( - *block.get_by_position(result_col_id).column) + assert_cast(*block.get_by_position(result_col_id).column) .get_data_column_ptr(); } else { block.get_by_position(result_col_id).column = @@ -243,7 +240,7 @@ Status SetSinkOperatorX::init(const TPlanNode& tnode, RuntimeState } const auto& texpr = (*result_texpr_lists)[_cur_child_id]; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(texpr, _child_exprs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(texpr, _child_exprs)); return Status::OK(); } @@ -272,8 +269,8 @@ size_t SetSinkOperatorX::get_reserve_mem_size(RuntimeState* state, template Status SetSinkOperatorX::prepare(RuntimeState* state) { RETURN_IF_ERROR(Base::prepare(state)); - RETURN_IF_ERROR(vectorized::VExpr::prepare(_child_exprs, state, _child->row_desc())); - return vectorized::VExpr::open(_child_exprs, state); + RETURN_IF_ERROR(VExpr::prepare(_child_exprs, state, _child->row_desc())); + return VExpr::open(_child_exprs, state); } template class SetSinkLocalState; @@ -281,4 +278,4 @@ template class SetSinkLocalState; template class SetSinkOperatorX; template class SetSinkOperatorX; -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/set_sink_operator.h b/be/src/exec/operator/set_sink_operator.h similarity index 89% rename from be/src/pipeline/exec/set_sink_operator.h rename to be/src/exec/operator/set_sink_operator.h index 11c243ef24db80..5d518113d4b573 100644 --- a/be/src/pipeline/exec/set_sink_operator.h +++ b/be/src/exec/operator/set_sink_operator.h @@ -17,18 +17,14 @@ #pragma once -#include "operator.h" -#include "runtime_filter/runtime_filter_producer_helper_set.h" +#include "exec/operator/operator.h" +#include "exec/runtime_filter/runtime_filter_producer_helper_set.h" namespace doris { #include "common/compile_check_begin.h" -namespace vectorized { template struct HashTableBuild; -} - -namespace pipeline { template class SetSinkOperatorX; @@ -54,9 +50,9 @@ class SetSinkLocalState final : public PipelineXSinkLocalState { private: friend class SetSinkOperatorX; - vectorized::MutableBlock _mutable_block; + MutableBlock _mutable_block; // every child has its result expr list - vectorized::VExprContextSPtrs _child_exprs; + VExprContextSPtrs _child_exprs; RuntimeProfile::Counter* _merge_block_timer = nullptr; RuntimeProfile::Counter* _build_timer = nullptr; @@ -109,7 +105,7 @@ class SetSinkOperatorX final : public DataSinkOperatorX friend struct HashTableBuild; - Status _process_build_block(SetSinkLocalState& local_state, - vectorized::Block& block, RuntimeState* state); - Status _extract_build_column(SetSinkLocalState& local_state, - vectorized::Block& block, vectorized::ColumnRawPtrs& raw_ptrs, - size_t& rows); + Status _process_build_block(SetSinkLocalState& local_state, Block& block, + RuntimeState* state); + Status _extract_build_column(SetSinkLocalState& local_state, Block& block, + ColumnRawPtrs& raw_ptrs, size_t& rows); const int _cur_child_id = 0; const size_t _child_quantity; // every child has its result expr list - vectorized::VExprContextSPtrs _child_exprs; + VExprContextSPtrs _child_exprs; const bool _is_colocate; std::vector _partition_exprs; using OperatorBase::_child; @@ -146,5 +141,4 @@ class SetSinkOperatorX final : public DataSinkOperatorX #include #include "common/status.h" -#include "pipeline/exec/operator.h" -#include "util/runtime_profile.h" +#include "exec/operator/operator.h" +#include "runtime/runtime_profile.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" template Status SetSourceLocalState::init(RuntimeState* state, LocalStateInfo& info) { @@ -47,7 +47,7 @@ Status SetSourceLocalState::open(RuntimeState* state) { RETURN_IF_ERROR(Base::open(state)); auto& child_exprs_lists = _shared_state->child_exprs_lists; - auto output_data_types = vectorized::VectorizedUtils::get_data_types( + auto output_data_types = VectorizedUtils::get_data_types( _parent->cast>().row_descriptor()); auto column_nums = child_exprs_lists[0].size(); DCHECK_EQ(output_data_types.size(), column_nums) @@ -75,8 +75,7 @@ Status SetSourceLocalState::open(RuntimeState* state) { } template -Status SetSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* block, - bool* eos) { +Status SetSourceOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { RETURN_IF_CANCELLED(state); auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); @@ -100,8 +99,8 @@ Status SetSourceOperatorX::get_block(RuntimeState* state, vectoriz } { SCOPED_TIMER(local_state._filter_timer); - RETURN_IF_ERROR(vectorized::VExprContext::filter_block(local_state._conjuncts, block, - block->columns())); + RETURN_IF_ERROR( + VExprContext::filter_block(local_state._conjuncts, block, block->columns())); } local_state.reached_limit(block, eos); return Status::OK(); @@ -109,7 +108,7 @@ Status SetSourceOperatorX::get_block(RuntimeState* state, vectoriz template void SetSourceOperatorX::_create_mutable_cols( - SetSourceLocalState& local_state, vectorized::Block* output_block) { + SetSourceLocalState& local_state, Block* output_block) { local_state._mutable_cols.resize(local_state._left_table_data_types.size()); bool mem_reuse = output_block->mem_reuse(); @@ -127,7 +126,7 @@ template template Status SetSourceOperatorX::_get_data_in_hashtable( SetSourceLocalState& local_state, HashTableContext& hash_table_ctx, - vectorized::Block* output_block, const int batch_size, bool* eos) { + Block* output_block, const int batch_size, bool* eos) { size_t left_col_len = local_state._left_table_data_types.size(); hash_table_ctx.init_iterator(); local_state._result_indexs.clear(); @@ -159,9 +158,8 @@ Status SetSourceOperatorX::_get_data_in_hashtable( if (!output_block->mem_reuse()) { for (int i = 0; i < left_col_len; ++i) { - output_block->insert( - vectorized::ColumnWithTypeAndName(std::move(local_state._mutable_cols[i]), - local_state._left_table_data_types[i], "")); + output_block->insert(ColumnWithTypeAndName(std::move(local_state._mutable_cols[i]), + local_state._left_table_data_types[i], "")); } } else { local_state._mutable_cols.clear(); @@ -185,4 +183,4 @@ template class SetSourceLocalState; template class SetSourceOperatorX; template class SetSourceOperatorX; -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/set_source_operator.h b/be/src/exec/operator/set_source_operator.h similarity index 90% rename from be/src/pipeline/exec/set_source_operator.h rename to be/src/exec/operator/set_source_operator.h index db56da26a2489f..31e5fc77542458 100644 --- a/be/src/pipeline/exec/set_source_operator.h +++ b/be/src/exec/operator/set_source_operator.h @@ -20,12 +20,11 @@ #include #include "common/status.h" -#include "operator.h" +#include "exec/operator/operator.h" namespace doris { class RuntimeState; -namespace pipeline { #include "common/compile_check_begin.h" template class SetSourceOperatorX; @@ -44,14 +43,14 @@ class SetSourceLocalState final : public PipelineXLocalState { void _add_result_columns(); friend class SetSourceOperatorX; friend class OperatorX>; - std::vector _mutable_cols; + std::vector _mutable_cols; //record build column type - vectorized::DataTypes _left_table_data_types; + DataTypes _left_table_data_types; RuntimeProfile::Counter* _get_data_timer = nullptr; RuntimeProfile::Counter* _filter_timer = nullptr; RuntimeProfile::Counter* _get_data_from_hashtable_rows = nullptr; - vectorized::IColumn::Selector _result_indexs; + IColumn::Selector _result_indexs; }; template @@ -86,7 +85,7 @@ class SetSourceOperatorX MOCK_REMOVE(final) : public OperatorX; - void _create_mutable_cols(SetSourceLocalState& local_state, - vectorized::Block* output_block); + void _create_mutable_cols(SetSourceLocalState& local_state, Block* output_block); template Status _get_data_in_hashtable(SetSourceLocalState& local_state, - HashTableContext& hash_table_ctx, vectorized::Block* output_block, + HashTableContext& hash_table_ctx, Block* output_block, const int batch_size, bool* eos); const size_t _child_quantity; const bool _is_colocate; }; #include "common/compile_check_end.h" -} // namespace pipeline } // namespace doris diff --git a/be/src/pipeline/exec/sort_sink_operator.cpp b/be/src/exec/operator/sort_sink_operator.cpp similarity index 91% rename from be/src/pipeline/exec/sort_sink_operator.cpp rename to be/src/exec/operator/sort_sink_operator.cpp index 5e1f656fd99c60..f54c9ce50d8619 100644 --- a/be/src/pipeline/exec/sort_sink_operator.cpp +++ b/be/src/exec/operator/sort_sink_operator.cpp @@ -15,16 +15,16 @@ // specific language governing permissions and limitations // under the License. -#include "sort_sink_operator.h" +#include "exec/operator/sort_sink_operator.h" #include -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" +#include "exec/sort/heap_sorter.h" +#include "exec/sort/topn_sorter.h" #include "runtime/query_context.h" -#include "vec/common/sort/heap_sorter.h" -#include "vec/common/sort/topn_sorter.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" Status SortSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& info) { @@ -47,19 +47,19 @@ Status SortSinkLocalState::open(RuntimeState* state) { RETURN_IF_ERROR(p._vsort_exec_exprs.clone(state, _vsort_exec_exprs)); switch (p._algorithm) { case TSortAlgorithm::HEAP_SORT: { - _shared_state->sorter = vectorized::HeapSorter::create_shared( + _shared_state->sorter = HeapSorter::create_shared( _vsort_exec_exprs, p._limit, p._offset, p._pool, p._is_asc_order, p._nulls_first, p._child->row_desc()); break; } case TSortAlgorithm::TOPN_SORT: { - _shared_state->sorter = vectorized::TopNSorter::create_shared( + _shared_state->sorter = TopNSorter::create_shared( _vsort_exec_exprs, p._limit, p._offset, p._pool, p._is_asc_order, p._nulls_first, p._child->row_desc(), state, custom_profile()); break; } case TSortAlgorithm::FULL_SORT: { - auto sorter = vectorized::FullSorter::create_shared( + auto sorter = FullSorter::create_shared( _vsort_exec_exprs, p._limit, p._offset, p._pool, p._is_asc_order, p._nulls_first, p._child->row_desc(), state, custom_profile()); if (p._max_buffered_bytes > 0) { @@ -125,7 +125,7 @@ Status SortSinkOperatorX::prepare(RuntimeState* state) { return _vsort_exec_exprs.open(state); } -Status SortSinkOperatorX::sink(doris::RuntimeState* state, vectorized::Block* in_block, bool eos) { +Status SortSinkOperatorX::sink(doris::RuntimeState* state, Block* in_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)in_block->rows()); @@ -144,7 +144,7 @@ Status SortSinkOperatorX::sink(doris::RuntimeState* state, vectorized::Block* in SCOPED_TIMER(local_state._update_runtime_predicate_timer); auto& predicate = state->get_query_ctx()->get_runtime_predicate(_node_id); if (predicate.enable()) { - vectorized::Field new_top = local_state._shared_state->sorter->get_top_value(); + Field new_top = local_state._shared_state->sorter->get_top_value(); if (!new_top.is_null() && new_top != local_state.old_top) { auto* query_ctx = state->get_query_ctx(); RETURN_IF_ERROR(query_ctx->get_runtime_predicate(_node_id).update(new_top)); @@ -180,7 +180,7 @@ Status SortSinkOperatorX::prepare_for_spill(RuntimeState* state) { } Status SortSinkOperatorX::merge_sort_read_for_spill(RuntimeState* state, - doris::vectorized::Block* block, int batch_size, + doris::Block* block, int batch_size, bool* eos) { auto& local_state = get_local_state(state); return local_state._shared_state->sorter->merge_sort_read_for_spill(state, block, batch_size, @@ -191,4 +191,4 @@ void SortSinkOperatorX::reset(RuntimeState* state) { local_state._shared_state->sorter->reset(); } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/sort_sink_operator.h b/be/src/exec/operator/sort_sink_operator.h similarity index 92% rename from be/src/pipeline/exec/sort_sink_operator.h rename to be/src/exec/operator/sort_sink_operator.h index 77c29ef2b4e563..b0929e8a4c7123 100644 --- a/be/src/pipeline/exec/sort_sink_operator.h +++ b/be/src/exec/operator/sort_sink_operator.h @@ -19,10 +19,10 @@ #include -#include "operator.h" -#include "vec/core/field.h" +#include "core/field.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class SortSinkOperatorX; @@ -43,12 +43,12 @@ class SortSinkLocalState : public PipelineXSinkLocalState { friend class SortSinkOperatorX; // Expressions and parameters used for build _sort_description - vectorized::VSortExecExprs _vsort_exec_exprs; + VSortExecExprs _vsort_exec_exprs; RuntimeProfile::Counter* _sort_blocks_memory_usage = nullptr; // topn top value - vectorized::Field old_top {PrimitiveType::TYPE_NULL}; + Field old_top {PrimitiveType::TYPE_NULL}; RuntimeProfile::Counter* _append_blocks_timer = nullptr; RuntimeProfile::Counter* _update_runtime_predicate_timer = nullptr; }; @@ -76,7 +76,7 @@ class SortSinkOperatorX final : public DataSinkOperatorX { Status init(const TPlanNode& tnode, RuntimeState* state) override; Status prepare(RuntimeState* state) override; - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos) override; + Status sink(RuntimeState* state, Block* in_block, bool eos) override; DataDistribution required_data_distribution(RuntimeState* /*state*/) const override { if (_is_analytic_sort) { return _is_colocate && _require_bucket_distribution @@ -98,7 +98,7 @@ class SortSinkOperatorX final : public DataSinkOperatorX { Status prepare_for_spill(RuntimeState* state); - Status merge_sort_read_for_spill(RuntimeState* state, doris::vectorized::Block* block, + Status merge_sort_read_for_spill(RuntimeState* state, doris::Block* block, int batch_size, bool* eos); void reset(RuntimeState* state); @@ -113,7 +113,7 @@ class SortSinkOperatorX final : public DataSinkOperatorX { ObjectPool* _pool = nullptr; // Expressions and parameters used for build _sort_description - vectorized::VSortExecExprs _vsort_exec_exprs; + VSortExecExprs _vsort_exec_exprs; std::vector _is_asc_order; std::vector _nulls_first; @@ -130,4 +130,4 @@ class SortSinkOperatorX final : public DataSinkOperatorX { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/sort_source_operator.cpp b/be/src/exec/operator/sort_source_operator.cpp similarity index 83% rename from be/src/pipeline/exec/sort_source_operator.cpp rename to be/src/exec/operator/sort_source_operator.cpp index 597448c7bfb8db..18fe81dc4c8b6b 100644 --- a/be/src/pipeline/exec/sort_source_operator.cpp +++ b/be/src/exec/operator/sort_source_operator.cpp @@ -15,13 +15,13 @@ // specific language governing permissions and limitations // under the License. -#include "sort_source_operator.h" +#include "exec/operator/sort_source_operator.h" #include -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" SortLocalState::SortLocalState(RuntimeState* state, OperatorXBase* parent) @@ -31,7 +31,7 @@ SortSourceOperatorX::SortSourceOperatorX(ObjectPool* pool, const TPlanNode& tnod const DescriptorTbl& descs) : OperatorX(pool, tnode, operator_id, descs) {} -Status SortSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* block, bool* eos) { +Status SortSourceOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); SCOPED_PEAK_MEM(&local_state._estimate_memory_usage); @@ -41,11 +41,10 @@ Status SortSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* bl return Status::OK(); } -const vectorized::SortDescription& SortSourceOperatorX::get_sort_description( - RuntimeState* state) const { +const SortDescription& SortSourceOperatorX::get_sort_description(RuntimeState* state) const { auto& local_state = get_local_state(state); return local_state._shared_state->sorter->get_sort_description(); } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/sort_source_operator.h b/be/src/exec/operator/sort_source_operator.h similarity index 86% rename from be/src/pipeline/exec/sort_source_operator.h rename to be/src/exec/operator/sort_source_operator.h index b2a4a98c9a4ea4..c2a63b82ccd607 100644 --- a/be/src/pipeline/exec/sort_source_operator.h +++ b/be/src/exec/operator/sort_source_operator.h @@ -20,13 +20,11 @@ #include #include "common/status.h" -#include "operator.h" +#include "exec/operator/operator.h" namespace doris { class RuntimeState; -namespace pipeline { - class SortSourceOperatorX; class SortLocalState final : public PipelineXLocalState { public: @@ -45,15 +43,14 @@ class SortSourceOperatorX MOCK_REMOVE(final) : public OperatorX #ifdef BE_TEST SortSourceOperatorX() = default; #endif - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override; + Status get_block(RuntimeState* state, Block* block, bool* eos) override; bool is_source() const override { return true; } - const vectorized::SortDescription& get_sort_description(RuntimeState* state) const; + const SortDescription& get_sort_description(RuntimeState* state) const; private: friend class SortLocalState; }; -} // namespace pipeline } // namespace doris diff --git a/be/src/pipeline/exec/spill_iceberg_table_sink_operator.cpp b/be/src/exec/operator/spill_iceberg_table_sink_operator.cpp similarity index 88% rename from be/src/pipeline/exec/spill_iceberg_table_sink_operator.cpp rename to be/src/exec/operator/spill_iceberg_table_sink_operator.cpp index 46240c20ffe5fb..0a5126d2bef740 100644 --- a/be/src/pipeline/exec/spill_iceberg_table_sink_operator.cpp +++ b/be/src/exec/operator/spill_iceberg_table_sink_operator.cpp @@ -15,15 +15,15 @@ // specific language governing permissions and limitations // under the License. -#include "spill_iceberg_table_sink_operator.h" +#include "exec/operator/spill_iceberg_table_sink_operator.h" #include "common/status.h" -#include "pipeline/exec/iceberg_table_sink_operator.h" -#include "pipeline/exec/spill_utils.h" -#include "vec/sink/writer/iceberg/viceberg_sort_writer.h" -#include "vec/sink/writer/iceberg/viceberg_table_writer.h" +#include "exec/operator/iceberg_table_sink_operator.h" +#include "exec/operator/spill_utils.h" +#include "exec/sink/writer/iceberg/viceberg_sort_writer.h" +#include "exec/sink/writer/iceberg/viceberg_table_writer.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" SpillIcebergTableSinkLocalState::SpillIcebergTableSinkLocalState(DataSinkOperatorXBase* parent, @@ -58,8 +58,7 @@ size_t SpillIcebergTableSinkLocalState::get_reserve_mem_size(RuntimeState* state return 0; } - auto* sort_writer = - dynamic_cast(_writer->current_writer().get()); + auto* sort_writer = dynamic_cast(_writer->current_writer().get()); if (!sort_writer || !sort_writer->sorter()) { return 0; } @@ -72,8 +71,7 @@ size_t SpillIcebergTableSinkLocalState::get_revocable_mem_size(RuntimeState* sta return 0; } - auto* sort_writer = - dynamic_cast(_writer->current_writer().get()); + auto* sort_writer = dynamic_cast(_writer->current_writer().get()); if (!sort_writer || !sort_writer->sorter()) { return 0; } @@ -90,8 +88,7 @@ Status SpillIcebergTableSinkLocalState::revoke_memory( return Status::OK(); } - auto* sort_writer = - dynamic_cast(_writer->current_writer().get()); + auto* sort_writer = dynamic_cast(_writer->current_writer().get()); if (!sort_writer || !sort_writer->sorter()) { if (spill_context) { @@ -126,18 +123,17 @@ SpillIcebergTableSinkOperatorX::SpillIcebergTableSinkOperatorX( Status SpillIcebergTableSinkOperatorX::init(const TDataSink& thrift_sink) { RETURN_IF_ERROR(Base::init(thrift_sink)); _name = "SPILL_ICEBERG_TABLE_SINK_OPERATOR"; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(_t_output_expr, _output_vexpr_ctxs)); + RETURN_IF_ERROR(VExpr::create_expr_trees(_t_output_expr, _output_vexpr_ctxs)); return Status::OK(); } Status SpillIcebergTableSinkOperatorX::prepare(RuntimeState* state) { RETURN_IF_ERROR(Base::prepare(state)); - RETURN_IF_ERROR(vectorized::VExpr::prepare(_output_vexpr_ctxs, state, _row_desc)); - return vectorized::VExpr::open(_output_vexpr_ctxs, state); + RETURN_IF_ERROR(VExpr::prepare(_output_vexpr_ctxs, state, _row_desc)); + return VExpr::open(_output_vexpr_ctxs, state); } -Status SpillIcebergTableSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block, - bool eos) { +Status SpillIcebergTableSinkOperatorX::sink(RuntimeState* state, Block* in_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)in_block->rows()); @@ -193,4 +189,4 @@ void SpillIcebergTableSinkLocalState::_init_spill_counters() { } #include "common/compile_check_end.h" -} // namespace doris::pipeline \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/exec/spill_iceberg_table_sink_operator.h b/be/src/exec/operator/spill_iceberg_table_sink_operator.h similarity index 84% rename from be/src/pipeline/exec/spill_iceberg_table_sink_operator.h rename to be/src/exec/operator/spill_iceberg_table_sink_operator.h index fb0e50ee794671..a31a017f28fd1b 100644 --- a/be/src/pipeline/exec/spill_iceberg_table_sink_operator.h +++ b/be/src/exec/operator/spill_iceberg_table_sink_operator.h @@ -19,19 +19,19 @@ #include -#include "operator.h" -#include "vec/sink/writer/iceberg/viceberg_table_writer.h" +#include "exec/operator/operator.h" +#include "exec/sink/writer/iceberg/viceberg_table_writer.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class SpillIcebergTableSinkLocalState; class SpillIcebergTableSinkOperatorX; class SpillIcebergTableSinkLocalState final - : public AsyncWriterSink { + : public AsyncWriterSink { public: - using Base = AsyncWriterSink; + using Base = AsyncWriterSink; using Parent = SpillIcebergTableSinkOperatorX; ENABLE_FACTORY_CREATOR(SpillIcebergTableSinkLocalState); @@ -64,7 +64,7 @@ class SpillIcebergTableSinkOperatorX final Status prepare(RuntimeState* state) override; - Status sink(RuntimeState* state, vectorized::Block* in_block, bool eos) override; + Status sink(RuntimeState* state, Block* in_block, bool eos) override; size_t get_reserve_mem_size(RuntimeState* state, bool eos) override; @@ -80,14 +80,14 @@ class SpillIcebergTableSinkOperatorX final private: friend class SpillIcebergTableSinkLocalState; template - requires(std::is_base_of_v) + requires(std::is_base_of_v) friend class AsyncWriterSink; const RowDescriptor& _row_desc; - vectorized::VExprContextSPtrs _output_vexpr_ctxs; + VExprContextSPtrs _output_vexpr_ctxs; const std::vector& _t_output_expr; ObjectPool* _pool = nullptr; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/exec/spill_sort_sink_operator.cpp b/be/src/exec/operator/spill_sort_sink_operator.cpp similarity index 96% rename from be/src/pipeline/exec/spill_sort_sink_operator.cpp rename to be/src/exec/operator/spill_sort_sink_operator.cpp index 51b5ddc0e6d34d..396e069a408a04 100644 --- a/be/src/pipeline/exec/spill_sort_sink_operator.cpp +++ b/be/src/exec/operator/spill_sort_sink_operator.cpp @@ -15,22 +15,21 @@ // specific language governing permissions and limitations // under the License. -#include "spill_sort_sink_operator.h" +#include "exec/operator/spill_sort_sink_operator.h" #include "common/status.h" -#include "pipeline/exec/sort_sink_operator.h" -#include "pipeline/exec/spill_utils.h" -#include "pipeline/pipeline_task.h" +#include "exec/operator/sort_sink_operator.h" +#include "exec/operator/spill_utils.h" +#include "exec/pipeline/pipeline_task.h" +#include "exec/spill/spill_stream_manager.h" #include "runtime/fragment_mgr.h" -#include "vec/spill/spill_stream_manager.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" SpillSortSinkLocalState::SpillSortSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state) : Base(parent, state) {} -Status SpillSortSinkLocalState::init(doris::RuntimeState* state, - doris::pipeline::LocalSinkStateInfo& info) { +Status SpillSortSinkLocalState::init(doris::RuntimeState* state, doris::LocalSinkStateInfo& info) { RETURN_IF_ERROR(Base::init(state, info)); SCOPED_TIMER(exec_time_counter()); SCOPED_TIMER(_init_timer); @@ -139,8 +138,7 @@ size_t SpillSortSinkOperatorX::revocable_mem_size(RuntimeState* state) const { return _sort_sink_operator->get_revocable_mem_size(local_state._runtime_state.get()); } -Status SpillSortSinkOperatorX::sink(doris::RuntimeState* state, vectorized::Block* in_block, - bool eos) { +Status SpillSortSinkOperatorX::sink(doris::RuntimeState* state, Block* in_block, bool eos) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state.exec_time_counter()); COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)in_block->rows()); @@ -212,7 +210,7 @@ Status SpillSortSinkLocalState::_execute_spill_sort(RuntimeState* state, TUnique update_profile(sink_local_state->custom_profile()); bool eos = false; - vectorized::Block block; + Block block; int32_t batch_size = _shared_state->spill_block_batch_row_count > std::numeric_limits::max() @@ -287,4 +285,4 @@ Status SpillSortSinkLocalState::revoke_memory(RuntimeState* state, return SpillSinkRunnable(state, spill_context, operator_profile(), exception_catch_func).run(); } #include "common/compile_check_end.h" -} // namespace doris::pipeline \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/exec/spill_sort_sink_operator.h b/be/src/exec/operator/spill_sort_sink_operator.h similarity index 94% rename from be/src/pipeline/exec/spill_sort_sink_operator.h rename to be/src/exec/operator/spill_sort_sink_operator.h index a3ddb8a24e947b..5284d68113966a 100644 --- a/be/src/pipeline/exec/spill_sort_sink_operator.h +++ b/be/src/exec/operator/spill_sort_sink_operator.h @@ -19,10 +19,10 @@ #include -#include "operator.h" -#include "sort_sink_operator.h" +#include "exec/operator/operator.h" +#include "exec/operator/sort_sink_operator.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class SpillSortSinkLocalState; class SpillSortSinkOperatorX; @@ -59,7 +59,7 @@ class SpillSortSinkLocalState : public PipelineXSpillSinkLocalState _eos = false; }; @@ -77,7 +77,7 @@ class SpillSortSinkOperatorX final : public DataSinkOperatorXrequired_data_distribution(state); } @@ -114,4 +114,4 @@ class SpillSortSinkOperatorX final : public DataSinkOperatorX @@ -23,14 +23,14 @@ #include #include "common/status.h" -#include "pipeline/exec/spill_utils.h" -#include "pipeline/pipeline_task.h" +#include "exec/operator/sort_source_operator.h" +#include "exec/operator/spill_utils.h" +#include "exec/pipeline/pipeline_task.h" +#include "exec/spill/spill_stream_manager.h" #include "runtime/fragment_mgr.h" -#include "sort_source_operator.h" -#include "util/runtime_profile.h" -#include "vec/spill/spill_stream_manager.h" +#include "runtime/runtime_profile.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" SpillSortLocalState::SpillSortLocalState(RuntimeState* state, OperatorXBase* parent) : Base(state, parent) {} @@ -93,8 +93,8 @@ Status SpillSortLocalState::_execute_merge_sort_spill_streams(RuntimeState* stat print_id(query_id), _parent->node_id(), state->task_id()); } }}; - vectorized::Block merge_sorted_block; - vectorized::SpillStreamSPtr tmp_stream; + Block merge_sorted_block; + SpillStreamSPtr tmp_stream; while (!state->is_cancelled()) { int max_stream_count = _calc_spill_blocks_to_merge(state); VLOG_DEBUG << fmt::format( @@ -183,9 +183,9 @@ Status SpillSortLocalState::initiate_merge_sort_spill_streams(RuntimeState* stat return SpillRecoverRunnable(state, operator_profile(), exception_catch_func).run(); } -Status SpillSortLocalState::_create_intermediate_merger( - int num_blocks, const vectorized::SortDescription& sort_description) { - std::vector child_block_suppliers; +Status SpillSortLocalState::_create_intermediate_merger(int num_blocks, + const SortDescription& sort_description) { + std::vector child_block_suppliers; int64_t limit = -1; int64_t offset = 0; if (num_blocks >= _shared_state->sorted_streams.size()) { @@ -194,15 +194,15 @@ Status SpillSortLocalState::_create_intermediate_merger( offset = Base::_shared_state->offset; } - _merger = std::make_unique( - sort_description, _runtime_state->batch_size(), limit, offset, custom_profile()); + _merger = std::make_unique(sort_description, _runtime_state->batch_size(), + limit, offset, custom_profile()); _current_merging_streams.clear(); for (int i = 0; i < num_blocks && !_shared_state->sorted_streams.empty(); ++i) { auto stream = _shared_state->sorted_streams.front(); stream->set_read_counters(operator_profile()); _current_merging_streams.emplace_back(stream); - child_block_suppliers.emplace_back([stream](vectorized::Block* block, bool* eos) { + child_block_suppliers.emplace_back([stream](Block* block, bool* eos) { return stream->read_next_block_sync(block, eos); }); @@ -264,8 +264,7 @@ Status SpillSortSourceOperatorX::close(RuntimeState* state) { return _sort_source_operator->close(state); } -Status SpillSortSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* block, - bool* eos) { +Status SpillSortSourceOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { auto& local_state = get_local_state(state); local_state.copy_shared_spill_profile(); Status status; @@ -299,4 +298,4 @@ Status SpillSortSourceOperatorX::get_block(RuntimeState* state, vectorized::Bloc } #include "common/compile_check_end.h" -} // namespace doris::pipeline \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/exec/spill_sort_source_operator.h b/be/src/exec/operator/spill_sort_source_operator.h similarity index 87% rename from be/src/pipeline/exec/spill_sort_source_operator.h rename to be/src/exec/operator/spill_sort_source_operator.h index f191d3c419bc71..5027446b787075 100644 --- a/be/src/pipeline/exec/spill_sort_source_operator.h +++ b/be/src/exec/operator/spill_sort_source_operator.h @@ -20,14 +20,13 @@ #include #include "common/status.h" -#include "operator.h" +#include "exec/operator/operator.h" namespace doris { #include "common/compile_check_begin.h" class ExecNode; class RuntimeState; -namespace pipeline { class SpillSortSourceOperatorX; class SpillSortLocalState; @@ -51,8 +50,7 @@ class SpillSortLocalState final : public PipelineXSpillLocalState _current_merging_streams; - std::unique_ptr _merger; + std::vector _current_merging_streams; + std::unique_ptr _merger; std::unique_ptr _internal_runtime_profile; // counters for spill merge sort @@ -81,7 +79,7 @@ class SpillSortSourceOperatorX : public OperatorX { Status close(RuntimeState* state) override; - Status get_block(RuntimeState* state, vectorized::Block* block, bool* eos) override; + Status get_block(RuntimeState* state, Block* block, bool* eos) override; bool is_source() const override { return true; } @@ -90,6 +88,5 @@ class SpillSortSourceOperatorX : public OperatorX { std::unique_ptr _sort_source_operator; }; -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/exec/spill_utils.h b/be/src/exec/operator/spill_utils.h similarity index 97% rename from be/src/pipeline/exec/spill_utils.h rename to be/src/exec/operator/spill_utils.h index beb2ecaa984afa..44c4de17fd43d8 100644 --- a/be/src/pipeline/exec/spill_utils.h +++ b/be/src/exec/operator/spill_utils.h @@ -25,17 +25,17 @@ #include #include +#include "exec/partitioner/partitioner.h" #include "runtime/fragment_mgr.h" #include "runtime/memory/mem_tracker_limiter.h" #include "runtime/query_context.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" #include "runtime/thread_context.h" -#include "util/runtime_profile.h" -#include "vec/runtime/partitioner.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" -using SpillPartitionerType = vectorized::Crc32HashPartitioner; +using SpillPartitionerType = Crc32HashPartitioner; struct SpillContext { std::atomic_int running_tasks_count; @@ -240,4 +240,4 @@ inline void update_profile_from_inner_profile(const std::string& name, } #include "common/compile_check_end.h" -} // namespace doris::pipeline \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/exec/streaming_agg_min_reduction.h b/be/src/exec/operator/streaming_agg_min_reduction.h similarity index 100% rename from be/src/pipeline/exec/streaming_agg_min_reduction.h rename to be/src/exec/operator/streaming_agg_min_reduction.h diff --git a/be/src/pipeline/exec/streaming_aggregation_operator.cpp b/be/src/exec/operator/streaming_aggregation_operator.cpp similarity index 91% rename from be/src/pipeline/exec/streaming_aggregation_operator.cpp rename to be/src/exec/operator/streaming_aggregation_operator.cpp index 534de501fa83bf..0d792b03269b60 100644 --- a/be/src/pipeline/exec/streaming_aggregation_operator.cpp +++ b/be/src/exec/operator/streaming_aggregation_operator.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "streaming_aggregation_operator.h" +#include "exec/operator/streaming_aggregation_operator.h" #include @@ -24,24 +24,24 @@ #include "common/cast_set.h" #include "common/compiler_util.h" // IWYU pragma: keep -#include "pipeline/exec/operator.h" -#include "pipeline/exec/streaming_agg_min_reduction.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/exprs/vectorized_agg_fn.h" -#include "vec/exprs/vslot_ref.h" +#include "exec/operator/operator.h" +#include "exec/operator/streaming_agg_min_reduction.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/vectorized_agg_fn.h" +#include "exprs/vslot_ref.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; } // namespace doris -namespace doris::pipeline { +namespace doris { StreamingAggLocalState::StreamingAggLocalState(RuntimeState* state, OperatorXBase* parent) : Base(state, parent), _agg_data(std::make_unique()), - _child_block(vectorized::Block::create_unique()), - _pre_aggregated_block(vectorized::Block::create_unique()), + _child_block(Block::create_unique()), + _pre_aggregated_block(Block::create_unique()), _is_single_backend(state->get_query_ctx()->is_single_backend_query()) {} Status StreamingAggLocalState::init(RuntimeState* state, LocalStateInfo& info) { @@ -97,7 +97,7 @@ Status StreamingAggLocalState::open(RuntimeState* state) { RETURN_IF_ERROR(_init_hash_method(_probe_expr_ctxs)); - std::visit(vectorized::Overload { + std::visit(Overload { [&](std::monostate& arg) -> void { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -124,7 +124,7 @@ Status StreamingAggLocalState::open(RuntimeState* state) { size_t StreamingAggLocalState::_get_hash_table_size() { return std::visit( - vectorized::Overload {[&](std::monostate& arg) -> size_t { + Overload {[&](std::monostate& arg) -> size_t { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); return 0; @@ -134,7 +134,7 @@ size_t StreamingAggLocalState::_get_hash_table_size() { } void StreamingAggLocalState::_update_memusage_with_serialized_key() { - std::visit(vectorized::Overload { + std::visit(Overload { [&](std::monostate& arg) -> void { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -153,15 +153,15 @@ void StreamingAggLocalState::_update_memusage_with_serialized_key() { _agg_data->method_variant); } -Status StreamingAggLocalState::_init_hash_method(const vectorized::VExprContextSPtrs& probe_exprs) { +Status StreamingAggLocalState::_init_hash_method(const VExprContextSPtrs& probe_exprs) { RETURN_IF_ERROR(init_hash_method( _agg_data.get(), get_data_types(probe_exprs), Base::_parent->template cast()._is_first_phase)); return Status::OK(); } -Status StreamingAggLocalState::do_pre_agg(RuntimeState* state, vectorized::Block* input_block, - vectorized::Block* output_block) { +Status StreamingAggLocalState::do_pre_agg(RuntimeState* state, Block* input_block, + Block* output_block) { if (low_memory_mode()) { auto& p = Base::_parent->template cast(); p.set_low_memory_mode(state); @@ -181,7 +181,7 @@ bool StreamingAggLocalState::_should_expand_preagg_hash_tables() { } return std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) -> bool { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); return false; @@ -251,7 +251,7 @@ size_t StreamingAggLocalState::_memory_usage() const { usage += _aggregate_data_container->memory_usage(); } - std::visit(vectorized::Overload {[&](std::monostate& arg) -> void { + std::visit(Overload {[&](std::monostate& arg) -> void { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -276,7 +276,7 @@ bool StreamingAggLocalState::_should_not_do_pre_agg(size_t rows) { const bool used_too_much_memory = spill_streaming_agg_mem_limit > 0 && _memory_usage() > spill_streaming_agg_mem_limit; std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -296,15 +296,15 @@ bool StreamingAggLocalState::_should_not_do_pre_agg(size_t rows) { return ret_flag; } -Status StreamingAggLocalState::_pre_agg_with_serialized_key(doris::vectorized::Block* in_block, - doris::vectorized::Block* out_block) { +Status StreamingAggLocalState::_pre_agg_with_serialized_key(doris::Block* in_block, + doris::Block* out_block) { SCOPED_TIMER(_build_timer); DCHECK(!_probe_expr_ctxs.empty()); auto& p = Base::_parent->template cast(); size_t key_size = _probe_expr_ctxs.size(); - vectorized::ColumnRawPtrs key_columns(key_size); + ColumnRawPtrs key_columns(key_size); { SCOPED_TIMER(_expr_timer); for (size_t i = 0; i < key_size; ++i) { @@ -338,7 +338,7 @@ Status StreamingAggLocalState::_pre_agg_with_serialized_key(doris::vectorized::B need_computes.end(); if (need_filter) { _add_limit_heap_top(key_columns, rows); - vectorized::Block::filter_block_internal(in_block, need_computes); + Block::filter_block_internal(in_block, need_computes); rows = (uint32_t)in_block->rows(); } else { return Status::OK(); @@ -348,8 +348,8 @@ Status StreamingAggLocalState::_pre_agg_with_serialized_key(doris::vectorized::B } bool mem_reuse = p._make_nullable_keys.empty() && out_block->mem_reuse(); - std::vector data_types; - vectorized::MutableColumns value_columns; + std::vector data_types; + MutableColumns value_columns; for (int i = 0; i < _aggregate_evaluators.size(); ++i) { auto data_type = _aggregate_evaluators[i]->function()->get_serialized_type(); if (mem_reuse) { @@ -369,7 +369,7 @@ Status StreamingAggLocalState::_pre_agg_with_serialized_key(doris::vectorized::B } if (!mem_reuse) { - vectorized::ColumnsWithTypeAndName columns_with_schema; + ColumnsWithTypeAndName columns_with_schema; for (int i = 0; i < key_size; ++i) { columns_with_schema.emplace_back(key_columns[i]->clone_resized(rows), _probe_expr_ctxs[i]->root()->data_type(), @@ -378,7 +378,7 @@ Status StreamingAggLocalState::_pre_agg_with_serialized_key(doris::vectorized::B for (int i = 0; i < value_columns.size(); ++i) { columns_with_schema.emplace_back(std::move(value_columns[i]), data_types[i], ""); } - out_block->swap(vectorized::Block(columns_with_schema)); + out_block->swap(Block(columns_with_schema)); } else { for (int i = 0; i < key_size; ++i) { std::move(*out_block->get_by_position(i).column) @@ -410,7 +410,7 @@ Status StreamingAggLocalState::_pre_agg_with_serialized_key(doris::vectorized::B return Status::OK(); } -Status StreamingAggLocalState::_create_agg_status(vectorized::AggregateDataPtr data) { +Status StreamingAggLocalState::_create_agg_status(AggregateDataPtr data) { auto& p = Base::_parent->template cast(); for (int i = 0; i < _aggregate_evaluators.size(); ++i) { try { @@ -426,19 +426,19 @@ Status StreamingAggLocalState::_create_agg_status(vectorized::AggregateDataPtr d } Status StreamingAggLocalState::_get_results_with_serialized_key(RuntimeState* state, - vectorized::Block* block, + Block* block, bool* eos) { SCOPED_TIMER(_get_results_timer); auto& p = _parent->cast(); const auto key_size = _probe_expr_ctxs.size(); const auto agg_size = _aggregate_evaluators.size(); - vectorized::MutableColumns value_columns(agg_size); - vectorized::DataTypes value_data_types(agg_size); + MutableColumns value_columns(agg_size); + DataTypes value_data_types(agg_size); // non-nullable column(id in `_make_nullable_keys`) will be converted to nullable. bool mem_reuse = p._make_nullable_keys.empty() && block->mem_reuse(); - vectorized::MutableColumns key_columns; + MutableColumns key_columns; for (int i = 0; i < key_size; ++i) { if (mem_reuse) { key_columns.emplace_back(std::move(*block->get_by_position(i).column).mutate()); @@ -448,7 +448,7 @@ Status StreamingAggLocalState::_get_results_with_serialized_key(RuntimeState* st } std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) -> void { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -492,7 +492,7 @@ Status StreamingAggLocalState::_get_results_with_serialized_key(RuntimeState* st key_columns[0]->insert_data(nullptr, 0); _values[num_rows] = agg_method.hash_table->template get_null_key_data< - vectorized::AggregateDataPtr>(); + AggregateDataPtr>(); ++num_rows; *eos = true; } @@ -524,7 +524,7 @@ Status StreamingAggLocalState::_get_results_with_serialized_key(RuntimeState* st _agg_data->method_variant); if (!mem_reuse) { - vectorized::ColumnsWithTypeAndName columns_with_schema; + ColumnsWithTypeAndName columns_with_schema; for (int i = 0; i < key_size; ++i) { columns_with_schema.emplace_back(std::move(key_columns[i]), _probe_expr_ctxs[i]->root()->data_type(), @@ -533,13 +533,13 @@ Status StreamingAggLocalState::_get_results_with_serialized_key(RuntimeState* st for (int i = 0; i < agg_size; ++i) { columns_with_schema.emplace_back(std::move(value_columns[i]), value_data_types[i], ""); } - *block = vectorized::Block(columns_with_schema); + *block = Block(columns_with_schema); } return Status::OK(); } -void StreamingAggLocalState::make_nullable_output_key(vectorized::Block* block) { +void StreamingAggLocalState::make_nullable_output_key(Block* block) { if (block->rows() != 0) { for (auto cid : _parent->cast()._make_nullable_keys) { block->get_by_position(cid).column = make_nullable(block->get_by_position(cid).column); @@ -548,22 +548,22 @@ void StreamingAggLocalState::make_nullable_output_key(vectorized::Block* block) } } -void StreamingAggLocalState::_destroy_agg_status(vectorized::AggregateDataPtr data) { +void StreamingAggLocalState::_destroy_agg_status(AggregateDataPtr data) { for (int i = 0; i < _aggregate_evaluators.size(); ++i) { _aggregate_evaluators[i]->function()->destroy( data + _parent->cast()._offsets_of_aggregate_states[i]); } } -vectorized::MutableColumns StreamingAggLocalState::_get_keys_hash_table() { +MutableColumns StreamingAggLocalState::_get_keys_hash_table() { return std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); - return vectorized::MutableColumns(); + return MutableColumns(); }, - [&](auto&& agg_method) -> vectorized::MutableColumns { - vectorized::MutableColumns key_columns; + [&](auto&& agg_method) -> MutableColumns { + MutableColumns key_columns; for (int i = 0; i < _probe_expr_ctxs.size(); ++i) { key_columns.emplace_back( _probe_expr_ctxs[i]->root()->data_type()->create_column()); @@ -604,7 +604,7 @@ void StreamingAggLocalState::build_limit_heap(size_t hash_table_size) { limit_columns_min = limit_heap.top()._row_id; } -void StreamingAggLocalState::_add_limit_heap_top(vectorized::ColumnRawPtrs& key_columns, +void StreamingAggLocalState::_add_limit_heap_top(ColumnRawPtrs& key_columns, size_t rows) { for (int i = 0; i < rows; ++i) { if (cmp_res[i] == 1 && need_computes[i]) { @@ -620,7 +620,7 @@ void StreamingAggLocalState::_add_limit_heap_top(vectorized::ColumnRawPtrs& key_ } } -void StreamingAggLocalState::_refresh_limit_heap(size_t i, vectorized::ColumnRawPtrs& key_columns) { +void StreamingAggLocalState::_refresh_limit_heap(size_t i, ColumnRawPtrs& key_columns) { for (int j = 0; j < key_columns.size(); ++j) { limit_columns[j]->insert_from(*key_columns[j], i); } @@ -630,12 +630,12 @@ void StreamingAggLocalState::_refresh_limit_heap(size_t i, vectorized::ColumnRaw limit_columns_min = limit_heap.top()._row_id; } -bool StreamingAggLocalState::_emplace_into_hash_table_limit(vectorized::AggregateDataPtr* places, - vectorized::Block* block, - vectorized::ColumnRawPtrs& key_columns, +bool StreamingAggLocalState::_emplace_into_hash_table_limit(AggregateDataPtr* places, + Block* block, + ColumnRawPtrs& key_columns, uint32_t num_rows) { return std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); return true; @@ -650,7 +650,7 @@ bool StreamingAggLocalState::_emplace_into_hash_table_limit(vectorized::Aggregat std::find(need_computes.begin(), need_computes.end(), 1); need_agg != need_computes.end()) { if (need_filter) { - vectorized::Block::filter_block_internal(block, need_computes); + Block::filter_block_internal(block, need_computes); num_rows = (uint32_t)block->rows(); } @@ -704,7 +704,7 @@ bool StreamingAggLocalState::_emplace_into_hash_table_limit(vectorized::Aggregat } bool StreamingAggLocalState::_do_limit_filter(size_t num_rows, - vectorized::ColumnRawPtrs& key_columns) { + ColumnRawPtrs& key_columns) { SCOPED_TIMER(_hash_table_limit_compute_timer); if (num_rows) { cmp_res.resize(num_rows); @@ -732,10 +732,10 @@ bool StreamingAggLocalState::_do_limit_filter(size_t num_rows, return false; } -void StreamingAggLocalState::_emplace_into_hash_table(vectorized::AggregateDataPtr* places, - vectorized::ColumnRawPtrs& key_columns, +void StreamingAggLocalState::_emplace_into_hash_table(AggregateDataPtr* places, + ColumnRawPtrs& key_columns, const uint32_t num_rows) { - std::visit(vectorized::Overload { + std::visit(Overload { [&](std::monostate& arg) -> void { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); }, @@ -770,7 +770,7 @@ void StreamingAggLocalState::_emplace_into_hash_table(vectorized::AggregateDataP }; SCOPED_TIMER(_hash_table_emplace_timer); - vectorized::lazy_emplace_batch( + lazy_emplace_batch( agg_method, state, num_rows, creator, creator_for_null_key, [&](uint32_t row, auto& mapped) { places[row] = mapped; }); @@ -802,7 +802,7 @@ void StreamingAggOperatorX::update_operator(const TPlanNode& tnode, tnode.agg_node.aggregate_functions.end(), [](const TExpr& texpr) -> bool { return texpr.nodes[0].fn.name.function_name.starts_with( - vectorized::DISTINCT_FUNCTION_PREFIX); + DISTINCT_FUNCTION_PREFIX); })) ? tnode.distribute_expr_lists[0] : tnode.agg_node.grouping_exprs; @@ -812,7 +812,7 @@ Status StreamingAggOperatorX::init(const TPlanNode& tnode, RuntimeState* state) RETURN_IF_ERROR(StatefulOperatorX::init(tnode, state)); // ignore return status for now , so we need to introduce ExecNode::init() RETURN_IF_ERROR( - vectorized::VExpr::create_expr_trees(tnode.agg_node.grouping_exprs, _probe_expr_ctxs)); + VExpr::create_expr_trees(tnode.agg_node.grouping_exprs, _probe_expr_ctxs)); // init aggregate functions _aggregate_evaluators.reserve(tnode.agg_node.aggregate_functions.size()); @@ -822,8 +822,8 @@ Status StreamingAggOperatorX::init(const TPlanNode& tnode, RuntimeState* state) TSortInfo dummy; for (int i = 0; i < tnode.agg_node.aggregate_functions.size(); ++i) { - vectorized::AggFnEvaluator* evaluator = nullptr; - RETURN_IF_ERROR(vectorized::AggFnEvaluator::create( + AggFnEvaluator* evaluator = nullptr; + RETURN_IF_ERROR(AggFnEvaluator::create( _pool, tnode.agg_node.aggregate_functions[i], tnode.agg_node.__isset.agg_sort_infos ? tnode.agg_node.agg_sort_infos[i] : dummy, tnode.agg_node.grouping_exprs.empty(), false, &evaluator)); @@ -888,8 +888,8 @@ Status StreamingAggOperatorX::_init_probe_expr_ctx(RuntimeState* state) { _intermediate_tuple_desc = state->desc_tbl().get_tuple_descriptor(_intermediate_tuple_id); _output_tuple_desc = state->desc_tbl().get_tuple_descriptor(_output_tuple_id); DCHECK_EQ(_intermediate_tuple_desc->slots().size(), _output_tuple_desc->slots().size()); - RETURN_IF_ERROR(vectorized::VExpr::prepare(_probe_expr_ctxs, state, _child->row_desc())); - RETURN_IF_ERROR(vectorized::VExpr::open(_probe_expr_ctxs, state)); + RETURN_IF_ERROR(VExpr::prepare(_probe_expr_ctxs, state, _child->row_desc())); + RETURN_IF_ERROR(VExpr::open(_probe_expr_ctxs, state)); return Status::OK(); } @@ -955,7 +955,7 @@ Status StreamingAggLocalState::close(RuntimeState* state) { return Status::OK(); } _pre_aggregated_block->clear(); - vectorized::PODArray tmp_places; + PODArray tmp_places; _places.swap(tmp_places); std::vector tmp_deserialize_buffer; @@ -963,7 +963,7 @@ Status StreamingAggLocalState::close(RuntimeState* state) { /// _hash_table_size_counter may be null if prepare failed. if (_hash_table_size_counter) { - std::visit(vectorized::Overload {[&](std::monostate& arg) -> void { + std::visit(Overload {[&](std::monostate& arg) -> void { // Do nothing }, [&](auto& agg_method) { @@ -977,7 +977,7 @@ Status StreamingAggLocalState::close(RuntimeState* state) { return Base::close(state); } -Status StreamingAggOperatorX::pull(RuntimeState* state, vectorized::Block* block, bool* eos) const { +Status StreamingAggOperatorX::pull(RuntimeState* state, Block* block, bool* eos) const { auto& local_state = get_local_state(state); SCOPED_PEAK_MEM(&local_state._estimate_memory_usage); if (!local_state._pre_aggregated_block->empty()) { @@ -993,7 +993,7 @@ Status StreamingAggOperatorX::pull(RuntimeState* state, vectorized::Block* block return Status::OK(); } -Status StreamingAggOperatorX::push(RuntimeState* state, vectorized::Block* in_block, +Status StreamingAggOperatorX::push(RuntimeState* state, Block* in_block, bool eos) const { auto& local_state = get_local_state(state); SCOPED_PEAK_MEM(&local_state._estimate_memory_usage); @@ -1013,4 +1013,4 @@ bool StreamingAggOperatorX::need_more_input_data(RuntimeState* state) const { } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/streaming_aggregation_operator.h b/be/src/exec/operator/streaming_aggregation_operator.h similarity index 69% rename from be/src/pipeline/exec/streaming_aggregation_operator.h rename to be/src/exec/operator/streaming_aggregation_operator.h index 3612adec47d431..162b362145e805 100644 --- a/be/src/pipeline/exec/streaming_aggregation_operator.h +++ b/be/src/exec/operator/streaming_aggregation_operator.h @@ -22,16 +22,14 @@ #include #include "common/status.h" -#include "pipeline/exec/operator.h" -#include "util/runtime_profile.h" -#include "vec/core/block.h" +#include "core/block/block.h" +#include "exec/operator/operator.h" +#include "runtime/runtime_profile.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace pipeline { - class StreamingAggOperatorX; class StreamingAggLocalState MOCK_REMOVE(final) : public PipelineXLocalState { @@ -45,9 +43,8 @@ class StreamingAggLocalState MOCK_REMOVE(final) : public PipelineXLocalState _aggregate_evaluators; + std::vector _aggregate_evaluators; // group by k1,k2 - vectorized::VExprContextSPtrs _probe_expr_ctxs; + VExprContextSPtrs _probe_expr_ctxs; std::unique_ptr _aggregate_data_container = nullptr; bool _reach_limit = false; size_t _input_num_rows = 0; @@ -110,15 +104,15 @@ class StreamingAggLocalState MOCK_REMOVE(final) : public PipelineXLocalState need_computes; + PaddedPODArray need_computes; std::vector cmp_res; std::vector order_directions; std::vector null_directions; struct HeapLimitCursor { - HeapLimitCursor(int row_id, vectorized::MutableColumns& limit_columns, + HeapLimitCursor(int row_id, MutableColumns& limit_columns, std::vector& order_directions, std::vector& null_directions) : _row_id(row_id), _limit_columns(limit_columns), @@ -159,45 +153,44 @@ class StreamingAggLocalState MOCK_REMOVE(final) : public PipelineXLocalState& _order_directions; std::vector& _null_directions; }; std::priority_queue limit_heap; - vectorized::MutableColumns _get_keys_hash_table(); + MutableColumns _get_keys_hash_table(); - vectorized::PODArray _places; + PODArray _places; std::vector _deserialize_buffer; - std::unique_ptr _child_block = nullptr; + std::unique_ptr _child_block = nullptr; bool _child_eos = false; - std::unique_ptr _pre_aggregated_block = nullptr; - std::vector _values; + std::unique_ptr _pre_aggregated_block = nullptr; + std::vector _values; bool _opened = false; - void _destroy_agg_status(vectorized::AggregateDataPtr data); + void _destroy_agg_status(AggregateDataPtr data); void _close_with_serialized_key() { - std::visit( - vectorized::Overload {[&](std::monostate& arg) -> void { - // Do nothing - }, - [&](auto& agg_method) -> void { - auto& data = *agg_method.hash_table; - data.for_each_mapped([&](auto& mapped) { - if (mapped) { - _destroy_agg_status(mapped); - mapped = nullptr; - } - }); - if (data.has_null_key_data()) { - _destroy_agg_status(data.template get_null_key_data< - vectorized::AggregateDataPtr>()); - } - }}, - _agg_data->method_variant); + std::visit(Overload {[&](std::monostate& arg) -> void { + // Do nothing + }, + [&](auto& agg_method) -> void { + auto& data = *agg_method.hash_table; + data.for_each_mapped([&](auto& mapped) { + if (mapped) { + _destroy_agg_status(mapped); + mapped = nullptr; + } + }); + if (data.has_null_key_data()) { + _destroy_agg_status( + data.template get_null_key_data()); + } + }}, + _agg_data->method_variant); } bool _is_single_backend = false; @@ -216,8 +209,8 @@ class StreamingAggOperatorX MOCK_REMOVE(final) : public StatefulOperatorX _aggregate_evaluators; + VExprContextSPtrs _probe_expr_ctxs; + std::vector _aggregate_evaluators; bool _can_short_circuit = false; std::vector _make_nullable_keys; RowDescriptor _agg_fn_output_row_descriptor; @@ -280,6 +273,5 @@ class StreamingAggOperatorX MOCK_REMOVE(final) : public StatefulOperatorX _partition_exprs; }; -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/pipeline/exec/table_function_operator.cpp b/be/src/exec/operator/table_function_operator.cpp similarity index 86% rename from be/src/pipeline/exec/table_function_operator.cpp rename to be/src/exec/operator/table_function_operator.cpp index 63e8bded2c64c2..00564cdc4e3dba 100644 --- a/be/src/pipeline/exec/table_function_operator.cpp +++ b/be/src/exec/operator/table_function_operator.cpp @@ -15,27 +15,27 @@ // specific language governing permissions and limitations // under the License. -#include "table_function_operator.h" +#include "exec/operator/table_function_operator.h" #include #include -#include "pipeline/exec/operator.h" +#include "core/block/block.h" +#include "core/block/column_numbers.h" +#include "core/custom_allocator.h" +#include "exec/operator/operator.h" +#include "exprs/table_function/table_function_factory.h" #include "util/simd/bits.h" -#include "vec/common/custom_allocator.h" -#include "vec/core/block.h" -#include "vec/core/column_numbers.h" -#include "vec/exprs/table_function/table_function_factory.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; } // namespace doris -namespace doris::pipeline { +namespace doris { TableFunctionLocalState::TableFunctionLocalState(RuntimeState* state, OperatorXBase* parent) - : PipelineXLocalState<>(state, parent), _child_block(vectorized::Block::create_unique()) {} + : PipelineXLocalState<>(state, parent), _child_block(Block::create_unique()) {} Status TableFunctionLocalState::init(RuntimeState* state, LocalStateInfo& info) { RETURN_IF_ERROR(PipelineXLocalState<>::init(state, info)); @@ -53,9 +53,9 @@ Status TableFunctionLocalState::_clone_table_function(RuntimeState* state) { for (size_t i = 0; i < _vfn_ctxs.size(); i++) { RETURN_IF_ERROR(p._vfn_ctxs[i]->clone(state, _vfn_ctxs[i])); - vectorized::TableFunction* fn = nullptr; - RETURN_IF_ERROR(vectorized::TableFunctionFactory::get_fn( - _vfn_ctxs[i]->root()->fn(), state->obj_pool(), &fn, state->be_exec_version())); + TableFunction* fn = nullptr; + RETURN_IF_ERROR(TableFunctionFactory::get_fn(_vfn_ctxs[i]->root()->fn(), state->obj_pool(), + &fn, state->be_exec_version())); fn->set_expr_context(_vfn_ctxs[i]); _fns.push_back(fn); } @@ -79,7 +79,7 @@ Status TableFunctionLocalState::open(RuntimeState* state) { return Status::OK(); } -void TableFunctionLocalState::_copy_output_slots(std::vector& columns, +void TableFunctionLocalState::_copy_output_slots(std::vector& columns, const TableFunctionOperatorX& p) { if (!_current_row_insert_times) { return; @@ -160,17 +160,17 @@ bool TableFunctionLocalState::_is_inner_and_empty() { return false; } -Status TableFunctionLocalState::get_expanded_block(RuntimeState* state, - vectorized::Block* output_block, bool* eos) { +Status TableFunctionLocalState::get_expanded_block(RuntimeState* state, Block* output_block, + bool* eos) { SCOPED_TIMER(_process_rows_timer); if (_need_to_handle_outer_conjuncts) { return _get_expanded_block_for_outer_conjuncts(state, output_block, eos); } auto& p = _parent->cast(); - vectorized::MutableBlock m_block = vectorized::VectorizedUtils::build_mutable_mem_reuse_block( - output_block, p._output_slots); - vectorized::MutableColumns& columns = m_block.mutable_columns(); + MutableBlock m_block = + VectorizedUtils::build_mutable_mem_reuse_block(output_block, p._output_slots); + MutableColumns& columns = m_block.mutable_columns(); for (int i = 0; i < p._fn_num; i++) { if (columns[i + p._child_slots.size()]->is_nullable()) { @@ -232,22 +232,23 @@ Status TableFunctionLocalState::get_expanded_block(RuntimeState* state, { SCOPED_TIMER(_filter_timer); // 3. eval conjuncts - RETURN_IF_ERROR(vectorized::VExprContext::filter_block(_expand_conjuncts_ctxs, output_block, - output_block->columns())); - RETURN_IF_ERROR(vectorized::VExprContext::filter_block(_conjuncts, output_block, - output_block->columns())); + RETURN_IF_ERROR(VExprContext::filter_block(_expand_conjuncts_ctxs, output_block, + output_block->columns())); + RETURN_IF_ERROR( + VExprContext::filter_block(_conjuncts, output_block, output_block->columns())); } *eos = _child_eos && _cur_child_offset == -1; return Status::OK(); } -Status TableFunctionLocalState::_get_expanded_block_for_outer_conjuncts( - RuntimeState* state, vectorized::Block* output_block, bool* eos) { +Status TableFunctionLocalState::_get_expanded_block_for_outer_conjuncts(RuntimeState* state, + Block* output_block, + bool* eos) { auto& p = _parent->cast(); - vectorized::MutableBlock m_block = vectorized::VectorizedUtils::build_mutable_mem_reuse_block( - output_block, p._output_slots); - vectorized::MutableColumns& columns = m_block.mutable_columns(); + MutableBlock m_block = + VectorizedUtils::build_mutable_mem_reuse_block(output_block, p._output_slots); + MutableColumns& columns = m_block.mutable_columns(); auto child_slot_count = p._child_slots.size(); for (int i = 0; i < p._fn_num; i++) { if (columns[i + child_slot_count]->is_nullable()) { @@ -379,11 +380,11 @@ Status TableFunctionLocalState::_get_expanded_block_for_outer_conjuncts( child rows 1, 2, 3 are all filtered out, so we need to insert one row with NULL tag value for each of them. */ if (!child_block_empty) { - vectorized::IColumn::Filter filter; + IColumn::Filter filter; auto column_count = output_block->columns(); - vectorized::ColumnNumbers columns_to_filter(column_count); + ColumnNumbers columns_to_filter(column_count); std::iota(columns_to_filter.begin(), columns_to_filter.end(), 0); - RETURN_IF_ERROR(vectorized::VExprContext::execute_conjuncts_and_filter_block( + RETURN_IF_ERROR(VExprContext::execute_conjuncts_and_filter_block( _expand_conjuncts_ctxs, output_block, columns_to_filter, column_count, filter)); size_t remain_row_count = output_block->rows(); // for outer table function, need to handle those child rows which all expanded rows are filtered out @@ -413,10 +414,9 @@ Status TableFunctionLocalState::_get_expanded_block_for_outer_conjuncts( } } if (!null_row_indices.empty()) { - vectorized::MutableBlock m_block2 = - vectorized::VectorizedUtils::build_mutable_mem_reuse_block(output_block, - p._output_slots); - vectorized::MutableColumns& columns2 = m_block2.mutable_columns(); + MutableBlock m_block2 = VectorizedUtils::build_mutable_mem_reuse_block( + output_block, p._output_slots); + MutableColumns& columns2 = m_block2.mutable_columns(); for (auto index : p._output_slot_indexs) { auto src_column = _child_block->get_by_position(index).column; columns2[index]->insert_indices_from( @@ -438,8 +438,8 @@ Status TableFunctionLocalState::_get_expanded_block_for_outer_conjuncts( { SCOPED_TIMER(_filter_timer); // 3. eval conjuncts - RETURN_IF_ERROR(vectorized::VExprContext::filter_block(_conjuncts, output_block, - output_block->columns())); + RETURN_IF_ERROR( + VExprContext::filter_block(_conjuncts, output_block, output_block->columns())); } *eos = _child_eos && _cur_child_offset == -1; @@ -451,7 +451,7 @@ void TableFunctionLocalState::process_next_child_row() { if (_cur_child_offset >= _child_block->rows()) { // release block use count. - for (vectorized::TableFunction* fn : _fns) { + for (TableFunction* fn : _fns) { fn->process_close(); } @@ -466,7 +466,7 @@ void TableFunctionLocalState::process_next_child_row() { return; } - for (vectorized::TableFunction* fn : _fns) { + for (TableFunction* fn : _fns) { fn->process_row(_cur_child_offset); } } @@ -495,22 +495,22 @@ Status TableFunctionOperatorX::init(const TPlanNode& tnode, RuntimeState* state) RETURN_IF_ERROR(Base::init(tnode, state)); for (const TExpr& texpr : tnode.table_function_node.fnCallExprList) { - vectorized::VExprContextSPtr ctx; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(texpr, ctx)); + VExprContextSPtr ctx; + RETURN_IF_ERROR(VExpr::create_expr_tree(texpr, ctx)); _vfn_ctxs.push_back(ctx); auto root = ctx->root(); - vectorized::TableFunction* fn = nullptr; - RETURN_IF_ERROR(vectorized::TableFunctionFactory::get_fn(root->fn(), _pool, &fn, - state->be_exec_version())); + TableFunction* fn = nullptr; + RETURN_IF_ERROR( + TableFunctionFactory::get_fn(root->fn(), _pool, &fn, state->be_exec_version())); fn->set_expr_context(ctx); _fns.push_back(fn); } _fn_num = cast_set(_fns.size()); for (const TExpr& texpr : tnode.table_function_node.expand_conjuncts) { - vectorized::VExprContextSPtr ctx; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(texpr, ctx)); + VExprContextSPtr ctx; + RETURN_IF_ERROR(VExpr::create_expr_tree(texpr, ctx)); _expand_conjuncts_ctxs.push_back(ctx); } if (!_expand_conjuncts_ctxs.empty()) { @@ -527,9 +527,9 @@ Status TableFunctionOperatorX::prepare(doris::RuntimeState* state) { for (auto* fn : _fns) { RETURN_IF_ERROR(fn->prepare()); } - RETURN_IF_ERROR(vectorized::VExpr::prepare(_vfn_ctxs, state, row_descriptor())); + RETURN_IF_ERROR(VExpr::prepare(_vfn_ctxs, state, row_descriptor())); - RETURN_IF_ERROR(vectorized::VExpr::prepare(_expand_conjuncts_ctxs, state, row_descriptor())); + RETURN_IF_ERROR(VExpr::prepare(_expand_conjuncts_ctxs, state, row_descriptor())); // get current all output slots for (const auto& tuple_desc : row_descriptor().tuple_descriptors()) { @@ -553,9 +553,9 @@ Status TableFunctionOperatorX::prepare(doris::RuntimeState* state) { } } - RETURN_IF_ERROR(vectorized::VExpr::open(_expand_conjuncts_ctxs, state)); - return vectorized::VExpr::open(_vfn_ctxs, state); + RETURN_IF_ERROR(VExpr::open(_expand_conjuncts_ctxs, state)); + return VExpr::open(_vfn_ctxs, state); } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/table_function_operator.h b/be/src/exec/operator/table_function_operator.h similarity index 85% rename from be/src/pipeline/exec/table_function_operator.h rename to be/src/exec/operator/table_function_operator.h index 56f9f116ec8270..c6c3ddac577aa6 100644 --- a/be/src/pipeline/exec/table_function_operator.h +++ b/be/src/exec/operator/table_function_operator.h @@ -20,15 +20,15 @@ #include #include "common/status.h" -#include "operator.h" -#include "vec/exprs/table_function/table_function.h" +#include "exec/operator/operator.h" +#include "exprs/table_function/table_function.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; } // namespace doris -namespace doris::pipeline { +namespace doris { class TableFunctionOperatorX; class TableFunctionLocalState MOCK_REMOVE(final) : public PipelineXLocalState<> { @@ -48,7 +48,7 @@ class TableFunctionLocalState MOCK_REMOVE(final) : public PipelineXLocalState<> return Status::OK(); } void process_next_child_row(); - Status get_expanded_block(RuntimeState* state, vectorized::Block* output_block, bool* eos); + Status get_expanded_block(RuntimeState* state, Block* output_block, bool* eos); private: friend class TableFunctionOperatorX; @@ -56,7 +56,7 @@ class TableFunctionLocalState MOCK_REMOVE(final) : public PipelineXLocalState<> MOCK_FUNCTION Status _clone_table_function(RuntimeState* state); - void _copy_output_slots(std::vector& columns, + void _copy_output_slots(std::vector& columns, const TableFunctionOperatorX& p); bool _roll_table_functions(int last_eos_idx); // return: @@ -66,16 +66,16 @@ class TableFunctionLocalState MOCK_REMOVE(final) : public PipelineXLocalState<> int _find_last_fn_eos_idx() const; bool _is_inner_and_empty(); - Status _get_expanded_block_for_outer_conjuncts(RuntimeState* state, - vectorized::Block* output_block, bool* eos); + Status _get_expanded_block_for_outer_conjuncts(RuntimeState* state, Block* output_block, + bool* eos); - std::vector _fns; - vectorized::VExprContextSPtrs _vfn_ctxs; - vectorized::VExprContextSPtrs _expand_conjuncts_ctxs; + std::vector _fns; + VExprContextSPtrs _vfn_ctxs; + VExprContextSPtrs _expand_conjuncts_ctxs; // for table function with outer conjuncts, need to handle those child rows which all expanded rows are filtered out bool _need_to_handle_outer_conjuncts = false; int64_t _cur_child_offset = -1; - std::unique_ptr _child_block; + std::unique_ptr _child_block; int _current_row_insert_times = 0; bool _child_eos = false; DorisVector _child_rows_has_output; @@ -108,7 +108,7 @@ class TableFunctionOperatorX MOCK_REMOVE(final) return {ExchangeType::PASSTHROUGH}; } - Status push(RuntimeState* state, vectorized::Block* input_block, bool eos) const override { + Status push(RuntimeState* state, Block* input_block, bool eos) const override { auto& local_state = get_local_state(state); if (input_block->rows() == 0) { return Status::OK(); @@ -123,7 +123,7 @@ class TableFunctionOperatorX MOCK_REMOVE(final) return Status::OK(); } - Status pull(RuntimeState* state, vectorized::Block* output_block, bool* eos) const override { + Status pull(RuntimeState* state, Block* output_block, bool* eos) const override { auto& local_state = get_local_state(state); RETURN_IF_ERROR(local_state.get_expanded_block(state, output_block, eos)); local_state.reached_limit(output_block, eos); @@ -158,10 +158,10 @@ class TableFunctionOperatorX MOCK_REMOVE(final) std::vector _child_slots; std::vector _output_slots; - vectorized::VExprContextSPtrs _vfn_ctxs; - vectorized::VExprContextSPtrs _expand_conjuncts_ctxs; + VExprContextSPtrs _vfn_ctxs; + VExprContextSPtrs _expand_conjuncts_ctxs; - std::vector _fns; + std::vector _fns; int _fn_num = 0; std::vector _output_slot_ids; @@ -172,4 +172,4 @@ class TableFunctionOperatorX MOCK_REMOVE(final) }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/tvf_table_sink_operator.cpp b/be/src/exec/operator/tvf_table_sink_operator.cpp similarity index 91% rename from be/src/pipeline/exec/tvf_table_sink_operator.cpp rename to be/src/exec/operator/tvf_table_sink_operator.cpp index c5e82ea2762638..20841eabbd4419 100644 --- a/be/src/pipeline/exec/tvf_table_sink_operator.cpp +++ b/be/src/exec/operator/tvf_table_sink_operator.cpp @@ -15,11 +15,11 @@ // specific language governing permissions and limitations // under the License. -#include "tvf_table_sink_operator.h" +#include "exec/operator/tvf_table_sink_operator.h" #include "common/status.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" Status TVFTableSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& info) { @@ -29,4 +29,4 @@ Status TVFTableSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& inf return Status::OK(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/tvf_table_sink_operator.h b/be/src/exec/operator/tvf_table_sink_operator.h similarity index 77% rename from be/src/pipeline/exec/tvf_table_sink_operator.h rename to be/src/exec/operator/tvf_table_sink_operator.h index 922a4b7d96d634..0a47d37ed609c9 100644 --- a/be/src/pipeline/exec/tvf_table_sink_operator.h +++ b/be/src/exec/operator/tvf_table_sink_operator.h @@ -17,18 +17,18 @@ #pragma once -#include "operator.h" -#include "vec/sink/writer/vtvf_table_writer.h" +#include "exec/operator/operator.h" +#include "exec/sink/writer/vtvf_table_writer.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class TVFTableSinkOperatorX; class TVFTableSinkLocalState final - : public AsyncWriterSink { + : public AsyncWriterSink { public: - using Base = AsyncWriterSink; + using Base = AsyncWriterSink; using Parent = TVFTableSinkOperatorX; ENABLE_FACTORY_CREATOR(TVFTableSinkLocalState); TVFTableSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state) @@ -55,17 +55,17 @@ class TVFTableSinkOperatorX final : public DataSinkOperatorXrows()); @@ -75,13 +75,13 @@ class TVFTableSinkOperatorX final : public DataSinkOperatorX - requires(std::is_base_of_v) + requires(std::is_base_of_v) friend class AsyncWriterSink; const RowDescriptor& _row_desc; - vectorized::VExprContextSPtrs _output_vexpr_ctxs; + VExprContextSPtrs _output_vexpr_ctxs; const std::vector& _t_output_expr; ObjectPool* _pool = nullptr; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/union_sink_operator.cpp b/be/src/exec/operator/union_sink_operator.cpp similarity index 88% rename from be/src/pipeline/exec/union_sink_operator.cpp rename to be/src/exec/operator/union_sink_operator.cpp index 47b181ef0c9888..5484ea166aebb1 100644 --- a/be/src/pipeline/exec/union_sink_operator.cpp +++ b/be/src/exec/operator/union_sink_operator.cpp @@ -15,19 +15,19 @@ // specific language governing permissions and limitations // under the License. -#include "union_sink_operator.h" +#include "exec/operator/union_sink_operator.h" #include #include "common/cast_set.h" #include "common/compiler_util.h" // IWYU pragma: keep #include "common/status.h" -#include "pipeline/exec/data_queue.h" -#include "pipeline/exec/operator.h" +#include "exec/operator/data_queue.h" +#include "exec/operator/operator.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" -#include "util/runtime_profile.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" Status UnionSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& info) { @@ -74,8 +74,8 @@ Status UnionSinkOperatorX::init(const TPlanNode& tnode, RuntimeState* state) { // Create result_expr_ctx_lists_ from thrift exprs. auto& result_texpr_lists = tnode.union_node.result_expr_lists; auto& texprs = result_texpr_lists[_cur_child_id]; - vectorized::VExprContextSPtrs ctxs; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(texprs, ctxs)); + VExprContextSPtrs ctxs; + RETURN_IF_ERROR(VExpr::create_expr_trees(texprs, ctxs)); _child_expr = ctxs; } return Status::OK(); @@ -83,18 +83,18 @@ Status UnionSinkOperatorX::init(const TPlanNode& tnode, RuntimeState* state) { Status UnionSinkOperatorX::prepare(RuntimeState* state) { RETURN_IF_ERROR(DataSinkOperatorX::prepare(state)); - RETURN_IF_ERROR(vectorized::VExpr::prepare(_child_expr, state, _child->row_desc())); - RETURN_IF_ERROR(vectorized::VExpr::check_expr_output_type(_child_expr, row_descriptor())); + RETURN_IF_ERROR(VExpr::prepare(_child_expr, state, _child->row_desc())); + RETURN_IF_ERROR(VExpr::check_expr_output_type(_child_expr, row_descriptor())); // open const expr lists. - RETURN_IF_ERROR(vectorized::VExpr::open(_const_expr, state)); + RETURN_IF_ERROR(VExpr::open(_const_expr, state)); // open result expr lists. - RETURN_IF_ERROR(vectorized::VExpr::open(_child_expr, state)); + RETURN_IF_ERROR(VExpr::open(_child_expr, state)); return Status::OK(); } -Status UnionSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block, bool eos) { +Status UnionSinkOperatorX::sink(RuntimeState* state, Block* in_block, bool eos) { auto& local_state = get_local_state(state); if (local_state.low_memory_mode()) { set_low_memory_mode(state); @@ -142,4 +142,4 @@ Status UnionSinkOperatorX::sink(RuntimeState* state, vectorized::Block* in_block } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/exec/union_sink_operator.h b/be/src/exec/operator/union_sink_operator.h similarity index 85% rename from be/src/pipeline/exec/union_sink_operator.h rename to be/src/exec/operator/union_sink_operator.h index fd90938a0e0fec..429dd6a9b46e85 100644 --- a/be/src/pipeline/exec/union_sink_operator.h +++ b/be/src/exec/operator/union_sink_operator.h @@ -22,15 +22,14 @@ #include #include "common/status.h" -#include "operator.h" -#include "vec/core/block.h" -#include "vec/core/column_with_type_and_name.h" +#include "core/block/block.h" +#include "core/block/column_with_type_and_name.h" +#include "exec/operator/operator.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace pipeline { class DataQueue; class UnionSinkOperatorX; @@ -46,14 +45,14 @@ class UnionSinkLocalState final : public PipelineXSinkLocalState _output_block; + std::unique_ptr _output_block; /// Const exprs materialized by this node. These exprs don't refer to any children. /// Only materialized by the first fragment instance to avoid duplication. - vectorized::VExprContextSPtrs _const_expr; + VExprContextSPtrs _const_expr; /// Exprs materialized by this node. The i-th result expr list refers to the i-th child. - vectorized::VExprContextSPtrs _child_expr; + VExprContextSPtrs _child_expr; /// Index of current row in child_row_block_. int _child_row_idx; @@ -85,7 +84,7 @@ class UnionSinkOperatorX MOCK_REMOVE(final) : public DataSinkOperatorX create_shared_state() const override { if (_cur_child_id > 0) { @@ -120,10 +119,10 @@ class UnionSinkOperatorX MOCK_REMOVE(final) : public DataSinkOperatorXrows() > 0) { - vectorized::MutableBlock mblock = - vectorized::VectorizedUtils::build_mutable_mem_reuse_block(output_block, + MutableBlock mblock = + VectorizedUtils::build_mutable_mem_reuse_block(output_block, row_descriptor()); - vectorized::Block res; + Block res; RETURN_IF_ERROR(materialize_block(state, input_block, child_id, &res)); RETURN_IF_ERROR(mblock.merge(res)); } return Status::OK(); } - Status materialize_block(RuntimeState* state, vectorized::Block* src_block, int child_idx, - vectorized::Block* res_block) { + Status materialize_block(RuntimeState* state, Block* src_block, int child_idx, + Block* res_block) { auto& local_state = get_local_state(state); SCOPED_TIMER(local_state._expr_timer); const auto& child_exprs = local_state._child_expr; - vectorized::ColumnsWithTypeAndName colunms; + ColumnsWithTypeAndName colunms; for (size_t i = 0; i < child_exprs.size(); ++i) { - vectorized::ColumnWithTypeAndName result_data; + ColumnWithTypeAndName result_data; RETURN_IF_ERROR(child_exprs[i]->execute(src_block, result_data)); colunms.emplace_back(result_data); } @@ -171,6 +170,5 @@ class UnionSinkOperatorX MOCK_REMOVE(final) : public DataSinkOperatorX #include #include "common/status.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/data_queue.h" -#include "pipeline/exec/operator.h" -#include "pipeline/exec/union_sink_operator.h" +#include "core/block/block.h" +#include "core/block/columns_with_type_and_name.h" +#include "core/column/column.h" +#include "core/data_type/data_type_number.h" // IWYU pragma: keep +#include "exec/operator/data_queue.h" +#include "exec/operator/operator.h" +#include "exec/operator/union_sink_operator.h" +#include "exec/pipeline/dependency.h" #include "runtime/descriptors.h" #include "util/defer_op.h" -#include "vec/columns/column.h" -#include "vec/core/block.h" -#include "vec/core/columns_with_type_and_name.h" -#include "vec/data_types/data_type_number.h" // IWYU pragma: keep namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace pipeline { - Status UnionSourceLocalState::init(RuntimeState* state, LocalStateInfo& info) { RETURN_IF_ERROR(Base::init(state, info)); SCOPED_TIMER(exec_time_counter()); @@ -73,8 +71,8 @@ Status UnionSourceLocalState::open(RuntimeState* state) { // Const exprs materialized by this node. These exprs don't refer to any children. // Only materialized by the first fragment instance to avoid duplication. if (state->per_fragment_instance_idx() == 0) { - auto clone_expr_list = [&](vectorized::VExprContextSPtrs& cur_expr_list, - vectorized::VExprContextSPtrs& other_expr_list) { + auto clone_expr_list = [&](VExprContextSPtrs& cur_expr_list, + VExprContextSPtrs& other_expr_list) { cur_expr_list.resize(other_expr_list.size()); for (int i = 0; i < cur_expr_list.size(); i++) { RETURN_IF_ERROR(other_expr_list[i]->clone(state, cur_expr_list[i])); @@ -103,7 +101,7 @@ std::string UnionSourceLocalState::debug_string(int indentation_level) const { return fmt::to_string(debug_string_buffer); } -Status UnionSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* block, bool* eos) { +Status UnionSourceOperatorX::get_block(RuntimeState* state, Block* block, bool* eos) { auto& local_state = get_local_state(state); Defer set_eos {[&]() { // the eos check of union operator is complex, need check all logical if you want modify @@ -129,7 +127,7 @@ Status UnionSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* b } local_state._need_read_for_const_expr = has_more_const(state); } else if (_child_size != 0) { - std::unique_ptr output_block; + std::unique_ptr output_block; int child_idx = 0; RETURN_IF_ERROR(local_state._shared_state->data_queue.get_block_from_queue(&output_block, &child_idx)); @@ -144,7 +142,7 @@ Status UnionSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* b return Status::OK(); } -Status UnionSourceOperatorX::get_next_const(RuntimeState* state, vectorized::Block* block) { +Status UnionSourceOperatorX::get_next_const(RuntimeState* state, Block* block) { DCHECK_EQ(state->per_fragment_instance_idx(), 0); auto& local_state = state->get_local_state(operator_id())->cast(); DCHECK_LT(local_state._const_expr_list_idx, _const_expr_lists.size()); @@ -152,10 +150,9 @@ Status UnionSourceOperatorX::get_next_const(RuntimeState* state, vectorized::Blo SCOPED_PEAK_MEM(&local_state._estimate_memory_usage); auto& _const_expr_list_idx = local_state._const_expr_list_idx; - vectorized::MutableBlock mblock = - vectorized::VectorizedUtils::build_mutable_mem_reuse_block(block, row_descriptor()); + MutableBlock mblock = VectorizedUtils::build_mutable_mem_reuse_block(block, row_descriptor()); - vectorized::ColumnsWithTypeAndName tmp_block_columns; + ColumnsWithTypeAndName tmp_block_columns; for (; _const_expr_list_idx < _const_expr_lists.size() && mblock.rows() < state->batch_size(); ++_const_expr_list_idx) { int const_expr_lists_size = cast_set(_const_expr_lists[_const_expr_list_idx].size()); @@ -170,7 +167,7 @@ Status UnionSourceOperatorX::get_next_const(RuntimeState* state, vectorized::Blo RETURN_IF_ERROR(_const_expr_lists[_const_expr_list_idx][i]->execute_const_expr( tmp_block_columns[i])); } - vectorized::Block tmp_block(tmp_block_columns); + Block tmp_block(tmp_block_columns); if (tmp_block.columns() != mblock.columns()) { return Status::InternalError( "[UnionNode]columns count of const expr block not matched ({} vs {})", @@ -186,8 +183,7 @@ Status UnionSourceOperatorX::get_next_const(RuntimeState* state, vectorized::Blo // the const expr will be in output expr cause the union node return a empty block. so here we // need add one row to make sure the union node exec const expr return at least one row if (block->rows() == 0) { - block->insert({vectorized::ColumnUInt8::create(1), - std::make_shared(), ""}); + block->insert({ColumnUInt8::create(1), std::make_shared(), ""}); } return Status::OK(); } @@ -204,6 +200,5 @@ Status UnionSourceLocalState::close(RuntimeState* state) { return Base::close(state); } -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/pipeline/exec/union_source_operator.h b/be/src/exec/operator/union_source_operator.h similarity index 86% rename from be/src/pipeline/exec/union_source_operator.h rename to be/src/exec/operator/union_source_operator.h index af7c8fe321ec89..e4858ea53d8fa3 100644 --- a/be/src/pipeline/exec/union_source_operator.h +++ b/be/src/exec/operator/union_source_operator.h @@ -21,17 +21,14 @@ #include #include "common/status.h" -#include "operator.h" +#include "exec/operator/operator.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace vectorized { class Block; -} // namespace vectorized -namespace pipeline { class DataQueue; class UnionSourceOperatorX; @@ -55,7 +52,7 @@ class UnionSourceLocalState final : public PipelineXLocalState friend class OperatorX; bool _need_read_for_const_expr {true}; int _const_expr_list_idx {0}; - std::vector _const_expr_lists; + std::vector _const_expr_lists; // If this operator has no children, there is no shared state which owns dependency. So we // use this local state to hold this dependency. @@ -72,7 +69,7 @@ class UnionSourceOperatorX MOCK_REMOVE(final) : public OperatorX(Base::prepare(state)); // Prepare const expr lists. - for (const vectorized::VExprContextSPtrs& exprs : _const_expr_lists) { - RETURN_IF_ERROR(vectorized::VExpr::prepare(exprs, state, row_descriptor())); + for (const VExprContextSPtrs& exprs : _const_expr_lists) { + RETURN_IF_ERROR(VExpr::prepare(exprs, state, row_descriptor())); } // open const expr lists. for (const auto& exprs : _const_expr_lists) { - RETURN_IF_ERROR(vectorized::VExpr::open(exprs, state)); + RETURN_IF_ERROR(VExpr::open(exprs, state)); } return Status::OK(); } @@ -140,10 +137,9 @@ class UnionSourceOperatorX MOCK_REMOVE(final) : public OperatorX _const_expr_lists; + Status get_next_const(RuntimeState* state, Block* block); + std::vector _const_expr_lists; }; -} // namespace pipeline #include "common/compile_check_end.h" } // namespace doris \ No newline at end of file diff --git a/be/src/vec/runtime/partitioner.cpp b/be/src/exec/partitioner/partitioner.cpp similarity index 93% rename from be/src/vec/runtime/partitioner.cpp rename to be/src/exec/partitioner/partitioner.cpp index 5095c7a7dbbd37..39914d85d17d07 100644 --- a/be/src/vec/runtime/partitioner.cpp +++ b/be/src/exec/partitioner/partitioner.cpp @@ -15,16 +15,16 @@ // specific language governing permissions and limitations // under the License. -#include "partitioner.h" +#include "exec/partitioner/partitioner.h" #include "common/cast_set.h" #include "common/status.h" -#include "pipeline/local_exchange/local_exchange_sink_operator.h" +#include "core/column/column_const.h" +#include "exec/exchange/local_exchange_sink_operator.h" +#include "exec/exchange/vdata_stream_sender.h" #include "runtime/thread_context.h" -#include "vec/columns/column_const.h" -#include "vec/sink/vdata_stream_sender.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" template @@ -88,4 +88,4 @@ Status Crc32CHashPartitioner::clone(RuntimeState* state, template class Crc32HashPartitioner; template class Crc32HashPartitioner; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/runtime/partitioner.h b/be/src/exec/partitioner/partitioner.h similarity index 97% rename from be/src/vec/runtime/partitioner.h rename to be/src/exec/partitioner/partitioner.h index dfe0e79f988e01..b6a4ab631fdbbd 100644 --- a/be/src/vec/runtime/partitioner.h +++ b/be/src/exec/partitioner/partitioner.h @@ -19,11 +19,11 @@ #include -#include "vec/core/block.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" +#include "core/block/block.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class PartitionerBase { @@ -154,4 +154,4 @@ class Crc32CHashPartitioner : public Crc32HashPartitioner { }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/pipeline/dependency.cpp b/be/src/exec/pipeline/dependency.cpp similarity index 90% rename from be/src/pipeline/dependency.cpp rename to be/src/exec/pipeline/dependency.cpp index 3d60720fd9537c..f38fc5f7684f74 100644 --- a/be/src/pipeline/dependency.cpp +++ b/be/src/exec/pipeline/dependency.cpp @@ -15,27 +15,27 @@ // specific language governing permissions and limitations // under the License. -#include "dependency.h" +#include "exec/pipeline/dependency.h" #include #include #include "common/logging.h" +#include "exec/common/util.hpp" +#include "exec/operator/multi_cast_data_streamer.h" +#include "exec/pipeline/pipeline_fragment_context.h" +#include "exec/pipeline/pipeline_task.h" #include "exec/rowid_fetcher.h" -#include "pipeline/exec/multi_cast_data_streamer.h" -#include "pipeline/pipeline_fragment_context.h" -#include "pipeline/pipeline_task.h" +#include "exec/runtime_filter/runtime_filter_consumer.h" +#include "exec/scan/file_scanner.h" +#include "exec/spill/spill_stream_manager.h" +#include "exprs/vectorized_agg_fn.h" +#include "exprs/vslot_ref.h" #include "runtime/exec_env.h" #include "runtime/memory/mem_tracker.h" -#include "runtime_filter/runtime_filter_consumer.h" #include "util/brpc_client_cache.h" -#include "vec/exec/scan/file_scanner.h" -#include "vec/exprs/vectorized_agg_fn.h" -#include "vec/exprs/vslot_ref.h" -#include "vec/spill/spill_stream_manager.h" -#include "vec/utils/util.hpp" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" Dependency* BasicSharedState::create_source_dependency(int operator_id, int node_id, @@ -159,7 +159,7 @@ void RuntimeFilterTimerQueue::start() { } { std::unique_lock lc(_que_lock); - std::list> new_que; + std::list> new_que; for (auto& it : _que) { if (it.use_count() == 1) { // `use_count == 1` means this runtime filter has been released @@ -204,15 +204,15 @@ LocalExchangeSharedState::LocalExchangeSharedState(int num_instances) { mem_counters.resize(num_instances, nullptr); } -vectorized::MutableColumns AggSharedState::_get_keys_hash_table() { +MutableColumns AggSharedState::_get_keys_hash_table() { return std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) { throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); - return vectorized::MutableColumns(); + return MutableColumns(); }, - [&](auto&& agg_method) -> vectorized::MutableColumns { - vectorized::MutableColumns key_columns; + [&](auto&& agg_method) -> MutableColumns { + MutableColumns key_columns; for (int i = 0; i < probe_expr_ctxs.size(); ++i) { key_columns.emplace_back( probe_expr_ctxs[i]->root()->data_type()->create_column()); @@ -253,7 +253,7 @@ void AggSharedState::build_limit_heap(size_t hash_table_size) { limit_columns_min = limit_heap.top()._row_id; } -bool AggSharedState::do_limit_filter(vectorized::Block* block, size_t num_rows, +bool AggSharedState::do_limit_filter(Block* block, size_t num_rows, const std::vector* key_locs) { if (num_rows) { cmp_res.resize(num_rows); @@ -284,7 +284,7 @@ bool AggSharedState::do_limit_filter(vectorized::Block* block, size_t num_rows, Status AggSharedState::reset_hash_table() { return std::visit( - vectorized::Overload { + Overload { [&](std::monostate& arg) -> Status { return Status::InternalError("Uninited hash table"); }, @@ -304,7 +304,7 @@ Status AggSharedState::reset_hash_table() { if (hash_table.has_null_key_data()) { auto st = _destroy_agg_status(hash_table.template get_null_key_data< - vectorized::AggregateDataPtr>()); + AggregateDataPtr>()); RETURN_IF_ERROR(st); } @@ -343,7 +343,7 @@ void PartitionedAggSharedState::update_spill_stream_profiles(RuntimeProfile* sou Status AggSpillPartition::get_spill_stream(RuntimeState* state, int node_id, RuntimeProfile* profile, - vectorized::SpillStreamSPtr& spill_stream) { + SpillStreamSPtr& spill_stream) { if (spilling_stream_) { spill_stream = spilling_stream_; return Status::OK(); @@ -402,20 +402,20 @@ void SpillSortSharedState::close() { } MultiCastSharedState::MultiCastSharedState(ObjectPool* pool, int cast_sender_count, int node_id) - : multi_cast_data_streamer(std::make_unique( + : multi_cast_data_streamer(std::make_unique( pool, cast_sender_count, node_id)) {} void MultiCastSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {} -int AggSharedState::get_slot_column_id(const vectorized::AggFnEvaluator* evaluator) { +int AggSharedState::get_slot_column_id(const AggFnEvaluator* evaluator) { auto ctxs = evaluator->input_exprs_ctxs(); CHECK(ctxs.size() == 1 && ctxs[0]->root()->is_slot_ref()) << "input_exprs_ctxs is invalid, input_exprs_ctx[0]=" << ctxs[0]->root()->debug_string(); - return ((vectorized::VSlotRef*)ctxs[0]->root().get())->column_id(); + return ((VSlotRef*)ctxs[0]->root().get())->column_id(); } -Status AggSharedState::_destroy_agg_status(vectorized::AggregateDataPtr data) { +Status AggSharedState::_destroy_agg_status(AggregateDataPtr data) { for (int i = 0; i < aggregate_evaluators.size(); ++i) { aggregate_evaluators[i]->function()->destroy(data + offsets_of_aggregate_states[i]); } @@ -424,7 +424,7 @@ Status AggSharedState::_destroy_agg_status(vectorized::AggregateDataPtr data) { LocalExchangeSharedState::~LocalExchangeSharedState() = default; -Status SetSharedState::update_build_not_ignore_null(const vectorized::VExprContextSPtrs& ctxs) { +Status SetSharedState::update_build_not_ignore_null(const VExprContextSPtrs& ctxs) { if (ctxs.size() > build_not_ignore_null.size()) { return Status::InternalError("build_not_ignore_null not initialized"); } @@ -450,12 +450,12 @@ size_t SetSharedState::get_hash_table_size() const { } Status SetSharedState::hash_table_init() { - std::vector data_types; + std::vector data_types; for (size_t i = 0; i != child_exprs_lists[0].size(); ++i) { auto& ctx = child_exprs_lists[0][i]; auto data_type = ctx->root()->data_type(); if (build_not_ignore_null[i]) { - data_type = vectorized::make_nullable(data_type); + data_type = make_nullable(data_type); } data_types.emplace_back(std::move(data_type)); } @@ -463,7 +463,7 @@ Status SetSharedState::hash_table_init() { } void AggSharedState::refresh_top_limit(size_t row_id, - const vectorized::ColumnRawPtrs& key_columns) { + const ColumnRawPtrs& key_columns) { for (int j = 0; j < key_columns.size(); ++j) { limit_columns[j]->insert_from(*key_columns[j], row_id); } @@ -474,4 +474,4 @@ void AggSharedState::refresh_top_limit(size_t row_id, limit_columns_min = limit_heap.top()._row_id; } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/dependency.h b/be/src/exec/pipeline/dependency.h similarity index 90% rename from be/src/pipeline/dependency.h rename to be/src/exec/pipeline/dependency.h index 511606c3d0b723..99bba94d212131 100644 --- a/be/src/pipeline/dependency.h +++ b/be/src/exec/pipeline/dependency.h @@ -23,6 +23,7 @@ #endif #include +#include #include #include @@ -34,26 +35,25 @@ #include "common/config.h" #include "common/logging.h" -#include "gen_cpp/internal_service.pb.h" -#include "pipeline/common/agg_utils.h" -#include "pipeline/common/join_utils.h" -#include "pipeline/common/set_utils.h" -#include "pipeline/exec/data_queue.h" -#include "pipeline/exec/join/process_hash_table_probe.h" +#include "core/block/block.h" +#include "core/types.h" +#include "exec/common/agg_utils.h" +#include "exec/common/join_utils.h" +#include "exec/common/set_utils.h" +#include "exec/operator/data_queue.h" +#include "exec/operator/join/process_hash_table_probe.h" +#include "exec/sort/partition_sorter.h" +#include "exec/sort/sorter.h" +#include "exec/spill/spill_stream.h" #include "util/brpc_closure.h" #include "util/stack_util.h" -#include "vec/common/sort/partition_sorter.h" -#include "vec/common/sort/sorter.h" -#include "vec/core/block.h" -#include "vec/core/types.h" -#include "vec/spill/spill_stream.h" -namespace doris::vectorized { +namespace doris { class AggFnEvaluator; class VSlotRef; -} // namespace doris::vectorized +} // namespace doris -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class Dependency; class PipelineTask; @@ -265,7 +265,7 @@ struct RuntimeFilterTimerQueue { ~RuntimeFilterTimerQueue() = default; RuntimeFilterTimerQueue() { _thread = std::thread(&RuntimeFilterTimerQueue::start, this); } - void push_filter_timer(std::vector>&& filter) { + void push_filter_timer(std::vector>&& filter) { std::unique_lock lc(_que_lock); _que.insert(_que.end(), filter.begin(), filter.end()); cv.notify_all(); @@ -277,7 +277,7 @@ struct RuntimeFilterTimerQueue { std::mutex _que_lock; std::atomic_bool _stop = false; std::atomic_bool _shutdown = false; - std::list> _que; + std::list> _que; }; struct AggSharedState : public BasicSharedState { @@ -294,27 +294,27 @@ struct AggSharedState : public BasicSharedState { Status reset_hash_table(); - bool do_limit_filter(vectorized::Block* block, size_t num_rows, + bool do_limit_filter(Block* block, size_t num_rows, const std::vector* key_locs = nullptr); void build_limit_heap(size_t hash_table_size); // We should call this function only at 1st phase. // 1st phase: is_merge=true, only have one SlotRef. // 2nd phase: is_merge=false, maybe have multiple exprs. - static int get_slot_column_id(const vectorized::AggFnEvaluator* evaluator); + static int get_slot_column_id(const AggFnEvaluator* evaluator); AggregatedDataVariantsUPtr agg_data = nullptr; std::unique_ptr aggregate_data_container; - std::vector aggregate_evaluators; + std::vector aggregate_evaluators; // group by k1,k2 - vectorized::VExprContextSPtrs probe_expr_ctxs; + VExprContextSPtrs probe_expr_ctxs; size_t input_num_rows = 0; - std::vector values; + std::vector values; /// The total size of the row from the aggregate functions. size_t total_size_of_aggregate_states = 0; size_t align_aggregate_states = 1; /// The offset to the n-th aggregate function in a row of aggregate functions. - vectorized::Sizes offsets_of_aggregate_states; + Sizes offsets_of_aggregate_states; std::vector make_nullable_keys; bool agg_data_created_without_key = false; @@ -323,15 +323,15 @@ struct AggSharedState : public BasicSharedState { int64_t limit = -1; bool do_sort_limit = false; - vectorized::MutableColumns limit_columns; + MutableColumns limit_columns; int limit_columns_min = -1; - vectorized::PaddedPODArray need_computes; + PaddedPODArray need_computes; std::vector cmp_res; std::vector order_directions; std::vector null_directions; struct HeapLimitCursor { - HeapLimitCursor(int row_id, vectorized::MutableColumns& limit_columns, + HeapLimitCursor(int row_id, MutableColumns& limit_columns, std::vector& order_directions, std::vector& null_directions) : _row_id(row_id), _limit_columns(limit_columns), @@ -372,7 +372,7 @@ struct AggSharedState : public BasicSharedState { } int _row_id; - vectorized::MutableColumns& _limit_columns; + MutableColumns& _limit_columns; std::vector& _order_directions; std::vector& _null_directions; }; @@ -380,16 +380,16 @@ struct AggSharedState : public BasicSharedState { std::priority_queue limit_heap; // Refresh the top limit heap with a new row - void refresh_top_limit(size_t row_id, const vectorized::ColumnRawPtrs& key_columns); + void refresh_top_limit(size_t row_id, const ColumnRawPtrs& key_columns); - vectorized::Arena agg_arena_pool; - vectorized::Arena agg_profile_arena; + Arena agg_arena_pool; + Arena agg_profile_arena; private: - vectorized::MutableColumns _get_keys_hash_table(); + MutableColumns _get_keys_hash_table(); void _close_with_serialized_key() { - std::visit(vectorized::Overload {[&](std::monostate& arg) -> void { + std::visit(Overload {[&](std::monostate& arg) -> void { // Do nothing }, [&](auto& agg_method) -> void { @@ -403,7 +403,7 @@ struct AggSharedState : public BasicSharedState { if (data.has_null_key_data()) { auto st = _destroy_agg_status( data.template get_null_key_data< - vectorized::AggregateDataPtr>()); + AggregateDataPtr>()); if (!st) { throw Exception(st.code(), st.to_string()); } @@ -421,7 +421,7 @@ struct AggSharedState : public BasicSharedState { agg_data_created_without_key = false; } } - Status _destroy_agg_status(vectorized::AggregateDataPtr data); + Status _destroy_agg_status(AggregateDataPtr data); }; struct BasicSpillSharedState { @@ -478,7 +478,7 @@ struct AggSpillPartition { void close(); Status get_spill_stream(RuntimeState* state, int node_id, RuntimeProfile* profile, - vectorized::SpillStreamSPtr& spilling_stream); + SpillStreamSPtr& spilling_stream); Status flush_if_full() { DCHECK(spilling_stream_); @@ -502,14 +502,14 @@ struct AggSpillPartition { return Status::OK(); } - std::deque spill_streams_; - vectorized::SpillStreamSPtr spilling_stream_; + std::deque spill_streams_; + SpillStreamSPtr spilling_stream_; }; using AggSpillPartitionSPtr = std::shared_ptr; struct SortSharedState : public BasicSharedState { ENABLE_FACTORY_CREATOR(SortSharedState) public: - std::shared_ptr sorter; + std::shared_ptr sorter; }; struct SpillSortSharedState : public BasicSharedState, @@ -520,7 +520,7 @@ struct SpillSortSharedState : public BasicSharedState, SpillSortSharedState() = default; ~SpillSortSharedState() override = default; - void update_spill_block_batch_row_count(RuntimeState* state, const vectorized::Block* block) { + void update_spill_block_batch_row_count(RuntimeState* state, const Block* block) { auto rows = block->rows(); if (rows > 0 && 0 == avg_row_bytes) { avg_row_bytes = std::max((std::size_t)1, block->bytes() / rows); @@ -542,7 +542,7 @@ struct SpillSortSharedState : public BasicSharedState, std::atomic_bool is_closed = false; std::shared_ptr in_mem_shared_state_sptr; - std::deque sorted_streams; + std::deque sorted_streams; size_t avg_row_bytes = 0; size_t spill_block_batch_row_count; }; @@ -569,7 +569,7 @@ struct MultiCastSharedState : public BasicSharedState, public BasicSpillSharedState, public std::enable_shared_from_this { MultiCastSharedState(ObjectPool* pool, int cast_sender_count, int node_id); - std::unique_ptr multi_cast_data_streamer; + std::unique_ptr multi_cast_data_streamer; void update_spill_stream_profiles(RuntimeProfile* source_profile) override; }; @@ -579,11 +579,11 @@ struct AnalyticSharedState : public BasicSharedState { public: AnalyticSharedState() = default; - std::queue blocks_buffer; + std::queue blocks_buffer; std::mutex buffer_mutex; bool sink_eos = false; std::mutex sink_eos_lock; - vectorized::Arena agg_arena_pool; + Arena agg_arena_pool; }; struct JoinSharedState : public BasicSharedState { @@ -609,11 +609,11 @@ struct HashJoinSharedState : public JoinSharedState { hash_table_variant_vector[i] = std::make_shared(); } } - std::shared_ptr arena = std::make_shared(); + std::shared_ptr arena = std::make_shared(); const std::vector build_side_child_desc; size_t build_exprs_size = 0; - std::shared_ptr build_block; + std::shared_ptr build_block; std::shared_ptr> build_indexes_null; // Used by shared hash table @@ -661,8 +661,8 @@ struct PartitionedHashJoinSharedState std::unique_ptr inner_runtime_state; std::shared_ptr inner_shared_state; - std::vector> partitioned_build_blocks; - std::vector spilled_streams; + std::vector> partitioned_build_blocks; + std::vector spilled_streams; bool is_spilled = false; }; @@ -671,17 +671,17 @@ struct NestedLoopJoinSharedState : public JoinSharedState { // if true, left child has no more rows to process bool left_side_eos = false; // Visited flags for each row in build side. - vectorized::MutableColumns build_side_visited_flags; + MutableColumns build_side_visited_flags; // List of build blocks, constructed in prepare() - vectorized::Blocks build_blocks; + Blocks build_blocks; }; struct PartitionSortNodeSharedState : public BasicSharedState { ENABLE_FACTORY_CREATOR(PartitionSortNodeSharedState) public: - std::queue blocks_buffer; + std::queue blocks_buffer; std::mutex buffer_mutex; - std::vector> partition_sorts; + std::vector> partition_sorts; bool sink_eos = false; std::mutex sink_eos_lock; std::mutex prepared_finish_lock; @@ -691,7 +691,7 @@ struct SetSharedState : public BasicSharedState { ENABLE_FACTORY_CREATOR(SetSharedState) public: /// default init - vectorized::Block build_block; // build to source + Block build_block; // build to source //record element size in hashtable int64_t valid_element_in_hash_tbl = 0; //first: idx mapped to column types @@ -707,24 +707,24 @@ struct SetSharedState : public BasicSharedState { // The SET operator's child might have different nullable attributes. // If a calculation involves both nullable and non-nullable columns, the final output should be a nullable column - Status update_build_not_ignore_null(const vectorized::VExprContextSPtrs& ctxs); + Status update_build_not_ignore_null(const VExprContextSPtrs& ctxs); size_t get_hash_table_size() const; /// init in both upstream side. //The i-th result expr list refers to the i-th child. - std::vector child_exprs_lists; + std::vector child_exprs_lists; /// init in build side size_t child_quantity; - vectorized::VExprContextSPtrs build_child_exprs; + VExprContextSPtrs build_child_exprs; std::vector probe_finished_children_dependency; /// init in probe side - std::vector probe_child_exprs_lists; + std::vector probe_child_exprs_lists; std::atomic ready_for_read = false; - vectorized::Arena arena; + Arena arena; /// called in setup_local_state Status hash_table_init(); @@ -838,4 +838,4 @@ struct LocalExchangeSharedState : public BasicSharedState { }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/pipeline.cpp b/be/src/exec/pipeline/pipeline.cpp similarity index 96% rename from be/src/pipeline/pipeline.cpp rename to be/src/exec/pipeline/pipeline.cpp index 774561bbe375ba..78a2cffafad989 100644 --- a/be/src/pipeline/pipeline.cpp +++ b/be/src/exec/pipeline/pipeline.cpp @@ -15,17 +15,17 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline.h" +#include "exec/pipeline/pipeline.h" #include #include #include -#include "pipeline/exec/operator.h" -#include "pipeline/pipeline_fragment_context.h" -#include "pipeline/pipeline_task.h" +#include "exec/operator/operator.h" +#include "exec/pipeline/pipeline_fragment_context.h" +#include "exec/pipeline/pipeline_task.h" -namespace doris::pipeline { +namespace doris { void Pipeline::_init_profile() { auto s = fmt::format("Pipeline (pipeline id={})", _pipeline_id); @@ -135,4 +135,4 @@ void Pipeline::make_all_runnable(PipelineId wake_by) { } } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/pipeline.h b/be/src/exec/pipeline/pipeline.h similarity index 98% rename from be/src/pipeline/pipeline.h rename to be/src/exec/pipeline/pipeline.h index 1d0ddcf178efad..e85c373c411e45 100644 --- a/be/src/pipeline/pipeline.h +++ b/be/src/exec/pipeline/pipeline.h @@ -27,10 +27,10 @@ #include "common/cast_set.h" #include "common/status.h" -#include "pipeline/exec/operator.h" -#include "util/runtime_profile.h" +#include "exec/operator/operator.h" +#include "runtime/runtime_profile.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class PipelineFragmentContext; class Pipeline; @@ -180,4 +180,4 @@ class Pipeline : public std::enable_shared_from_this { const int _num_tasks_of_parent; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/pipeline_fragment_context.cpp b/be/src/exec/pipeline/pipeline_fragment_context.cpp similarity index 95% rename from be/src/pipeline/pipeline_fragment_context.cpp rename to be/src/exec/pipeline/pipeline_fragment_context.cpp index 28fd36b549191d..fc3d83c229de47 100644 --- a/be/src/pipeline/pipeline_fragment_context.cpp +++ b/be/src/exec/pipeline/pipeline_fragment_context.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline_fragment_context.h" +#include "exec/pipeline/pipeline_fragment_context.h" #include #include @@ -39,90 +39,90 @@ #include "common/exception.h" #include "common/logging.h" #include "common/status.h" +#include "exec/exchange/local_exchange_sink_operator.h" +#include "exec/exchange/local_exchange_source_operator.h" +#include "exec/exchange/local_exchanger.h" +#include "exec/exchange/vdata_stream_mgr.h" +#include "exec/operator/aggregation_sink_operator.h" +#include "exec/operator/aggregation_source_operator.h" +#include "exec/operator/analytic_sink_operator.h" +#include "exec/operator/analytic_source_operator.h" +#include "exec/operator/assert_num_rows_operator.h" +#include "exec/operator/blackhole_sink_operator.h" +#include "exec/operator/cache_sink_operator.h" +#include "exec/operator/cache_source_operator.h" +#include "exec/operator/datagen_operator.h" +#include "exec/operator/dict_sink_operator.h" +#include "exec/operator/distinct_streaming_aggregation_operator.h" +#include "exec/operator/empty_set_operator.h" +#include "exec/operator/es_scan_operator.h" +#include "exec/operator/exchange_sink_operator.h" +#include "exec/operator/exchange_source_operator.h" +#include "exec/operator/file_scan_operator.h" +#include "exec/operator/group_commit_block_sink_operator.h" +#include "exec/operator/group_commit_scan_operator.h" +#include "exec/operator/hashjoin_build_sink.h" +#include "exec/operator/hashjoin_probe_operator.h" +#include "exec/operator/hive_table_sink_operator.h" +#include "exec/operator/iceberg_table_sink_operator.h" +#include "exec/operator/jdbc_scan_operator.h" +#include "exec/operator/jdbc_table_sink_operator.h" +#include "exec/operator/local_merge_sort_source_operator.h" +#include "exec/operator/materialization_opertor.h" +#include "exec/operator/maxcompute_table_sink_operator.h" +#include "exec/operator/memory_scratch_sink_operator.h" +#include "exec/operator/meta_scan_operator.h" +#include "exec/operator/multi_cast_data_stream_sink.h" +#include "exec/operator/multi_cast_data_stream_source.h" +#include "exec/operator/nested_loop_join_build_operator.h" +#include "exec/operator/nested_loop_join_probe_operator.h" +#include "exec/operator/olap_scan_operator.h" +#include "exec/operator/olap_table_sink_operator.h" +#include "exec/operator/olap_table_sink_v2_operator.h" +#include "exec/operator/partition_sort_sink_operator.h" +#include "exec/operator/partition_sort_source_operator.h" +#include "exec/operator/partitioned_aggregation_sink_operator.h" +#include "exec/operator/partitioned_aggregation_source_operator.h" +#include "exec/operator/partitioned_hash_join_probe_operator.h" +#include "exec/operator/partitioned_hash_join_sink_operator.h" +#include "exec/operator/repeat_operator.h" +#include "exec/operator/result_file_sink_operator.h" +#include "exec/operator/result_sink_operator.h" +#include "exec/operator/schema_scan_operator.h" +#include "exec/operator/select_operator.h" +#include "exec/operator/set_probe_sink_operator.h" +#include "exec/operator/set_sink_operator.h" +#include "exec/operator/set_source_operator.h" +#include "exec/operator/sort_sink_operator.h" +#include "exec/operator/sort_source_operator.h" +#include "exec/operator/spill_iceberg_table_sink_operator.h" +#include "exec/operator/spill_sort_sink_operator.h" +#include "exec/operator/spill_sort_source_operator.h" +#include "exec/operator/streaming_aggregation_operator.h" +#include "exec/operator/table_function_operator.h" +#include "exec/operator/tvf_table_sink_operator.h" +#include "exec/operator/union_sink_operator.h" +#include "exec/operator/union_source_operator.h" +#include "exec/pipeline/dependency.h" +#include "exec/pipeline/pipeline_task.h" +#include "exec/pipeline/task_scheduler.h" +#include "exec/runtime_filter/runtime_filter_mgr.h" +#include "exec/sort/topn_sorter.h" +#include "exec/spill/spill_stream.h" #include "io/fs/stream_load_pipe.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/aggregation_sink_operator.h" -#include "pipeline/exec/aggregation_source_operator.h" -#include "pipeline/exec/analytic_sink_operator.h" -#include "pipeline/exec/analytic_source_operator.h" -#include "pipeline/exec/assert_num_rows_operator.h" -#include "pipeline/exec/blackhole_sink_operator.h" -#include "pipeline/exec/cache_sink_operator.h" -#include "pipeline/exec/cache_source_operator.h" -#include "pipeline/exec/datagen_operator.h" -#include "pipeline/exec/dict_sink_operator.h" -#include "pipeline/exec/distinct_streaming_aggregation_operator.h" -#include "pipeline/exec/empty_set_operator.h" -#include "pipeline/exec/es_scan_operator.h" -#include "pipeline/exec/exchange_sink_operator.h" -#include "pipeline/exec/exchange_source_operator.h" -#include "pipeline/exec/file_scan_operator.h" -#include "pipeline/exec/group_commit_block_sink_operator.h" -#include "pipeline/exec/group_commit_scan_operator.h" -#include "pipeline/exec/hashjoin_build_sink.h" -#include "pipeline/exec/hashjoin_probe_operator.h" -#include "pipeline/exec/hive_table_sink_operator.h" -#include "pipeline/exec/iceberg_table_sink_operator.h" -#include "pipeline/exec/jdbc_scan_operator.h" -#include "pipeline/exec/jdbc_table_sink_operator.h" -#include "pipeline/exec/local_merge_sort_source_operator.h" -#include "pipeline/exec/materialization_opertor.h" -#include "pipeline/exec/maxcompute_table_sink_operator.h" -#include "pipeline/exec/memory_scratch_sink_operator.h" -#include "pipeline/exec/meta_scan_operator.h" -#include "pipeline/exec/multi_cast_data_stream_sink.h" -#include "pipeline/exec/multi_cast_data_stream_source.h" -#include "pipeline/exec/nested_loop_join_build_operator.h" -#include "pipeline/exec/nested_loop_join_probe_operator.h" -#include "pipeline/exec/olap_scan_operator.h" -#include "pipeline/exec/olap_table_sink_operator.h" -#include "pipeline/exec/olap_table_sink_v2_operator.h" -#include "pipeline/exec/partition_sort_sink_operator.h" -#include "pipeline/exec/partition_sort_source_operator.h" -#include "pipeline/exec/partitioned_aggregation_sink_operator.h" -#include "pipeline/exec/partitioned_aggregation_source_operator.h" -#include "pipeline/exec/partitioned_hash_join_probe_operator.h" -#include "pipeline/exec/partitioned_hash_join_sink_operator.h" -#include "pipeline/exec/repeat_operator.h" -#include "pipeline/exec/result_file_sink_operator.h" -#include "pipeline/exec/result_sink_operator.h" -#include "pipeline/exec/schema_scan_operator.h" -#include "pipeline/exec/select_operator.h" -#include "pipeline/exec/set_probe_sink_operator.h" -#include "pipeline/exec/set_sink_operator.h" -#include "pipeline/exec/set_source_operator.h" -#include "pipeline/exec/sort_sink_operator.h" -#include "pipeline/exec/sort_source_operator.h" -#include "pipeline/exec/spill_iceberg_table_sink_operator.h" -#include "pipeline/exec/spill_sort_sink_operator.h" -#include "pipeline/exec/spill_sort_source_operator.h" -#include "pipeline/exec/streaming_aggregation_operator.h" -#include "pipeline/exec/table_function_operator.h" -#include "pipeline/exec/tvf_table_sink_operator.h" -#include "pipeline/exec/union_sink_operator.h" -#include "pipeline/exec/union_source_operator.h" -#include "pipeline/local_exchange/local_exchange_sink_operator.h" -#include "pipeline/local_exchange/local_exchange_source_operator.h" -#include "pipeline/local_exchange/local_exchanger.h" -#include "pipeline/task_scheduler.h" -#include "pipeline_task.h" +#include "load/stream_load/new_load_stream_mgr.h" #include "runtime/exec_env.h" #include "runtime/fragment_mgr.h" #include "runtime/result_block_buffer.h" #include "runtime/result_buffer_mgr.h" #include "runtime/runtime_state.h" -#include "runtime/stream_load/new_load_stream_mgr.h" #include "runtime/thread_context.h" -#include "runtime_filter/runtime_filter_mgr.h" #include "service/backend_options.h" #include "util/countdown_latch.h" #include "util/debug_util.h" #include "util/uid_util.h" -#include "vec/common/sort/topn_sorter.h" -#include "vec/runtime/vdata_stream_mgr.h" -#include "vec/spill/spill_stream.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" PipelineFragmentContext::PipelineFragmentContext( TUniqueId query_id, const TPipelineFragmentParams& request, @@ -1921,7 +1921,7 @@ size_t PipelineFragmentContext::get_revocable_size(bool* has_running_task) const } size_t revocable_size = task.first->get_revocable_size(); - if (revocable_size >= vectorized::SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { + if (revocable_size >= SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { res += revocable_size; } } @@ -1934,7 +1934,7 @@ std::vector PipelineFragmentContext::get_revocable_tasks() const for (const auto& task_instances : _tasks) { for (const auto& task : task_instances) { size_t revocable_size_ = task.first->get_revocable_size(); - if (revocable_size_ >= vectorized::SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { + if (revocable_size_ >= SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { revocable_tasks.emplace_back(task.first.get()); } } @@ -2021,4 +2021,4 @@ PipelineFragmentContext::collect_realtime_load_channel_profile() const { return load_channel_profile; } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/pipeline_fragment_context.h b/be/src/exec/pipeline/pipeline_fragment_context.h similarity index 98% rename from be/src/pipeline/pipeline_fragment_context.h rename to be/src/exec/pipeline/pipeline_fragment_context.h index 98486f303315ba..3c530da1baa53c 100644 --- a/be/src/pipeline/pipeline_fragment_context.h +++ b/be/src/exec/pipeline/pipeline_fragment_context.h @@ -30,12 +30,12 @@ #include #include "common/status.h" -#include "pipeline/pipeline.h" -#include "pipeline/pipeline_task.h" +#include "exec/pipeline/pipeline.h" +#include "exec/pipeline/pipeline_task.h" #include "runtime/query_context.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" #include "runtime/task_execution_context.h" -#include "util/runtime_profile.h" #include "util/stopwatch.hpp" namespace doris { @@ -45,8 +45,6 @@ class RuntimeFilterMergeControllerEntity; class TDataSink; class TPipelineFragmentParams; -namespace pipeline { - class Dependency; class PipelineFragmentContext : public TaskExecutionContext { @@ -59,7 +57,7 @@ class PipelineFragmentContext : public TaskExecutionContext { // functions like PrettyPrint() or to_thrift(), neither of which is const // because they take locks. using report_status_callback = std::function&&)>; + const ReportStatusRequest, std::shared_ptr&&)>; PipelineFragmentContext(TUniqueId query_id, const TPipelineFragmentParams& request, std::shared_ptr query_ctx, ExecEnv* exec_env, const std::function& call_back, @@ -328,5 +326,4 @@ class PipelineFragmentContext : public TaskExecutionContext { TPipelineFragmentParams _params; int32_t _parallel_instances = 0; }; -} // namespace pipeline } // namespace doris diff --git a/be/src/pipeline/pipeline_task.cpp b/be/src/exec/pipeline/pipeline_task.cpp similarity index 97% rename from be/src/pipeline/pipeline_task.cpp rename to be/src/exec/pipeline/pipeline_task.cpp index dbe52cbabc0d99..6bcfd9b3c5c896 100644 --- a/be/src/pipeline/pipeline_task.cpp +++ b/be/src/exec/pipeline/pipeline_task.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline_task.h" +#include "exec/pipeline/pipeline_task.h" #include #include @@ -29,31 +29,32 @@ #include "common/logging.h" #include "common/status.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/operator.h" -#include "pipeline/exec/scan_operator.h" -#include "pipeline/pipeline.h" -#include "pipeline/pipeline_fragment_context.h" -#include "pipeline/task_queue.h" -#include "pipeline/task_scheduler.h" -#include "revokable_task.h" +#include "core/block/block.h" +#include "exec/operator/exchange_source_operator.h" +#include "exec/operator/operator.h" +#include "exec/operator/scan_operator.h" +#include "exec/pipeline/dependency.h" +#include "exec/pipeline/pipeline.h" +#include "exec/pipeline/pipeline_fragment_context.h" +#include "exec/pipeline/revokable_task.h" +#include "exec/pipeline/task_queue.h" +#include "exec/pipeline/task_scheduler.h" +#include "exec/spill/spill_stream.h" #include "runtime/descriptors.h" #include "runtime/exec_env.h" #include "runtime/query_context.h" +#include "runtime/runtime_profile.h" #include "runtime/thread_context.h" #include "runtime/workload_group/workload_group_manager.h" #include "util/defer_op.h" #include "util/mem_info.h" -#include "util/runtime_profile.h" #include "util/uid_util.h" -#include "vec/core/block.h" -#include "vec/spill/spill_stream.h" namespace doris { class RuntimeState; } // namespace doris -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" PipelineTask::PipelineTask(PipelinePtr& pipeline, uint32_t task_id, RuntimeState* state, @@ -163,7 +164,7 @@ Status PipelineTask::prepare(const std::vector& scan_range, co } else { return Status::InternalError("Fragment already finished! Query: {}", print_id(_query_id)); } - _block = doris::vectorized::Block::create_unique(); + _block = doris::Block::create_unique(); return _state_transition(State::RUNNABLE); } @@ -654,7 +655,7 @@ bool PipelineTask::_try_to_reserve_memory(const size_t reserve_size, OperatorBas COUNTER_UPDATE(_memory_reserve_times, 1); auto sink_revocable_mem_size = _sink->revocable_mem_size(_state); if (st.ok() && _state->enable_force_spill() && _sink->is_spillable() && - sink_revocable_mem_size >= vectorized::SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { + sink_revocable_mem_size >= SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { st = Status(ErrorCode::QUERY_MEMORY_EXCEEDED, "Force Spill"); } if (!st.ok()) { @@ -691,7 +692,7 @@ bool PipelineTask::_try_to_reserve_memory(const size_t reserve_size, OperatorBas // build hash table directly and will consume a lot of memory. So that should return false directly. // TODO: we should using a global system buffer management logic to deal with low memory mode. /** - if (sink_revocable_mem_size >= vectorized::SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { + if (sink_revocable_mem_size >= SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { LOG(INFO) << fmt::format( "Query: {} sink: {}, node id: {}, task id: " "{}, revocable mem size: {}", @@ -864,7 +865,7 @@ Status PipelineTask::revoke_memory(const std::shared_ptr& spill_co } const auto revocable_size = _sink->revocable_mem_size(_state); - if (revocable_size >= vectorized::SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { + if (revocable_size >= SpillStream::MIN_SPILL_WRITE_BATCH_MEM) { auto revokable_task = std::make_shared(shared_from_this(), spill_context); RETURN_IF_ERROR(_state->get_query_ctx()->get_pipe_exec_scheduler()->submit(revokable_task)); } else { @@ -902,4 +903,4 @@ Status PipelineTask::_state_transition(State new_state) { } #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/pipeline_task.h b/be/src/exec/pipeline/pipeline_task.h similarity index 97% rename from be/src/pipeline/pipeline_task.h rename to be/src/exec/pipeline/pipeline_task.h index 8d5bd6e99efb2c..cb89673b2c04b1 100644 --- a/be/src/pipeline/pipeline_task.h +++ b/be/src/exec/pipeline/pipeline_task.h @@ -23,23 +23,21 @@ #include #include "common/status.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/operator.h" -#include "pipeline/exec/spill_utils.h" -#include "pipeline/pipeline.h" -#include "util/runtime_profile.h" +#include "core/block/block.h" +#include "exec/operator/operator.h" +#include "exec/operator/spill_utils.h" +#include "exec/pipeline/dependency.h" +#include "exec/pipeline/pipeline.h" +#include "runtime/runtime_profile.h" #include "util/stopwatch.hpp" -#include "vec/core/block.h" namespace doris { class QueryContext; class RuntimeState; -namespace pipeline { class PipelineFragmentContext; -} // namespace pipeline } // namespace doris -namespace doris::pipeline { +namespace doris { class MultiCoreTaskQueue; class PriorityTaskQueue; @@ -209,7 +207,7 @@ class PipelineTask : public std::enable_shared_from_this { RuntimeState* _state = nullptr; int _thread_id = -1; uint32_t _schedule_time = 0; - std::unique_ptr _block; + std::unique_ptr _block; std::weak_ptr _fragment_context; @@ -323,4 +321,4 @@ class PipelineTask : public std::enable_shared_from_this { using PipelineTaskSPtr = std::shared_ptr; -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/pipeline_tracing.cpp b/be/src/exec/pipeline/pipeline_tracing.cpp similarity index 98% rename from be/src/pipeline/pipeline_tracing.cpp rename to be/src/exec/pipeline/pipeline_tracing.cpp index b58649beb2fc03..4ce26f3bcd621e 100644 --- a/be/src/pipeline/pipeline_tracing.cpp +++ b/be/src/exec/pipeline/pipeline_tracing.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "pipeline_tracing.h" +#include "exec/pipeline/pipeline_tracing.h" #include #include @@ -33,7 +33,7 @@ #include "io/fs/local_file_writer.h" #include "util/time.h" -namespace doris::pipeline { +namespace doris { void PipelineTracerContext::record(ScheduleRecord record) { if (_dump_type == RecordType::None) [[unlikely]] { @@ -178,4 +178,4 @@ void PipelineTracerContext::_dump_timeslice() { _id_to_workload_group.clear(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/pipeline_tracing.h b/be/src/exec/pipeline/pipeline_tracing.h similarity index 98% rename from be/src/pipeline/pipeline_tracing.h rename to be/src/exec/pipeline/pipeline_tracing.h index d52c4d73b928e6..72c29f95cc9d8d 100644 --- a/be/src/pipeline/pipeline_tracing.h +++ b/be/src/exec/pipeline/pipeline_tracing.h @@ -32,7 +32,7 @@ #include "util/thrift_util.h" #include "util/time.h" -namespace doris::pipeline { +namespace doris { struct ScheduleRecord { TUniqueId query_id; @@ -106,4 +106,4 @@ class PipelineTracerContext { decltype(MonotonicSeconds()) _dump_interval_s = 60; // effective iff Periodic mode. 1 minute default. }; -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/revokable_task.h b/be/src/exec/pipeline/revokable_task.h similarity index 90% rename from be/src/pipeline/revokable_task.h rename to be/src/exec/pipeline/revokable_task.h index d4d253c2703422..c2cc728f49b696 100644 --- a/be/src/pipeline/revokable_task.h +++ b/be/src/exec/pipeline/revokable_task.h @@ -21,17 +21,15 @@ #include #include "common/status.h" -#include "pipeline/dependency.h" -#include "pipeline/exec/operator.h" -#include "pipeline/exec/spill_utils.h" -#include "pipeline/pipeline.h" -#include "pipeline/pipeline_task.h" -#include "pipeline_task.h" +#include "exec/operator/operator.h" +#include "exec/operator/spill_utils.h" +#include "exec/pipeline/dependency.h" +#include "exec/pipeline/pipeline.h" +#include "exec/pipeline/pipeline_task.h" namespace doris { class RuntimeState; -namespace pipeline { class PipelineFragmentContext; class RevokableTask : public PipelineTask { @@ -72,5 +70,4 @@ class RevokableTask : public PipelineTask { std::shared_ptr _spill_context; }; -} // namespace pipeline } // namespace doris \ No newline at end of file diff --git a/be/src/pipeline/task_queue.cpp b/be/src/exec/pipeline/task_queue.cpp similarity index 98% rename from be/src/pipeline/task_queue.cpp rename to be/src/exec/pipeline/task_queue.cpp index 81d09bc2455320..db20c7c12fd3d2 100644 --- a/be/src/pipeline/task_queue.cpp +++ b/be/src/exec/pipeline/task_queue.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "task_queue.h" +#include "exec/pipeline/task_queue.h" // IWYU pragma: no_include #include // IWYU pragma: keep @@ -23,10 +23,10 @@ #include #include "common/logging.h" -#include "pipeline/pipeline_task.h" +#include "exec/pipeline/pipeline_task.h" #include "runtime/workload_group/workload_group.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" PipelineTaskSPtr SubTaskQueue::try_take(bool is_steal) { @@ -213,4 +213,4 @@ void MultiCoreTaskQueue::update_statistics(PipelineTask* task, int64_t time_spen } } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/task_queue.h b/be/src/exec/pipeline/task_queue.h similarity index 97% rename from be/src/pipeline/task_queue.h rename to be/src/exec/pipeline/task_queue.h index b3f867fa2a6079..49796dbcbed250 100644 --- a/be/src/pipeline/task_queue.h +++ b/be/src/exec/pipeline/task_queue.h @@ -29,9 +29,9 @@ #include #include "common/status.h" -#include "pipeline_task.h" +#include "exec/pipeline/pipeline_task.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" class SubTaskQueue { @@ -137,4 +137,4 @@ class MultiCoreTaskQueue { static constexpr auto WAIT_CORE_TASK_TIMEOUT_MS = 100; }; #include "common/compile_check_end.h" -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/task_scheduler.cpp b/be/src/exec/pipeline/task_scheduler.cpp similarity index 97% rename from be/src/pipeline/task_scheduler.cpp rename to be/src/exec/pipeline/task_scheduler.cpp index 228335d1aa0ba1..20931c03aa05cd 100644 --- a/be/src/pipeline/task_scheduler.cpp +++ b/be/src/exec/pipeline/task_scheduler.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "task_scheduler.h" +#include "exec/pipeline/task_scheduler.h" #include #include @@ -37,8 +37,9 @@ #include "common/logging.h" #include "common/status.h" -#include "pipeline/pipeline_task.h" -#include "pipeline_fragment_context.h" +#include "core/value/vdatetime_value.h" +#include "exec/pipeline/pipeline_fragment_context.h" +#include "exec/pipeline/pipeline_task.h" #include "runtime/exec_env.h" #include "runtime/query_context.h" #include "runtime/thread_context.h" @@ -46,9 +47,8 @@ #include "util/threadpool.h" #include "util/time.h" #include "util/uid_util.h" -#include "vec/runtime/vdatetime_value.h" -namespace doris::pipeline { +namespace doris { #include "common/compile_check_begin.h" TaskScheduler::~TaskScheduler() { stop(); @@ -207,4 +207,4 @@ void HybridTaskScheduler::stop() { _simple_scheduler.stop(); } -} // namespace doris::pipeline +} // namespace doris diff --git a/be/src/pipeline/task_scheduler.h b/be/src/exec/pipeline/task_scheduler.h similarity index 96% rename from be/src/pipeline/task_scheduler.h rename to be/src/exec/pipeline/task_scheduler.h index 269116b5e4fca8..08d07318f896d9 100644 --- a/be/src/pipeline/task_scheduler.h +++ b/be/src/exec/pipeline/task_scheduler.h @@ -28,10 +28,10 @@ #include #include "common/status.h" -#include "pipeline_task.h" +#include "exec/pipeline/pipeline_task.h" +#include "exec/pipeline/task_queue.h" #include "runtime/query_context.h" #include "runtime/workload_group/workload_group.h" -#include "task_queue.h" #include "util/thread.h" #include "util/uid_util.h" @@ -40,7 +40,7 @@ class ExecEnv; class ThreadPool; } // namespace doris -namespace doris::pipeline { +namespace doris { class HybridTaskScheduler; class TaskScheduler { @@ -101,4 +101,4 @@ class HybridTaskScheduler MOCK_REMOVE(final) : public TaskScheduler { TaskScheduler _blocking_scheduler; TaskScheduler _simple_scheduler; }; -} // namespace doris::pipeline \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/exec/rowid_fetcher.cpp b/be/src/exec/rowid_fetcher.cpp index 5f4338a16316ff..6321bad767c099 100644 --- a/be/src/exec/rowid_fetcher.cpp +++ b/be/src/exec/rowid_fetcher.cpp @@ -46,37 +46,35 @@ #include "common/consts.h" #include "common/exception.h" #include "common/signal_handler.h" -#include "exec/tablet_info.h" // DorisNodesInfo -#include "olap/olap_common.h" -#include "olap/rowset/beta_rowset.h" -#include "olap/storage_engine.h" -#include "olap/tablet_fwd.h" -#include "olap/tablet_manager.h" -#include "olap/tablet_schema.h" -#include "olap/utils.h" +#include "core/assert_cast.h" +#include "core/block/block.h" // Block +#include "core/column/column.h" +#include "core/column/column_nullable.h" +#include "core/column/column_string.h" +#include "core/data_type/data_type_struct.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "exec/scan/file_scanner.h" +#include "format/orc/vorc_reader.h" +#include "format/parquet/vparquet_reader.h" #include "runtime/descriptors.h" #include "runtime/exec_env.h" // ExecEnv #include "runtime/fragment_mgr.h" // FragmentMgr #include "runtime/runtime_state.h" // RuntimeState -#include "runtime/types.h" #include "runtime/workload_group/workload_group_manager.h" #include "semaphore" +#include "storage/olap_common.h" +#include "storage/rowset/beta_rowset.h" +#include "storage/segment/column_reader.h" +#include "storage/storage_engine.h" +#include "storage/tablet/tablet_fwd.h" +#include "storage/tablet/tablet_schema.h" +#include "storage/tablet_info.h" // DorisNodesInfo +#include "storage/utils.h" #include "util/brpc_client_cache.h" // BrpcClientCache #include "util/defer_op.h" -#include "vec/columns/column.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_string.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_ref.h" -#include "vec/core/block.h" // Block -#include "vec/data_types/data_type_factory.hpp" -#include "vec/data_types/data_type_struct.h" -#include "vec/data_types/serde/data_type_serde.h" -#include "vec/exec/format/orc/vorc_reader.h" -#include "vec/exec/format/parquet/vparquet_reader.h" -#include "vec/exec/scan/file_scanner.h" -#include "vec/functions/function_helpers.h" -#include "vec/jsonb/serialize.h" +#include "util/jsonb/serialize.h" namespace doris { @@ -99,7 +97,7 @@ Status RowIDFetcher::init() { return Status::OK(); } -PMultiGetRequest RowIDFetcher::_init_fetch_request(const vectorized::ColumnString& row_locs) const { +PMultiGetRequest RowIDFetcher::_init_fetch_request(const ColumnString& row_locs) const { PMultiGetRequest mget_req; _fetch_option.desc->to_protobuf(mget_req.mutable_desc()); for (SlotDescriptor* slot : _fetch_option.desc->slots()) { @@ -137,7 +135,7 @@ PMultiGetRequest RowIDFetcher::_init_fetch_request(const vectorized::ColumnStrin Status RowIDFetcher::_merge_rpc_results(const PMultiGetRequest& request, const std::vector& rsps, const std::vector& cntls, - vectorized::Block* output_block, + Block* output_block, std::vector* rows_id) const { output_block->clear(); for (const auto& cntl : cntls) { @@ -147,7 +145,7 @@ Status RowIDFetcher::_merge_rpc_results(const PMultiGetRequest& request, return Status::InternalError(cntl.ErrorText()); } } - vectorized::DataTypeSerDeSPtrs serdes; + DataTypeSerDeSPtrs serdes; std::unordered_map col_uid_to_idx; std::vector default_values; default_values.resize(_fetch_option.desc->slots().size()); @@ -164,24 +162,24 @@ Status RowIDFetcher::_merge_rpc_results(const PMultiGetRequest& request, if (request.fetch_row_store()) { CHECK(resp.row_locs().size() == resp.binary_row_data_size()); if (output_block->is_empty_column()) { - *output_block = vectorized::Block(_fetch_option.desc->slots(), 1); + *output_block = Block(_fetch_option.desc->slots(), 1); } if (serdes.empty() && col_uid_to_idx.empty()) { - serdes = vectorized::create_data_type_serdes(_fetch_option.desc->slots()); + serdes = create_data_type_serdes(_fetch_option.desc->slots()); for (int i = 0; i < _fetch_option.desc->slots().size(); ++i) { col_uid_to_idx[_fetch_option.desc->slots()[i]->col_unique_id()] = i; default_values[i] = _fetch_option.desc->slots()[i]->col_default_value(); } } for (int i = 0; i < resp.binary_row_data_size(); ++i) { - RETURN_IF_ERROR(vectorized::JsonbSerializeUtil::jsonb_to_block( + RETURN_IF_ERROR(JsonbSerializeUtil::jsonb_to_block( serdes, resp.binary_row_data(i).data(), resp.binary_row_data(i).size(), col_uid_to_idx, *output_block, default_values, {})); } return Status::OK(); } // Merge partial blocks - vectorized::Block partial_block; + Block partial_block; [[maybe_unused]] size_t uncompressed_size = 0; [[maybe_unused]] int64_t uncompressed_time = 0; @@ -215,39 +213,34 @@ Status RowIDFetcher::_merge_rpc_results(const PMultiGetRequest& request, return Status::OK(); } -bool _has_char_type(const vectorized::DataTypePtr& type) { +bool _has_char_type(const DataTypePtr& type) { switch (type->get_primitive_type()) { case TYPE_CHAR: { return true; } case TYPE_ARRAY: { - const auto* arr_type = - assert_cast(remove_nullable(type).get()); + const auto* arr_type = assert_cast(remove_nullable(type).get()); return _has_char_type(arr_type->get_nested_type()); } case TYPE_MAP: { - const auto* map_type = - assert_cast(remove_nullable(type).get()); + const auto* map_type = assert_cast(remove_nullable(type).get()); return _has_char_type(map_type->get_key_type()) || _has_char_type(map_type->get_value_type()); } case TYPE_STRUCT: { - const auto* struct_type = - assert_cast(remove_nullable(type).get()); - return std::any_of( - struct_type->get_elements().begin(), struct_type->get_elements().end(), - [&](const vectorized::DataTypePtr& dt) -> bool { return _has_char_type(dt); }); + const auto* struct_type = assert_cast(remove_nullable(type).get()); + return std::any_of(struct_type->get_elements().begin(), struct_type->get_elements().end(), + [&](const DataTypePtr& dt) -> bool { return _has_char_type(dt); }); } default: return false; } } -Status RowIDFetcher::fetch(const vectorized::ColumnPtr& column_row_ids, - vectorized::Block* res_block) { +Status RowIDFetcher::fetch(const ColumnPtr& column_row_ids, Block* res_block) { CHECK(!_stubs.empty()); - PMultiGetRequest mget_req = _init_fetch_request(assert_cast( - *vectorized::remove_nullable(column_row_ids).get())); + PMultiGetRequest mget_req = _init_fetch_request( + assert_cast(*remove_nullable(column_row_ids).get())); std::vector resps(_stubs.size()); std::vector cntls(_stubs.size()); bthread::CountdownEvent counter(cast_set(_stubs.size())); @@ -280,7 +273,7 @@ Status RowIDFetcher::fetch(const vectorized::ColumnPtr& column_row_ids, if (positions.size() < rows_locs.size()) { LOG(WARNING) << "cwntains duplicated row entry"; } - vectorized::IColumn::Permutation permutation; + IColumn::Permutation permutation; permutation.reserve(column_row_ids->size()); for (size_t i = 0; i < column_row_ids->size(); ++i) { auto location = @@ -375,7 +368,7 @@ Status RowIdStorageReader::read_by_rowids(const PMultiGetRequest& request, PMultiGetResponse* response) { // read from storage engine row id by row id OlapReaderStatistics stats; - vectorized::Block result_block; + Block result_block; int64_t acquire_tablet_ms = 0; int64_t acquire_rowsets_ms = 0; int64_t acquire_segments_ms = 0; @@ -466,7 +459,7 @@ Status RowIdStorageReader::read_by_rowids(const PMultiGetRequest& request, // fetch by column store if (result_block.is_empty_column()) { - result_block = vectorized::Block(slots, request.row_locs().size()); + result_block = Block(slots, request.row_locs().size()); } VLOG_DEBUG << "Read row location " << fmt::format("{}, {}, {}, {}", row_location.tablet_id, @@ -475,8 +468,7 @@ Status RowIdStorageReader::read_by_rowids(const PMultiGetRequest& request, row_location.row_location.row_id); for (int x = 0; x < slots.size(); ++x) { auto row_id = static_cast(row_loc.ordinal_id()); - vectorized::MutableColumnPtr column = - result_block.get_by_position(x).column->assume_mutable(); + MutableColumnPtr column = result_block.get_by_position(x).column->assume_mutable(); IteratorKey iterator_key {.tablet_id = tablet->tablet_id(), .rowset_id = rowset_id, .segment_id = row_loc.segment_id(), @@ -528,7 +520,7 @@ Status RowIdStorageReader::read_by_rowids(const PMultiGetRequestV2& request, if (request.request_block_descs_size()) { auto tquery_id = ((UniqueId)request.query_id()).to_thrift(); // todo: use mutableBlock instead of block - std::vector result_blocks(request.request_block_descs_size()); + std::vector result_blocks(request.request_block_descs_size()); OlapReaderStatistics stats; int64_t acquire_tablet_ms = 0; @@ -651,11 +643,11 @@ Status RowIdStorageReader::read_by_rowids(const PMultiGetRequestV2& request, Status RowIdStorageReader::read_batch_doris_format_row( const PRequestBlockDesc& request_block_desc, std::shared_ptr id_file_map, - std::vector& slots, const TUniqueId& query_id, - vectorized::Block& result_block, OlapReaderStatistics& stats, int64_t* acquire_tablet_ms, - int64_t* acquire_rowsets_ms, int64_t* acquire_segments_ms, int64_t* lookup_row_data_ms) { + std::vector& slots, const TUniqueId& query_id, Block& result_block, + OlapReaderStatistics& stats, int64_t* acquire_tablet_ms, int64_t* acquire_rowsets_ms, + int64_t* acquire_segments_ms, int64_t* lookup_row_data_ms) { if (result_block.is_empty_column()) [[likely]] { - result_block = vectorized::Block(slots, request_block_desc.row_id_size()); + result_block = Block(slots, request_block_desc.row_id_size()); } TabletSchema full_read_schema; for (const ColumnPB& column_pb : request_block_desc.column_descs()) { @@ -716,8 +708,7 @@ Status RowIdStorageReader::read_external_row_from_file_mapping( size_t idx, const std::multimap& row_ids, const std::shared_ptr& file_mapping, const std::vector& slots, const TUniqueId& query_id, const std::shared_ptr& runtime_state, - std::vector& scan_blocks, - std::vector>& row_id_block_idx, + std::vector& scan_blocks, std::vector>& row_id_block_idx, std::vector& fetch_statistics, const TFileScanRangeParams& rpc_scan_params, const std::unordered_map& colname_to_slot_id, @@ -736,7 +727,7 @@ Status RowIdStorageReader::read_external_row_from_file_mapping( row_id_block_idx[result_block_idx] = std::make_pair(idx, read_ids.size() - 1); } - scan_blocks[idx] = vectorized::Block(slots, read_ids.size()); + scan_blocks[idx] = Block(slots, read_ids.size()); auto& external_info = file_mapping->get_external_file_info(); auto& scan_range_desc = external_info.scan_range_desc; @@ -750,10 +741,9 @@ Status RowIdStorageReader::read_external_row_from_file_mapping( std::unique_ptr sub_runtime_profile = std::make_unique("ExternalRowIDFetcher"); { - std::unique_ptr vfile_scanner_ptr = - vectorized::FileScanner::create_unique(runtime_state.get(), - sub_runtime_profile.get(), &rpc_scan_params, - &colname_to_slot_id, &tuple_desc); + std::unique_ptr vfile_scanner_ptr = + FileScanner::create_unique(runtime_state.get(), sub_runtime_profile.get(), + &rpc_scan_params, &colname_to_slot_id, &tuple_desc); RETURN_IF_ERROR(vfile_scanner_ptr->prepare_for_read_lines(scan_range_desc)); RETURN_IF_ERROR(vfile_scanner_ptr->read_lines_from_range( @@ -762,7 +752,7 @@ Status RowIdStorageReader::read_external_row_from_file_mapping( } auto file_read_bytes_counter = - sub_runtime_profile->get_counter(vectorized::FileScanner::FileReadBytesProfile); + sub_runtime_profile->get_counter(FileScanner::FileReadBytesProfile); if (file_read_bytes_counter != nullptr) { fetch_statistics[idx].file_read_bytes = PrettyPrinter::print( @@ -770,7 +760,7 @@ Status RowIdStorageReader::read_external_row_from_file_mapping( } auto file_read_times_counter = - sub_runtime_profile->get_counter(vectorized::FileScanner::FileReadTimeProfile); + sub_runtime_profile->get_counter(FileScanner::FileReadTimeProfile); if (file_read_times_counter != nullptr) { fetch_statistics[idx].file_read_times = PrettyPrinter::print( file_read_times_counter->value(), file_read_times_counter->type()); @@ -788,7 +778,7 @@ Status RowIdStorageReader::read_batch_external_row( const uint64_t workload_group_id, const PRequestBlockDesc& request_block_desc, std::shared_ptr id_file_map, std::vector& slots, std::shared_ptr first_file_mapping, const TUniqueId& query_id, - vectorized::Block& result_block, PRuntimeProfileTree* pprofile, int64_t* init_reader_avg_ms, + Block& result_block, PRuntimeProfileTree* pprofile, int64_t* init_reader_avg_ms, int64_t* get_block_avg_ms, size_t* scan_range_cnt) { TFileScanRangeParams rpc_scan_params; TupleDescriptor tuple_desc(request_block_desc.desc(), false); @@ -798,7 +788,7 @@ Status RowIdStorageReader::read_batch_external_row( int max_file_scanners = 0; { if (result_block.is_empty_column()) [[likely]] { - result_block = vectorized::Block(slots, request_block_desc.row_id_size()); + result_block = Block(slots, request_block_desc.row_id_size()); } auto& external_info = first_file_mapping->get_external_file_info(); @@ -857,7 +847,7 @@ Status RowIdStorageReader::read_batch_external_row( scan_rows; // Block corresponding to the order of `scan_rows` map. - std::vector scan_blocks; + std::vector scan_blocks; // row_id (Indexing of vectors) => < In which block, which line in the block > std::vector> row_id_block_idx; @@ -905,9 +895,9 @@ Status RowIdStorageReader::read_batch_external_row( std::vector workload_group_ids; workload_group_ids.emplace_back(workload_group_id); auto wg = ExecEnv::GetInstance()->workload_group_mgr()->get_group(workload_group_ids); - doris::pipeline::TaskScheduler* exec_sched = nullptr; - vectorized::ScannerScheduler* scan_sched = nullptr; - vectorized::ScannerScheduler* remote_scan_sched = nullptr; + doris::TaskScheduler* exec_sched = nullptr; + ScannerScheduler* scan_sched = nullptr; + ScannerScheduler* remote_scan_sched = nullptr; wg->get_query_scheduler(&exec_sched, &scan_sched, &remote_scan_sched); DCHECK(remote_scan_sched); @@ -926,7 +916,7 @@ Status RowIdStorageReader::read_batch_external_row( for (const auto& [_, scan_info] : scan_rows) { semaphore.acquire(); RETURN_IF_ERROR(remote_scan_sched->submit_scan_task( - vectorized::SimplifiedScanTask( + SimplifiedScanTask( [&, idx, scan_info]() -> Status { const auto& [row_ids, file_mapping] = scan_info; return read_external_row_from_file_mapping( @@ -953,10 +943,9 @@ Status RowIdStorageReader::read_batch_external_row( for (size_t column_id = 0; column_id < result_block.get_columns().size(); column_id++) { // The non-const Block(result_block) is passed in read_by_rowids, but columns[i] in get_columns // is at bottom an immutable_ptr of Cow, so use const_cast - auto dst_col = - const_cast(result_block.get_columns()[column_id].get()); + auto dst_col = const_cast(result_block.get_columns()[column_id].get()); - std::vector scan_src_columns; + std::vector scan_src_columns; scan_src_columns.reserve(row_id_block_idx.size()); std::vector scan_positions; scan_positions.reserve(row_id_block_idx.size()); @@ -1004,9 +993,9 @@ Status RowIdStorageReader::read_batch_external_row( std::to_string(*init_reader_avg_ms) + "ms"); runtime_profile->add_info_string(FileReadLinesProfile, fmt::to_string(file_read_lines_buffer)); - runtime_profile->add_info_string(vectorized::FileScanner::FileReadBytesProfile, + runtime_profile->add_info_string(FileScanner::FileReadBytesProfile, fmt::to_string(file_read_bytes_buffer)); - runtime_profile->add_info_string(vectorized::FileScanner::FileReadTimeProfile, + runtime_profile->add_info_string(FileScanner::FileReadTimeProfile, fmt::to_string(file_read_times_buffer)); } @@ -1025,7 +1014,7 @@ Status RowIdStorageReader::read_doris_format_row( int64_t* acquire_tablet_ms, int64_t* acquire_rowsets_ms, int64_t* acquire_segments_ms, int64_t* lookup_row_data_ms, std::unordered_map& seg_map, std::unordered_map& iterator_map, - vectorized::Block& result_block) { + Block& result_block) { auto [tablet_id, rowset_id, segment_id] = file_mapping->get_doris_format_info(); SegKey seg_key {.tablet_id = tablet_id, .rowset_id = rowset_id, .segment_id = segment_id}; @@ -1103,7 +1092,7 @@ Status RowIdStorageReader::read_doris_format_row( }, lookup_row_data_ms)); - RETURN_IF_ERROR(vectorized::JsonbSerializeUtil::jsonb_to_block( + RETURN_IF_ERROR(JsonbSerializeUtil::jsonb_to_block( row_store_read_struct.serdes, row_store_read_struct.row_store_buffer.data(), row_store_read_struct.row_store_buffer.size(), row_store_read_struct.col_uid_to_idx, result_block, @@ -1111,8 +1100,7 @@ Status RowIdStorageReader::read_doris_format_row( } } else { for (int x = 0; x < slots.size(); ++x) { - vectorized::MutableColumnPtr column = - result_block.get_by_position(x).column->assume_mutable(); + MutableColumnPtr column = result_block.get_by_position(x).column->assume_mutable(); IteratorKey iterator_key {.tablet_id = tablet_id, .rowset_id = rowset_id, .segment_id = segment_id, diff --git a/be/src/exec/rowid_fetcher.h b/be/src/exec/rowid_fetcher.h index 99f515b31a7e58..7641103666922b 100644 --- a/be/src/exec/rowid_fetcher.h +++ b/be/src/exec/rowid_fetcher.h @@ -28,10 +28,10 @@ #include #include "common/status.h" -#include "exec/tablet_info.h" // DorisNodesInfo -#include "olap/id_manager.h" -#include "vec/core/block.h" -#include "vec/data_types/data_type.h" +#include "core/block/block.h" +#include "core/data_type/data_type.h" +#include "storage/id_manager.h" +#include "storage/tablet_info.h" // DorisNodesInfo namespace doris { @@ -51,12 +51,10 @@ inline void fetch_callback(bthread::CountdownEvent* counter) { Defer __defer([&] { counter->signal(); }); } -namespace vectorized { template class ColumnStr; using ColumnString = ColumnStr; class MutableBlock; -} // namespace vectorized // fetch rows by global rowid // tablet_id/rowset_name/segment_id/ordinal_id @@ -71,14 +69,13 @@ class RowIDFetcher { public: RowIDFetcher(FetchOption fetch_opt) : _fetch_option(std::move(fetch_opt)) {} Status init(); - Status fetch(const vectorized::ColumnPtr& row_ids, vectorized::Block* block); + Status fetch(const ColumnPtr& row_ids, Block* block); private: - PMultiGetRequest _init_fetch_request(const vectorized::ColumnString& row_ids) const; + PMultiGetRequest _init_fetch_request(const ColumnString& row_ids) const; Status _merge_rpc_results(const PMultiGetRequest& request, const std::vector& rsps, - const std::vector& cntls, - vectorized::Block* output_block, + const std::vector& cntls, Block* output_block, std::vector* rows_id) const; std::vector> _stubs; @@ -88,7 +85,7 @@ class RowIDFetcher { struct RowStoreReadStruct { RowStoreReadStruct(std::string& buffer) : row_store_buffer(buffer) {}; std::string& row_store_buffer; - vectorized::DataTypeSerDeSPtrs serdes; + DataTypeSerDeSPtrs serdes; std::unordered_map col_uid_to_idx; std::vector default_values; }; @@ -115,28 +112,26 @@ class RowIdStorageReader { int64_t* acquire_tablet_ms, int64_t* acquire_rowsets_ms, int64_t* acquire_segments_ms, int64_t* lookup_row_data_ms, std::unordered_map& seg_map, std::unordered_map& iterator_map, - vectorized::Block& result_block); + Block& result_block); static Status read_batch_doris_format_row( const PRequestBlockDesc& request_block_desc, std::shared_ptr id_file_map, - std::vector& slots, const TUniqueId& query_id, - vectorized::Block& result_block, OlapReaderStatistics& stats, - int64_t* acquire_tablet_ms, int64_t* acquire_rowsets_ms, int64_t* acquire_segments_ms, - int64_t* lookup_row_data_ms); + std::vector& slots, const TUniqueId& query_id, Block& result_block, + OlapReaderStatistics& stats, int64_t* acquire_tablet_ms, int64_t* acquire_rowsets_ms, + int64_t* acquire_segments_ms, int64_t* lookup_row_data_ms); static Status read_batch_external_row( const uint64_t workload_group_id, const PRequestBlockDesc& request_block_desc, std::shared_ptr id_file_map, std::vector& slots, std::shared_ptr first_file_mapping, const TUniqueId& query_id, - vectorized::Block& result_block, PRuntimeProfileTree* pprofile, - int64_t* init_reader_avg_ms, int64_t* get_block_avg_ms, size_t* scan_range_cnt); + Block& result_block, PRuntimeProfileTree* pprofile, int64_t* init_reader_avg_ms, + int64_t* get_block_avg_ms, size_t* scan_range_cnt); static Status read_external_row_from_file_mapping( size_t idx, const std::multimap& row_ids, const std::shared_ptr& file_mapping, const std::vector& slots, const TUniqueId& query_id, - const std::shared_ptr& runtime_state, - std::vector& scan_blocks, + const std::shared_ptr& runtime_state, std::vector& scan_blocks, std::vector>& row_id_block_idx, std::vector& fetch_statistics, const TFileScanRangeParams& rpc_scan_params, diff --git a/be/src/runtime_filter/runtime_filter.cpp b/be/src/exec/runtime_filter/runtime_filter.cpp similarity index 93% rename from be/src/runtime_filter/runtime_filter.cpp rename to be/src/exec/runtime_filter/runtime_filter.cpp index 5a367441407ff6..418434278341dc 100644 --- a/be/src/runtime_filter/runtime_filter.cpp +++ b/be/src/exec/runtime_filter/runtime_filter.cpp @@ -15,14 +15,14 @@ // specific language governing permissions and limitations // under the License. -#include "runtime_filter/runtime_filter.h" +#include "exec/runtime_filter/runtime_filter.h" #include "common/status.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" #include "runtime/runtime_state.h" #include "util/brpc_client_cache.h" #include "util/brpc_closure.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" namespace doris { #include "common/compile_check_begin.h" @@ -75,8 +75,8 @@ Status RuntimeFilter::_push_to_remote(RuntimeState* state, const TNetworkAddress Status RuntimeFilter::_init_with_desc(const TRuntimeFilterDesc* desc, const TQueryOptions* options) { - vectorized::VExprContextSPtr build_ctx; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(desc->src_expr, build_ctx)); + VExprContextSPtr build_ctx; + RETURN_IF_ERROR(VExpr::create_expr_tree(desc->src_expr, build_ctx)); RuntimeFilterParams params; params.filter_id = desc->filter_id; @@ -109,9 +109,8 @@ Status RuntimeFilter::_init_with_desc(const TRuntimeFilterDesc* desc, if (!desc->__isset.bitmap_target_expr) { return Status::InternalError("Unknown bitmap filter target expr."); } - vectorized::VExprContextSPtr bitmap_target_ctx; - RETURN_IF_ERROR( - vectorized::VExpr::create_expr_tree(desc->bitmap_target_expr, bitmap_target_ctx)); + VExprContextSPtr bitmap_target_ctx; + RETURN_IF_ERROR(VExpr::create_expr_tree(desc->bitmap_target_expr, bitmap_target_ctx)); params.column_return_type = bitmap_target_ctx->root()->data_type()->get_primitive_type(); if (desc->__isset.bitmap_filter_not_in) { diff --git a/be/src/runtime_filter/runtime_filter.h b/be/src/exec/runtime_filter/runtime_filter.h similarity index 96% rename from be/src/runtime_filter/runtime_filter.h rename to be/src/exec/runtime_filter/runtime_filter.h index 2605dd305190eb..82d27cbbed2aba 100644 --- a/be/src/runtime_filter/runtime_filter.h +++ b/be/src/exec/runtime_filter/runtime_filter.h @@ -21,10 +21,10 @@ #include "common/exception.h" #include "common/status.h" +#include "exec/runtime_filter/runtime_filter_definitions.h" +#include "exec/runtime_filter/runtime_filter_wrapper.h" +#include "exec/runtime_filter/utils.h" #include "runtime/query_context.h" -#include "runtime_filter/runtime_filter_definitions.h" -#include "runtime_filter/runtime_filter_wrapper.h" -#include "runtime_filter/utils.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/runtime_filter/runtime_filter_consumer.cpp b/be/src/exec/runtime_filter/runtime_filter_consumer.cpp similarity index 82% rename from be/src/runtime_filter/runtime_filter_consumer.cpp rename to be/src/exec/runtime_filter/runtime_filter_consumer.cpp index d72c6af7c8dd74..a953b37bb7a4e8 100644 --- a/be/src/runtime_filter/runtime_filter_consumer.cpp +++ b/be/src/exec/runtime_filter/runtime_filter_consumer.cpp @@ -15,18 +15,18 @@ // specific language governing permissions and limitations // under the License. -#include "runtime_filter/runtime_filter_consumer.h" +#include "exec/runtime_filter/runtime_filter_consumer.h" #include "exprs/minmax_predicate.h" -#include "util/runtime_profile.h" -#include "vec/exprs/vbitmap_predicate.h" -#include "vec/exprs/vbloom_predicate.h" -#include "vec/exprs/vdirect_in_predicate.h" +#include "exprs/vbitmap_predicate.h" +#include "exprs/vbloom_predicate.h" +#include "exprs/vdirect_in_predicate.h" +#include "runtime/runtime_profile.h" namespace doris { #include "common/compile_check_begin.h" Status RuntimeFilterConsumer::_apply_ready_expr( - std::vector& push_exprs) { + std::vector& push_exprs) { _check_state({State::READY}); _set_state(State::APPLIED); @@ -44,7 +44,7 @@ Status RuntimeFilterConsumer::_apply_ready_expr( return Status::OK(); } -Status RuntimeFilterConsumer::acquire_expr(std::vector& push_exprs) { +Status RuntimeFilterConsumer::acquire_expr(std::vector& push_exprs) { std::unique_lock l(_rmtx); if (_rf_state == State::READY) { RETURN_IF_ERROR(_apply_ready_expr(push_exprs)); @@ -66,20 +66,20 @@ void RuntimeFilterConsumer::signal(RuntimeFilter* other) { } } -std::shared_ptr RuntimeFilterConsumer::create_filter_timer( - std::shared_ptr dependencies) { +std::shared_ptr RuntimeFilterConsumer::create_filter_timer( + std::shared_ptr dependencies) { std::unique_lock l(_rmtx); - auto timer = std::make_shared(_registration_time, + auto timer = std::make_shared(_registration_time, _rf_wait_time_ms, dependencies); _filter_timer.push_back(timer); return timer; } -Status RuntimeFilterConsumer::_get_push_exprs(std::vector& container, +Status RuntimeFilterConsumer::_get_push_exprs(std::vector& container, const TExpr& probe_expr) { // TODO: `VExprContextSPtr` is not need, we should just create an expr. - vectorized::VExprContextSPtr probe_ctx; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(probe_expr, probe_ctx)); + VExprContextSPtr probe_ctx; + RETURN_IF_ERROR(VExpr::create_expr_tree(probe_expr, probe_ctx)); auto real_filter_type = _wrapper->get_real_type(); bool null_aware = _wrapper->contain_null(); @@ -102,9 +102,9 @@ Status RuntimeFilterConsumer::_get_push_exprs(std::vectorhybrid_set()); + auto in_pred = VDirectInPredicate::create_shared(node, _wrapper->hybrid_set()); in_pred->add_child(probe_ctx->root()); - auto wrapper = vectorized::VRuntimeFilterWrapper::create_shared( + auto wrapper = VRuntimeFilterWrapper::create_shared( node, in_pred, get_in_list_ignore_thredhold(_wrapper->hybrid_set()->size()), null_aware, _wrapper->filter_id()); container.push_back(wrapper); @@ -112,67 +112,67 @@ Status RuntimeFilterConsumer::_get_push_exprs(std::vectorroot()->data_type(), TExprOpcode::GE, min_pred, &min_pred_node, null_aware)); - vectorized::VExprSPtr min_literal; + VExprSPtr min_literal; RETURN_IF_ERROR(create_literal(probe_ctx->root()->data_type(), _wrapper->minmax_func()->get_min(), min_literal)); min_pred->add_child(probe_ctx->root()); min_pred->add_child(min_literal); DCHECK(null_aware == false) << "only min predicate do not support null aware"; - container.push_back(vectorized::VRuntimeFilterWrapper::create_shared( + container.push_back(VRuntimeFilterWrapper::create_shared( min_pred_node, min_pred, get_comparison_ignore_thredhold(), null_aware, _wrapper->filter_id())); break; } case RuntimeFilterType::MAX_FILTER: { - vectorized::VExprSPtr max_pred; + VExprSPtr max_pred; // create max filter TExprNode max_pred_node; RETURN_IF_ERROR(create_vbin_predicate(probe_ctx->root()->data_type(), TExprOpcode::LE, max_pred, &max_pred_node, null_aware)); - vectorized::VExprSPtr max_literal; + VExprSPtr max_literal; RETURN_IF_ERROR(create_literal(probe_ctx->root()->data_type(), _wrapper->minmax_func()->get_max(), max_literal)); max_pred->add_child(probe_ctx->root()); max_pred->add_child(max_literal); DCHECK(null_aware == false) << "only max predicate do not support null aware"; - container.push_back(vectorized::VRuntimeFilterWrapper::create_shared( + container.push_back(VRuntimeFilterWrapper::create_shared( max_pred_node, max_pred, get_comparison_ignore_thredhold(), null_aware, _wrapper->filter_id())); break; } case RuntimeFilterType::MINMAX_FILTER: { - vectorized::VExprSPtr max_pred; + VExprSPtr max_pred; // create max filter TExprNode max_pred_node; RETURN_IF_ERROR(create_vbin_predicate(probe_ctx->root()->data_type(), TExprOpcode::LE, max_pred, &max_pred_node, null_aware)); - vectorized::VExprSPtr max_literal; + VExprSPtr max_literal; RETURN_IF_ERROR(create_literal(probe_ctx->root()->data_type(), _wrapper->minmax_func()->get_max(), max_literal)); max_pred->add_child(probe_ctx->root()); max_pred->add_child(max_literal); - container.push_back(vectorized::VRuntimeFilterWrapper::create_shared( + container.push_back(VRuntimeFilterWrapper::create_shared( max_pred_node, max_pred, get_comparison_ignore_thredhold(), null_aware, _wrapper->filter_id())); - vectorized::VExprContextSPtr new_probe_ctx; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(probe_expr, new_probe_ctx)); + VExprContextSPtr new_probe_ctx; + RETURN_IF_ERROR(VExpr::create_expr_tree(probe_expr, new_probe_ctx)); // create min filter - vectorized::VExprSPtr min_pred; + VExprSPtr min_pred; TExprNode min_pred_node; RETURN_IF_ERROR(create_vbin_predicate(new_probe_ctx->root()->data_type(), TExprOpcode::GE, min_pred, &min_pred_node, null_aware)); - vectorized::VExprSPtr min_literal; + VExprSPtr min_literal; RETURN_IF_ERROR(create_literal(new_probe_ctx->root()->data_type(), _wrapper->minmax_func()->get_min(), min_literal)); min_pred->add_child(new_probe_ctx->root()); min_pred->add_child(min_literal); - container.push_back(vectorized::VRuntimeFilterWrapper::create_shared( + container.push_back(VRuntimeFilterWrapper::create_shared( min_pred_node, min_pred, get_comparison_ignore_thredhold(), null_aware, _wrapper->filter_id())); break; @@ -186,10 +186,10 @@ Status RuntimeFilterConsumer::_get_push_exprs(std::vectorset_filter(_wrapper->bloom_filter_func()); bloom_pred->add_child(probe_ctx->root()); - auto wrapper = vectorized::VRuntimeFilterWrapper::create_shared( + auto wrapper = VRuntimeFilterWrapper::create_shared( node, bloom_pred, get_bloom_filter_ignore_thredhold(), null_aware, _wrapper->filter_id()); container.push_back(wrapper); @@ -204,11 +204,11 @@ Status RuntimeFilterConsumer::_get_push_exprs(std::vectorset_filter(_wrapper->bitmap_filter_func()); bitmap_pred->add_child(probe_ctx->root()); DCHECK(null_aware == false) << "bitmap predicate do not support null aware"; - auto wrapper = vectorized::VRuntimeFilterWrapper::create_shared( + auto wrapper = VRuntimeFilterWrapper::create_shared( node, bitmap_pred, 0, null_aware, _wrapper->filter_id()); container.push_back(wrapper); break; diff --git a/be/src/runtime_filter/runtime_filter_consumer.h b/be/src/exec/runtime_filter/runtime_filter_consumer.h similarity index 91% rename from be/src/runtime_filter/runtime_filter_consumer.h rename to be/src/exec/runtime_filter/runtime_filter_consumer.h index 0e832b412ee0bd..fd0176904cce15 100644 --- a/be/src/runtime_filter/runtime_filter_consumer.h +++ b/be/src/exec/runtime_filter/runtime_filter_consumer.h @@ -22,10 +22,10 @@ #include #include -#include "pipeline/dependency.h" +#include "exec/pipeline/dependency.h" +#include "exec/runtime_filter/runtime_filter.h" #include "runtime/query_context.h" -#include "runtime_filter/runtime_filter.h" -#include "util/runtime_profile.h" +#include "runtime/runtime_profile.h" namespace doris { #include "common/compile_check_begin.h" @@ -52,11 +52,11 @@ class RuntimeFilterConsumer : public RuntimeFilter { // Published by producer. void signal(RuntimeFilter* other); - std::shared_ptr create_filter_timer( - std::shared_ptr dependencies); + std::shared_ptr create_filter_timer( + std::shared_ptr dependencies); // Called after `State` is ready (e.g. signaled) - Status acquire_expr(std::vector& push_exprs); + Status acquire_expr(std::vector& push_exprs); std::string debug_string() override { std::unique_lock l(_rmtx); @@ -102,10 +102,9 @@ class RuntimeFilterConsumer : public RuntimeFilter { DorisMetrics::instance()->runtime_filter_consumer_num->increment(1); } - Status _apply_ready_expr(std::vector& push_exprs); + Status _apply_ready_expr(std::vector& push_exprs); - Status _get_push_exprs(std::vector& container, - const TExpr& probe_expr); + Status _get_push_exprs(std::vector& container, const TExpr& probe_expr); void _check_state(std::vector assumed_states) { if (!check_state_impl(_rf_state, assumed_states)) { throw Exception(ErrorCode::INTERNAL_ERROR, @@ -136,7 +135,7 @@ class RuntimeFilterConsumer : public RuntimeFilter { TExpr _probe_expr; - std::vector> _filter_timer; + std::vector> _filter_timer; std::shared_ptr _wait_timer = std::make_shared(TUnit::TIME_NS, 0); diff --git a/be/src/runtime_filter/runtime_filter_consumer_helper.cpp b/be/src/exec/runtime_filter/runtime_filter_consumer_helper.cpp similarity index 80% rename from be/src/runtime_filter/runtime_filter_consumer_helper.cpp rename to be/src/exec/runtime_filter/runtime_filter_consumer_helper.cpp index 3e920b33a6db8e..1b93e791c53c2a 100644 --- a/be/src/runtime_filter/runtime_filter_consumer_helper.cpp +++ b/be/src/exec/runtime_filter/runtime_filter_consumer_helper.cpp @@ -15,10 +15,10 @@ // specific language governing permissions and limitations // under the License. -#include "runtime_filter/runtime_filter_consumer_helper.h" +#include "exec/runtime_filter/runtime_filter_consumer_helper.h" -#include "runtime_filter/runtime_filter_consumer.h" -#include "util/runtime_profile.h" +#include "exec/runtime_filter/runtime_filter_consumer.h" +#include "runtime/runtime_profile.h" namespace doris { #include "common/compile_check_begin.h" @@ -26,9 +26,10 @@ RuntimeFilterConsumerHelper::RuntimeFilterConsumerHelper( const std::vector& runtime_filters) : _runtime_filter_descs(runtime_filters) {} -Status RuntimeFilterConsumerHelper::init( - RuntimeState* state, bool need_local_merge, int32_t node_id, int32_t operator_id, - std::vector>& dependencies, const std::string& name) { +Status RuntimeFilterConsumerHelper::init(RuntimeState* state, bool need_local_merge, + int32_t node_id, int32_t operator_id, + std::vector>& dependencies, + const std::string& name) { for (const auto& desc : _runtime_filter_descs) { std::shared_ptr filter; RETURN_IF_ERROR( @@ -37,11 +38,11 @@ Status RuntimeFilterConsumerHelper::init( } dependencies.resize(_runtime_filter_descs.size()); - std::vector> runtime_filter_timers( + std::vector> runtime_filter_timers( _runtime_filter_descs.size()); - std::vector> local_dependencies; + std::vector> local_dependencies; for (size_t i = 0; i < _consumers.size(); ++i) { - dependencies[i] = std::make_shared(operator_id, node_id, name); + dependencies[i] = std::make_shared(operator_id, node_id, name); runtime_filter_timers[i] = _consumers[i]->create_filter_timer(dependencies[i]); if (!_consumers[i]->has_remote_target()) { local_dependencies.emplace_back(dependencies[i]); @@ -64,10 +65,10 @@ Status RuntimeFilterConsumerHelper::init( } Status RuntimeFilterConsumerHelper::acquire_runtime_filter(RuntimeState* state, - vectorized::VExprContextSPtrs& conjuncts, + VExprContextSPtrs& conjuncts, const RowDescriptor& row_descriptor) { SCOPED_TIMER(_acquire_runtime_filter_timer.get()); - std::vector vexprs; + std::vector vexprs; for (const auto& consumer : _consumers) { RETURN_IF_ERROR(consumer->acquire_expr(vexprs)); if (!consumer->is_applied()) { @@ -79,14 +80,14 @@ Status RuntimeFilterConsumerHelper::acquire_runtime_filter(RuntimeState* state, } Status RuntimeFilterConsumerHelper::_append_rf_into_conjuncts( - RuntimeState* state, const std::vector& vexprs, - vectorized::VExprContextSPtrs& conjuncts, const RowDescriptor& row_descriptor) { + RuntimeState* state, const std::vector& vexprs, + VExprContextSPtrs& conjuncts, const RowDescriptor& row_descriptor) { if (vexprs.empty()) { return Status::OK(); } for (const auto& expr : vexprs) { - vectorized::VExprContextSPtr conjunct = vectorized::VExprContext::create_shared(expr); + VExprContextSPtr conjunct = VExprContext::create_shared(expr); RETURN_IF_ERROR(conjunct->prepare(state, row_descriptor)); RETURN_IF_ERROR(conjunct->open(state)); conjuncts.emplace_back(conjunct); @@ -97,7 +98,7 @@ Status RuntimeFilterConsumerHelper::_append_rf_into_conjuncts( Status RuntimeFilterConsumerHelper::try_append_late_arrival_runtime_filter( RuntimeState* state, const RowDescriptor& row_descriptor, int& arrived_rf_num, - vectorized::VExprContextSPtrs& arrived_conjuncts) { + VExprContextSPtrs& arrived_conjuncts) { if (_is_all_rf_applied) { arrived_rf_num = cast_set(_runtime_filter_descs.size()); return Status::OK(); @@ -112,7 +113,7 @@ Status RuntimeFilterConsumerHelper::try_append_late_arrival_runtime_filter( } // 1. Check if are runtime filter ready but not applied. - std::vector exprs; + std::vector exprs; int current_arrived_rf_num = 0; for (const auto& consumer : _consumers) { RETURN_IF_ERROR(consumer->acquire_expr(exprs)); diff --git a/be/src/runtime_filter/runtime_filter_consumer_helper.h b/be/src/exec/runtime_filter/runtime_filter_consumer_helper.h similarity index 82% rename from be/src/runtime_filter/runtime_filter_consumer_helper.h rename to be/src/exec/runtime_filter/runtime_filter_consumer_helper.h index e69fff0e7c5636..d56e387f2152c2 100644 --- a/be/src/runtime_filter/runtime_filter_consumer_helper.h +++ b/be/src/exec/runtime_filter/runtime_filter_consumer_helper.h @@ -19,9 +19,9 @@ #include -#include "pipeline/dependency.h" -#include "util/runtime_profile.h" -#include "vec/exprs/vruntimefilter_wrapper.h" +#include "exec/pipeline/dependency.h" +#include "exprs/vruntimefilter_wrapper.h" +#include "runtime/runtime_profile.h" namespace doris { #include "common/compile_check_begin.h" @@ -35,11 +35,10 @@ class RuntimeFilterConsumerHelper { ~RuntimeFilterConsumerHelper() = default; Status init(RuntimeState* state, bool need_local_merge, int32_t node_id, int32_t operator_id, - std::vector>& dependencies, - const std::string& name); + std::vector>& dependencies, const std::string& name); // Get all arrived runtime filters at Open phase which will be push down to storage. // Called by Operator. - Status acquire_runtime_filter(RuntimeState* state, vectorized::VExprContextSPtrs& conjuncts, + Status acquire_runtime_filter(RuntimeState* state, VExprContextSPtrs& conjuncts, const RowDescriptor& row_descriptor); // The un-arrival filters will be checked every time the scanner is scheduled. // And once new runtime filters arrived, we will use it to do operator's filtering. @@ -47,7 +46,7 @@ class RuntimeFilterConsumerHelper { Status try_append_late_arrival_runtime_filter(RuntimeState* state, const RowDescriptor& row_descriptor, int& arrived_rf_num, - vectorized::VExprContextSPtrs& arrived_conjuncts); + VExprContextSPtrs& arrived_conjuncts); // Called by XXXLocalState::close() // parent_operator_profile is owned by LocalState so update it is safe at here. @@ -58,8 +57,8 @@ class RuntimeFilterConsumerHelper { private: // Append late-arrival runtime filters to the vconjunct_ctx. Status _append_rf_into_conjuncts(RuntimeState* state, - const std::vector& vexprs, - vectorized::VExprContextSPtrs& conjuncts, + const std::vector& vexprs, + VExprContextSPtrs& conjuncts, const RowDescriptor& row_descriptor); std::vector> _consumers; diff --git a/be/src/runtime_filter/runtime_filter_definitions.h b/be/src/exec/runtime_filter/runtime_filter_definitions.h similarity index 97% rename from be/src/runtime_filter/runtime_filter_definitions.h rename to be/src/exec/runtime_filter/runtime_filter_definitions.h index c2c588fa353e78..d1be13a692f1be 100644 --- a/be/src/runtime_filter/runtime_filter_definitions.h +++ b/be/src/exec/runtime_filter/runtime_filter_definitions.h @@ -17,7 +17,7 @@ #pragma once -#include "runtime/define_primitive_type.h" +#include "core/data_type/define_primitive_type.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/runtime_filter/runtime_filter_merger.h b/be/src/exec/runtime_filter/runtime_filter_merger.h similarity index 93% rename from be/src/runtime_filter/runtime_filter_merger.h rename to be/src/exec/runtime_filter/runtime_filter_merger.h index 00bac84547389a..4c5ae8bb1822d0 100644 --- a/be/src/runtime_filter/runtime_filter_merger.h +++ b/be/src/exec/runtime_filter/runtime_filter_merger.h @@ -17,10 +17,10 @@ #pragma once -#include "runtime_filter/runtime_filter.h" -#include "runtime_filter/runtime_filter_definitions.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" +#include "exec/runtime_filter/runtime_filter.h" +#include "exec/runtime_filter/runtime_filter_definitions.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" namespace doris { #include "common/compile_check_begin.h" @@ -38,8 +38,8 @@ class RuntimeFilterMerger : public RuntimeFilter { static Status create(const QueryContext* query_ctx, const TRuntimeFilterDesc* desc, std::shared_ptr* res) { *res = std::shared_ptr(new RuntimeFilterMerger(query_ctx, desc)); - vectorized::VExprContextSPtr build_ctx; - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(desc->src_expr, build_ctx)); + VExprContextSPtr build_ctx; + RETURN_IF_ERROR(VExpr::create_expr_tree(desc->src_expr, build_ctx)); (*res)->_wrapper = std::make_shared( build_ctx->root()->data_type()->get_primitive_type(), (*res)->_runtime_filter_type, desc->filter_id, RuntimeFilterWrapper::State::UNINITED); diff --git a/be/src/runtime_filter/runtime_filter_mgr.cpp b/be/src/exec/runtime_filter/runtime_filter_mgr.cpp similarity index 98% rename from be/src/runtime_filter/runtime_filter_mgr.cpp rename to be/src/exec/runtime_filter/runtime_filter_mgr.cpp index b3c1cfa6c93c86..5f1dd60f960cc1 100644 --- a/be/src/runtime_filter/runtime_filter_mgr.cpp +++ b/be/src/exec/runtime_filter/runtime_filter_mgr.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "runtime_filter/runtime_filter_mgr.h" +#include "exec/runtime_filter/runtime_filter_mgr.h" #include #include @@ -32,15 +32,15 @@ #include "common/config.h" #include "common/logging.h" #include "common/status.h" +#include "exec/runtime_filter/runtime_filter.h" +#include "exec/runtime_filter/runtime_filter_consumer.h" +#include "exec/runtime_filter/runtime_filter_merger.h" +#include "exec/runtime_filter/runtime_filter_producer.h" #include "runtime/exec_env.h" #include "runtime/memory/mem_tracker.h" #include "runtime/query_context.h" #include "runtime/runtime_state.h" #include "runtime/thread_context.h" -#include "runtime_filter/runtime_filter.h" -#include "runtime_filter/runtime_filter_consumer.h" -#include "runtime_filter/runtime_filter_merger.h" -#include "runtime_filter/runtime_filter_producer.h" #include "util/brpc_client_cache.h" #include "util/brpc_closure.h" diff --git a/be/src/runtime_filter/runtime_filter_mgr.h b/be/src/exec/runtime_filter/runtime_filter_mgr.h similarity index 99% rename from be/src/runtime_filter/runtime_filter_mgr.h rename to be/src/exec/runtime_filter/runtime_filter_mgr.h index 2dcea3f7a4a6cb..c680c646610919 100644 --- a/be/src/runtime_filter/runtime_filter_mgr.h +++ b/be/src/exec/runtime_filter/runtime_filter_mgr.h @@ -34,7 +34,6 @@ #include #include "common/status.h" -#include "util/runtime_profile.h" #include "util/uid_util.h" namespace butil { @@ -54,7 +53,6 @@ class RuntimeState; class RuntimeFilterWrapper; class QueryContext; class ExecEnv; -class RuntimeProfile; struct LocalMergeContext { std::mutex mtx; diff --git a/be/src/runtime_filter/runtime_filter_producer.cpp b/be/src/exec/runtime_filter/runtime_filter_producer.cpp similarity index 94% rename from be/src/runtime_filter/runtime_filter_producer.cpp rename to be/src/exec/runtime_filter/runtime_filter_producer.cpp index da5fbca15a9f2b..e1a1616e44ebe6 100644 --- a/be/src/runtime_filter/runtime_filter_producer.cpp +++ b/be/src/exec/runtime_filter/runtime_filter_producer.cpp @@ -15,13 +15,13 @@ // specific language governing permissions and limitations // under the License. -#include "runtime_filter/runtime_filter_producer.h" +#include "exec/runtime_filter/runtime_filter_producer.h" #include -#include "runtime_filter/runtime_filter_consumer.h" -#include "runtime_filter/runtime_filter_merger.h" -#include "runtime_filter/runtime_filter_wrapper.h" +#include "exec/runtime_filter/runtime_filter_consumer.h" +#include "exec/runtime_filter/runtime_filter_merger.h" +#include "exec/runtime_filter/runtime_filter_wrapper.h" #include "util/brpc_client_cache.h" #include "util/brpc_closure.h" @@ -92,7 +92,7 @@ Status RuntimeFilterProducer::publish(RuntimeState* state, bool build_hash_table class SyncSizeClosure : public AutoReleaseClosure> { - std::shared_ptr _dependency; + std::shared_ptr _dependency; // Should use weak ptr here, because when query context deconstructs, should also delete runtime filter // context, it not the memory is not released. And rpc is in another thread, it will hold rf context // after query context because the rpc is not returned. @@ -105,7 +105,7 @@ class SyncSizeClosure : public AutoReleaseClosuresub(); + ((CountedFinishDependency*)_dependency.get())->sub(); }}; auto wrapper = _wrapper.lock(); if (!wrapper) { @@ -118,7 +118,7 @@ class SyncSizeClosure : public AutoReleaseClosuresub(); + ((CountedFinishDependency*)_dependency.get())->sub(); }}; auto wrapper = _wrapper.lock(); if (!wrapper) { @@ -131,14 +131,14 @@ class SyncSizeClosure : public AutoReleaseClosure req, std::shared_ptr> callback, - std::shared_ptr dependency, + std::shared_ptr dependency, std::shared_ptr wrapper, std::weak_ptr context) : Base(req, callback, context), _dependency(std::move(dependency)), _wrapper(wrapper) {} }; void RuntimeFilterProducer::latch_dependency( - const std::shared_ptr& dependency) { + const std::shared_ptr& dependency) { std::unique_lock l(_rmtx); if (_rf_state != State::WAITING_FOR_SEND_SIZE) { return; diff --git a/be/src/runtime_filter/runtime_filter_producer.h b/be/src/exec/runtime_filter/runtime_filter_producer.h similarity index 95% rename from be/src/runtime_filter/runtime_filter_producer.h rename to be/src/exec/runtime_filter/runtime_filter_producer.h index a21697c7005003..433396144a5209 100644 --- a/be/src/runtime_filter/runtime_filter_producer.h +++ b/be/src/exec/runtime_filter/runtime_filter_producer.h @@ -19,10 +19,10 @@ #include -#include "pipeline/dependency.h" +#include "exec/pipeline/dependency.h" +#include "exec/runtime_filter/runtime_filter.h" #include "runtime/query_context.h" -#include "runtime_filter/runtime_filter.h" -#include "util/runtime_profile.h" +#include "runtime/runtime_profile.h" namespace doris { #include "common/compile_check_begin.h" @@ -57,10 +57,10 @@ class RuntimeFilterProducer : public RuntimeFilter { Status send_size(RuntimeState* state, uint64_t local_filter_size); - void latch_dependency(const std::shared_ptr& dependency); + void latch_dependency(const std::shared_ptr& dependency); // insert data to build filter - Status insert(vectorized::ColumnPtr column, size_t start) { + Status insert(ColumnPtr column, size_t start) { std::unique_lock l(_rmtx); if (!_wrapper->is_valid() || _rf_state == State::READY_TO_PUBLISH || _rf_state == State::PUBLISHED) { @@ -180,7 +180,7 @@ class RuntimeFilterProducer : public RuntimeFilter { bool _need_sync_filter_size = false; int64_t _synced_size = -1; - std::shared_ptr _dependency; + std::shared_ptr _dependency; std::atomic _rf_state; }; diff --git a/be/src/runtime_filter/runtime_filter_producer_helper.cpp b/be/src/exec/runtime_filter/runtime_filter_producer_helper.cpp similarity index 91% rename from be/src/runtime_filter/runtime_filter_producer_helper.cpp rename to be/src/exec/runtime_filter/runtime_filter_producer_helper.cpp index 58d7d6c2500d5f..9940f0d4366c10 100644 --- a/be/src/runtime_filter/runtime_filter_producer_helper.cpp +++ b/be/src/exec/runtime_filter/runtime_filter_producer_helper.cpp @@ -15,17 +15,17 @@ // specific language governing permissions and limitations // under the License. -#include "runtime_filter/runtime_filter_producer_helper.h" +#include "exec/runtime_filter/runtime_filter_producer_helper.h" #include -#include "pipeline/pipeline_task.h" -#include "runtime_filter/runtime_filter_wrapper.h" +#include "exec/pipeline/pipeline_task.h" +#include "exec/runtime_filter/runtime_filter_wrapper.h" namespace doris { #include "common/compile_check_begin.h" void RuntimeFilterProducerHelper::_init_expr( - const vectorized::VExprContextSPtrs& build_expr_ctxs, + const VExprContextSPtrs& build_expr_ctxs, const std::vector& runtime_filter_descs) { _filter_expr_contexts.resize(runtime_filter_descs.size()); for (size_t i = 0; i < runtime_filter_descs.size(); i++) { @@ -34,7 +34,7 @@ void RuntimeFilterProducerHelper::_init_expr( } Status RuntimeFilterProducerHelper::init( - RuntimeState* state, const vectorized::VExprContextSPtrs& build_expr_ctxs, + RuntimeState* state, const VExprContextSPtrs& build_expr_ctxs, const std::vector& runtime_filter_descs) { _producers.resize(runtime_filter_descs.size()); for (size_t i = 0; i < runtime_filter_descs.size(); i++) { @@ -47,7 +47,7 @@ Status RuntimeFilterProducerHelper::init( Status RuntimeFilterProducerHelper::send_filter_size( RuntimeState* state, uint64_t hash_table_size, - const std::shared_ptr& dependency) { + const std::shared_ptr& dependency) { if (_skip_runtime_filters_process) { return Status::OK(); } @@ -69,7 +69,7 @@ Status RuntimeFilterProducerHelper::_init_filters(RuntimeState* state, return Status::OK(); } -Status RuntimeFilterProducerHelper::_insert(const vectorized::Block* block, size_t start) { +Status RuntimeFilterProducerHelper::_insert(const Block* block, size_t start) { SCOPED_TIMER(_runtime_filter_compute_timer.get()); for (int i = 0; i < _producers.size(); i++) { auto filter = _producers[i]; @@ -90,7 +90,7 @@ Status RuntimeFilterProducerHelper::_publish(RuntimeState* state) { } Status RuntimeFilterProducerHelper::build( - RuntimeState* state, const vectorized::Block* block, bool use_shared_table, + RuntimeState* state, const Block* block, bool use_shared_table, std::map>& runtime_filters) { if (_skip_runtime_filters_process) { return Status::OK(); @@ -132,7 +132,7 @@ Status RuntimeFilterProducerHelper::publish(RuntimeState* state) { Status RuntimeFilterProducerHelper::skip_process(RuntimeState* state) { auto mocked_dependency = - std::make_shared(0, 0, "MOCKED_FINISH_DEPENDENCY"); + std::make_shared(0, 0, "MOCKED_FINISH_DEPENDENCY"); RETURN_IF_ERROR(send_filter_size(state, 0, mocked_dependency)); for (const auto& filter : _producers) { diff --git a/be/src/runtime_filter/runtime_filter_producer_helper.h b/be/src/exec/runtime_filter/runtime_filter_producer_helper.h similarity index 81% rename from be/src/runtime_filter/runtime_filter_producer_helper.h rename to be/src/exec/runtime_filter/runtime_filter_producer_helper.h index bc0431ebe59bae..9bb984b67865b1 100644 --- a/be/src/runtime_filter/runtime_filter_producer_helper.h +++ b/be/src/exec/runtime_filter/runtime_filter_producer_helper.h @@ -21,12 +21,12 @@ #include "common/be_mock_util.h" #include "common/status.h" +#include "core/block/block.h" // IWYU pragma: keep +#include "exec/runtime_filter/runtime_filter.h" +#include "exec/runtime_filter/runtime_filter_mgr.h" +#include "exec/runtime_filter/runtime_filter_producer.h" +#include "exprs/vexpr_context.h" #include "runtime/runtime_state.h" -#include "runtime_filter/runtime_filter.h" -#include "runtime_filter/runtime_filter_mgr.h" -#include "runtime_filter/runtime_filter_producer.h" -#include "vec/core/block.h" // IWYU pragma: keep -#include "vec/exprs/vexpr_context.h" namespace doris { #include "common/compile_check_begin.h" @@ -47,19 +47,19 @@ class RuntimeFilterProducerHelper { #endif // create and register runtime filters producers - Status init(RuntimeState* state, const vectorized::VExprContextSPtrs& build_expr_ctxs, + Status init(RuntimeState* state, const VExprContextSPtrs& build_expr_ctxs, const std::vector& runtime_filter_descs); // send local size to remote to sync global rf size if needed MOCK_FUNCTION Status send_filter_size(RuntimeState* state, uint64_t hash_table_size, - const std::shared_ptr& dependency); + const std::shared_ptr& dependency); // skip all runtime filter process, send size and rf to remote imeediately, mainly used to make join spill instance do not block other instance MOCK_FUNCTION Status skip_process(RuntimeState* state); // build rf - Status build(RuntimeState* state, const vectorized::Block* block, bool use_shared_table, + Status build(RuntimeState* state, const Block* block, bool use_shared_table, std::map>& runtime_filters); // publish rf @@ -70,10 +70,10 @@ class RuntimeFilterProducerHelper { std::shared_ptr detect_local_in_filter(RuntimeState* state); protected: - virtual void _init_expr(const vectorized::VExprContextSPtrs& build_expr_ctxs, + virtual void _init_expr(const VExprContextSPtrs& build_expr_ctxs, const std::vector& runtime_filter_descs); Status _init_filters(RuntimeState* state, uint64_t local_hash_table_size); - Status _insert(const vectorized::Block* block, size_t start); + Status _insert(const Block* block, size_t start); Status _publish(RuntimeState* state); std::vector> _producers; @@ -88,7 +88,7 @@ class RuntimeFilterProducerHelper { std::atomic_bool _skip_runtime_filters_process = false; const bool _is_broadcast_join; - std::vector> _filter_expr_contexts; + std::vector> _filter_expr_contexts; }; #include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/runtime_filter/runtime_filter_producer_helper_cross.h b/be/src/exec/runtime_filter/runtime_filter_producer_helper_cross.h similarity index 83% rename from be/src/runtime_filter/runtime_filter_producer_helper_cross.h rename to be/src/exec/runtime_filter/runtime_filter_producer_helper_cross.h index af80750524ca6e..7a67b03bc3ae65 100644 --- a/be/src/runtime_filter/runtime_filter_producer_helper_cross.h +++ b/be/src/exec/runtime_filter/runtime_filter_producer_helper_cross.h @@ -18,13 +18,13 @@ #pragma once #include "common/status.h" +#include "core/block/block.h" +#include "exec/runtime_filter/runtime_filter.h" +#include "exec/runtime_filter/runtime_filter_mgr.h" +#include "exec/runtime_filter/runtime_filter_producer_helper.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" #include "runtime/runtime_state.h" -#include "runtime_filter/runtime_filter.h" -#include "runtime_filter/runtime_filter_mgr.h" -#include "runtime_filter/runtime_filter_producer_helper.h" -#include "vec/core/block.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" namespace doris { #include "common/compile_check_begin.h" @@ -35,7 +35,7 @@ class RuntimeFilterProducerHelperCross : public RuntimeFilterProducerHelper { RuntimeFilterProducerHelperCross() : RuntimeFilterProducerHelper(true, false) {} - Status process(RuntimeState* state, vectorized::Blocks& blocks) { + Status process(RuntimeState* state, Blocks& blocks) { for (auto& block : blocks) { RETURN_IF_ERROR(_process_block(&block)); } @@ -47,7 +47,7 @@ class RuntimeFilterProducerHelperCross : public RuntimeFilterProducerHelper { } private: - Status _process_block(vectorized::Block* block) { + Status _process_block(Block* block) { for (const auto& vexpr_ctx : _filter_expr_contexts) { int result_column_id = -1; RETURN_IF_ERROR(vexpr_ctx->execute(block, &result_column_id)); @@ -60,7 +60,7 @@ class RuntimeFilterProducerHelperCross : public RuntimeFilterProducerHelper { return Status::OK(); } - void _init_expr(const vectorized::VExprContextSPtrs& build_expr_ctxs, + void _init_expr(const VExprContextSPtrs& build_expr_ctxs, const std::vector& runtime_filter_descs) override { _filter_expr_contexts = build_expr_ctxs; } diff --git a/be/src/runtime_filter/runtime_filter_producer_helper_set.h b/be/src/exec/runtime_filter/runtime_filter_producer_helper_set.h similarity index 82% rename from be/src/runtime_filter/runtime_filter_producer_helper_set.h rename to be/src/exec/runtime_filter/runtime_filter_producer_helper_set.h index 0478d7b4c5cfbb..9def71af0ebbb1 100644 --- a/be/src/runtime_filter/runtime_filter_producer_helper_set.h +++ b/be/src/exec/runtime_filter/runtime_filter_producer_helper_set.h @@ -18,14 +18,14 @@ #pragma once #include "common/status.h" -#include "pipeline/pipeline_task.h" +#include "core/block/block.h" +#include "exec/pipeline/pipeline_task.h" +#include "exec/runtime_filter/runtime_filter.h" +#include "exec/runtime_filter/runtime_filter_mgr.h" +#include "exec/runtime_filter/runtime_filter_producer_helper.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" #include "runtime/runtime_state.h" -#include "runtime_filter/runtime_filter.h" -#include "runtime_filter/runtime_filter_mgr.h" -#include "runtime_filter/runtime_filter_producer_helper.h" -#include "vec/core/block.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" namespace doris { #include "common/compile_check_begin.h" @@ -36,7 +36,7 @@ class RuntimeFilterProducerHelperSet : public RuntimeFilterProducerHelper { RuntimeFilterProducerHelperSet() : RuntimeFilterProducerHelper(true, false) {} - Status process(RuntimeState* state, const vectorized::Block* block, uint64_t cardinality) { + Status process(RuntimeState* state, const Block* block, uint64_t cardinality) { if (_skip_runtime_filters_process) { return Status::OK(); } diff --git a/be/src/runtime_filter/runtime_filter_selectivity.h b/be/src/exec/runtime_filter/runtime_filter_selectivity.h similarity index 100% rename from be/src/runtime_filter/runtime_filter_selectivity.h rename to be/src/exec/runtime_filter/runtime_filter_selectivity.h diff --git a/be/src/runtime_filter/runtime_filter_wrapper.cpp b/be/src/exec/runtime_filter/runtime_filter_wrapper.cpp similarity index 97% rename from be/src/runtime_filter/runtime_filter_wrapper.cpp rename to be/src/exec/runtime_filter/runtime_filter_wrapper.cpp index 33ecd7d9ebc0fa..e4adae590a2221 100644 --- a/be/src/runtime_filter/runtime_filter_wrapper.cpp +++ b/be/src/exec/runtime_filter/runtime_filter_wrapper.cpp @@ -15,11 +15,11 @@ // specific language governing permissions and limitations // under the License. -#include "runtime_filter/runtime_filter_wrapper.h" +#include "exec/runtime_filter/runtime_filter_wrapper.h" +#include "core/data_type/define_primitive_type.h" +#include "exec/runtime_filter/runtime_filter_definitions.h" #include "exprs/create_predicate_function.h" -#include "runtime/define_primitive_type.h" -#include "runtime_filter/runtime_filter_definitions.h" namespace doris { #include "common/compile_check_begin.h" @@ -85,7 +85,7 @@ Status RuntimeFilterWrapper::init(const size_t real_size) { return Status::OK(); } -Status RuntimeFilterWrapper::insert(const vectorized::ColumnPtr& column, size_t start) { +Status RuntimeFilterWrapper::insert(const ColumnPtr& column, size_t start) { switch (_filter_type) { case RuntimeFilterType::IN_FILTER: { _hybrid_set->insert_fixed_len(column, start); @@ -120,19 +120,17 @@ Status RuntimeFilterWrapper::insert(const vectorized::ColumnPtr& column, size_t case RuntimeFilterType::BITMAP_FILTER: { std::vector bitmaps; if (column->is_nullable()) { - const auto* nullable = assert_cast(column.get()); - const auto& col = - assert_cast(nullable->get_nested_column()); + const auto* nullable = assert_cast(column.get()); + const auto& col = assert_cast(nullable->get_nested_column()); const auto& nullmap = - assert_cast(nullable->get_null_map_column()) - .get_data(); + assert_cast(nullable->get_null_map_column()).get_data(); for (size_t i = start; i < column->size(); i++) { if (!nullmap[i]) { bitmaps.push_back(&(col.get_data()[i])); } } } else { - const auto* col = assert_cast(column.get()); + const auto* col = assert_cast(column.get()); for (size_t i = start; i < column->size(); i++) { bitmaps.push_back(&(col->get_data()[i])); } diff --git a/be/src/runtime_filter/runtime_filter_wrapper.h b/be/src/exec/runtime_filter/runtime_filter_wrapper.h similarity index 95% rename from be/src/runtime_filter/runtime_filter_wrapper.h rename to be/src/exec/runtime_filter/runtime_filter_wrapper.h index 9338c7b349d0cd..d18966867b047b 100644 --- a/be/src/runtime_filter/runtime_filter_wrapper.h +++ b/be/src/exec/runtime_filter/runtime_filter_wrapper.h @@ -20,18 +20,16 @@ #include #include "common/status.h" -#include "runtime_filter/runtime_filter_definitions.h" -#include "runtime_filter/utils.h" -#include "vec/columns/column.h" -#include "vec/exprs/vexpr_fwd.h" +#include "core/column/column.h" +#include "exec/runtime_filter/runtime_filter_definitions.h" +#include "exec/runtime_filter/utils.h" +#include "exprs/vexpr_fwd.h" namespace doris { #include "common/compile_check_begin.h" class BloomFilterFuncBase; -namespace vectorized { class VRuntimeFilterWrapper; using VRuntimeFilterPtr = std::shared_ptr; -} // namespace vectorized // This class is a wrapper of runtime predicate function class RuntimeFilterWrapper { @@ -54,7 +52,7 @@ class RuntimeFilterWrapper { _state(state) {} Status init(const size_t runtime_size); - Status insert(const vectorized::ColumnPtr& column, size_t start); + Status insert(const ColumnPtr& column, size_t start); Status merge(const RuntimeFilterWrapper* wrapper); template Status assign(const T& request, butil::IOBufAsZeroCopyInputStream* data); diff --git a/be/src/runtime_filter/utils.cpp b/be/src/exec/runtime_filter/utils.cpp similarity index 92% rename from be/src/runtime_filter/utils.cpp rename to be/src/exec/runtime_filter/utils.cpp index 960340519b7699..6da7800dfe84e8 100644 --- a/be/src/runtime_filter/utils.cpp +++ b/be/src/exec/runtime_filter/utils.cpp @@ -15,10 +15,10 @@ // specific language governing permissions and limitations // under the License. -#include "runtime_filter/utils.h" +#include "exec/runtime_filter/utils.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vliteral.h" +#include "exprs/vexpr.h" +#include "exprs/vliteral.h" namespace doris { #include "common/compile_check_begin.h" @@ -123,12 +123,11 @@ PFilterType get_type(RuntimeFilterType type) { } } -Status create_literal(const vectorized::DataTypePtr& type, const void* data, - vectorized::VExprSPtr& expr) { +Status create_literal(const DataTypePtr& type, const void* data, VExprSPtr& expr) { try { TExprNode node = create_texpr_node_from(data, type->get_primitive_type(), type->get_precision(), type->get_scale()); - expr = vectorized::VLiteral::create_shared(node); + expr = VLiteral::create_shared(node); } catch (const Exception& e) { return e.to_status(); } @@ -136,8 +135,8 @@ Status create_literal(const vectorized::DataTypePtr& type, const void* data, return Status::OK(); } -Status create_vbin_predicate(const vectorized::DataTypePtr& type, TExprOpcode::type opcode, - vectorized::VExprSPtr& expr, TExprNode* tnode, bool contain_null) { +Status create_vbin_predicate(const DataTypePtr& type, TExprOpcode::type opcode, VExprSPtr& expr, + TExprNode* tnode, bool contain_null) { TExprNode node; TScalarType tscalar_type; tscalar_type.__set_type(TPrimitiveType::BOOLEAN); @@ -192,7 +191,7 @@ Status create_vbin_predicate(const vectorized::DataTypePtr& type, TExprOpcode::t fn.__set_has_var_args(false); node.__set_fn(fn); *tnode = node; - return vectorized::VExpr::create_expr(node, expr); + return VExpr::create_expr(node, expr); } } // namespace doris diff --git a/be/src/runtime_filter/utils.h b/be/src/exec/runtime_filter/utils.h similarity index 81% rename from be/src/runtime_filter/utils.h rename to be/src/exec/runtime_filter/utils.h index f30d984da44ab1..37aa47cde85fde 100644 --- a/be/src/runtime_filter/utils.h +++ b/be/src/exec/runtime_filter/utils.h @@ -21,14 +21,13 @@ #include #include -#include "runtime/large_int_value.h" -#include "runtime/types.h" -#include "runtime_filter/runtime_filter_definitions.h" -#include "vec/core/extended_types.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/runtime/timestamptz_value.h" +#include "core/data_type/data_type.h" +#include "core/extended_types.h" +#include "core/types.h" +#include "core/value/large_int_value.h" +#include "core/value/timestamptz_value.h" +#include "exec/runtime_filter/runtime_filter_definitions.h" +#include "exprs/vexpr_fwd.h" namespace doris { #include "common/compile_check_begin.h" @@ -39,25 +38,24 @@ auto get_convertor() { return [](PColumnValue* value, const T& data) { value->set_boolval(data); }; } else if constexpr (std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v || - std::is_same_v) { + std::is_same_v) { return [](PColumnValue* value, const T& data) { value->set_intval(data); }; - } else if constexpr (std::is_same_v || std::is_same_v) { + } else if constexpr (std::is_same_v || std::is_same_v) { return [](PColumnValue* value, const T& data) { value->set_longval(data); }; } else if constexpr (std::is_same_v || std::is_same_v) { return [](PColumnValue* value, const T& data) { value->set_doubleval(data); }; } else if constexpr (std::is_same_v || std::is_same_v || - std::is_same_v) { + std::is_same_v) { return [](PColumnValue* value, const T& data) { value->set_stringval(LargeIntValue::to_string(data)); }; - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { return [](PColumnValue* value, const T& data) { value->set_stringval(wide::to_string(wide::Int256(data))); }; } else if constexpr (std::is_same_v) { return [](PColumnValue* value, const T& data) { value->set_stringval(data); }; - } else if constexpr (std::is_same_v || - std::is_same_v || + } else if constexpr (std::is_same_v || std::is_same_v || std::is_same_v) { return [](PColumnValue* value, const T& data) { value->set_stringval(data.to_string()); }; } else if constexpr (std::is_same_v) { @@ -94,11 +92,10 @@ RuntimeFilterType get_type(int filter_type); // RuntimeFilterType -> PFilterType PFilterType get_type(RuntimeFilterType type); -Status create_literal(const vectorized::DataTypePtr& type, const void* data, - vectorized::VExprSPtr& expr); +Status create_literal(const DataTypePtr& type, const void* data, VExprSPtr& expr); -Status create_vbin_predicate(const vectorized::DataTypePtr& type, TExprOpcode::type opcode, - vectorized::VExprSPtr& expr, TExprNode* tnode, bool contain_null); +Status create_vbin_predicate(const DataTypePtr& type, TExprOpcode::type opcode, VExprSPtr& expr, + TExprNode* tnode, bool contain_null); template std::string states_to_string(std::vector assumed_states) { diff --git a/be/src/vec/exec/scan/es_scanner.cpp b/be/src/exec/scan/es_scanner.cpp similarity index 88% rename from be/src/vec/exec/scan/es_scanner.cpp rename to be/src/exec/scan/es_scanner.cpp index d93dbdecc02b7e..47ac2c27d78c2a 100644 --- a/be/src/vec/exec/scan/es_scanner.cpp +++ b/be/src/exec/scan/es_scanner.cpp @@ -15,30 +15,30 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/scan/es_scanner.h" +#include "exec/scan/es_scanner.h" #include #include #include #include "common/logging.h" -#include "pipeline/exec/es_scan_operator.h" +#include "core/block/block.h" +#include "core/block/column_with_type_and_name.h" +#include "core/column/column.h" +#include "exec/operator/es_scan_operator.h" #include "runtime/descriptors.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" -#include "util/runtime_profile.h" -#include "vec/columns/column.h" -#include "vec/core/block.h" -#include "vec/core/column_with_type_and_name.h" -namespace doris::vectorized { +namespace doris { class VExprContext; -} // namespace doris::vectorized +} // namespace doris static const std::string NEW_SCANNER_TYPE = "EsScanner"; -namespace doris::vectorized { +namespace doris { -EsScanner::EsScanner(RuntimeState* state, pipeline::ScanLocalStateBase* local_state, int64_t limit, +EsScanner::EsScanner(RuntimeState* state, ScanLocalStateBase* local_state, int64_t limit, TupleId tuple_id, const std::map& properties, const std::map& docvalue_context, bool doc_value_mode, RuntimeProfile* profile) @@ -162,8 +162,8 @@ Status EsScanner::_get_block_impl(RuntimeState* state, Block* block, bool* eof) return Status::OK(); } -Status EsScanner::_get_next(std::vector& columns) { - SCOPED_TIMER(_local_state->cast()._read_timer); +Status EsScanner::_get_next(std::vector& columns) { + SCOPED_TIMER(_local_state->cast()._read_timer); if (_line_eof && _batch_eof) { _es_eof = true; return Status::OK(); @@ -178,8 +178,8 @@ Status EsScanner::_get_next(std::vector& columns) } } - COUNTER_UPDATE(_local_state->cast()._blocks_read_counter, 1); - SCOPED_TIMER(_local_state->cast()._materialize_timer); + COUNTER_UPDATE(_local_state->cast()._blocks_read_counter, 1); + SCOPED_TIMER(_local_state->cast()._materialize_timer); RETURN_IF_ERROR(_es_scroll_parser->fill_columns(_tuple_desc, columns, &_line_eof, _docvalue_context, _state->timezone_obj())); if (!_line_eof) { @@ -202,4 +202,4 @@ Status EsScanner::close(RuntimeState* state) { RETURN_IF_ERROR(Scanner::close(state)); return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/es_scanner.h b/be/src/exec/scan/es_scanner.h similarity index 82% rename from be/src/vec/exec/scan/es_scanner.h rename to be/src/exec/scan/es_scanner.h index 14c2b017f24a2f..154d2e31109620 100644 --- a/be/src/vec/exec/scan/es_scanner.h +++ b/be/src/exec/scan/es_scanner.h @@ -27,30 +27,28 @@ #include "common/factory_creator.h" #include "common/global_types.h" #include "common/status.h" +#include "core/data_type/data_type.h" #include "exec/es/es_scan_reader.h" #include "exec/es/es_scroll_parser.h" -#include "vec/data_types/data_type.h" -#include "vec/exec/scan/scanner.h" +#include "exec/scan/scanner.h" namespace doris { class RuntimeProfile; class RuntimeState; class TupleDescriptor; -namespace vectorized { class Block; class VExprContext; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { class EsScanner : public Scanner { ENABLE_FACTORY_CREATOR(EsScanner); public: - EsScanner(RuntimeState* state, pipeline::ScanLocalStateBase* local_state, int64_t limit, - TupleId tuple_id, const std::map& properties, + EsScanner(RuntimeState* state, ScanLocalStateBase* local_state, int64_t limit, TupleId tuple_id, + const std::map& properties, const std::map& docvalue_context, bool doc_value_mode, RuntimeProfile* profile); @@ -62,7 +60,7 @@ class EsScanner : public Scanner { Status _get_block_impl(RuntimeState* state, Block* block, bool* eof) override; private: - Status _get_next(std::vector& columns); + Status _get_next(std::vector& columns); bool _es_eof; const std::map& _properties; @@ -79,4 +77,4 @@ class EsScanner : public Scanner { const std::map& _docvalue_context; bool _doc_value_mode; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/file_scanner.cpp b/be/src/exec/scan/file_scanner.cpp similarity index 95% rename from be/src/vec/exec/scan/file_scanner.cpp rename to be/src/exec/scan/file_scanner.cpp index 59ef0c80573d98..ca85fea7775005 100644 --- a/be/src/vec/exec/scan/file_scanner.cpp +++ b/be/src/exec/scan/file_scanner.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/scan/file_scanner.h" +#include "exec/scan/file_scanner.h" #include #include @@ -37,76 +37,71 @@ #include "common/config.h" #include "common/logging.h" #include "common/status.h" +#include "core/block/column_with_type_and_name.h" +#include "core/block/columns_with_type_and_name.h" +#include "core/column/column.h" +#include "core/column/column_nullable.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/data_type_string.h" +#include "core/string_ref.h" +#include "exec/common/stringop_substring.h" +#include "exec/operator/file_scan_operator.h" #include "exec/rowid_fetcher.h" +#include "exec/scan/scan_node.h" +#include "exprs/aggregate/aggregate_function.h" +#include "exprs/function/function.h" +#include "exprs/function/simple_function_factory.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" +#include "exprs/vexpr_fwd.h" +#include "exprs/vslot_ref.h" +#include "format/arrow/arrow_stream_reader.h" +#include "format/avro/avro_jni_reader.h" +#include "format/csv/csv_reader.h" +#include "format/json/new_json_reader.h" +#include "format/native/native_reader.h" +#include "format/orc/vorc_reader.h" +#include "format/parquet/vparquet_reader.h" +#include "format/table/hive_reader.h" +#include "format/table/hudi_jni_reader.h" +#include "format/table/hudi_reader.h" +#include "format/table/iceberg_reader.h" +#include "format/table/lakesoul_jni_reader.h" +#include "format/table/max_compute_jni_reader.h" +#include "format/table/paimon_cpp_reader.h" +#include "format/table/paimon_jni_reader.h" +#include "format/table/paimon_predicate_converter.h" +#include "format/table/paimon_reader.h" +#include "format/table/remote_doris_reader.h" +#include "format/table/transactional_hive_reader.h" +#include "format/table/trino_connector_jni_reader.h" +#include "format/text/text_reader.h" #include "io/cache/block_file_cache_profile.h" -#include "io/fs/tracing_file_reader.h" +#include "load/group_commit/wal/wal_reader.h" #include "runtime/descriptors.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" -#include "runtime/types.h" -#include "util/runtime_profile.h" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/columns/column.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_vector.h" -#include "vec/common/string_ref.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/core/columns_with_type_and_name.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_factory.hpp" -#include "vec/data_types/data_type_nullable.h" -#include "vec/data_types/data_type_number.h" -#include "vec/data_types/data_type_string.h" -#include "vec/exec/format/arrow/arrow_stream_reader.h" -#include "vec/exec/format/avro/avro_jni_reader.h" -#include "vec/exec/format/csv/csv_reader.h" -#include "vec/exec/format/json/new_json_reader.h" -#include "vec/exec/format/native/native_reader.h" -#include "vec/exec/format/orc/vorc_reader.h" -#include "vec/exec/format/parquet/vparquet_reader.h" -#include "vec/exec/format/table/hive_reader.h" -#include "vec/exec/format/table/hudi_jni_reader.h" -#include "vec/exec/format/table/hudi_reader.h" -#include "vec/exec/format/table/iceberg_reader.h" -#include "vec/exec/format/table/lakesoul_jni_reader.h" -#include "vec/exec/format/table/max_compute_jni_reader.h" -#include "vec/exec/format/table/paimon_cpp_reader.h" -#include "vec/exec/format/table/paimon_jni_reader.h" -#include "vec/exec/format/table/paimon_predicate_converter.h" -#include "vec/exec/format/table/paimon_reader.h" -#include "vec/exec/format/table/remote_doris_reader.h" -#include "vec/exec/format/table/transactional_hive_reader.h" -#include "vec/exec/format/table/trino_connector_jni_reader.h" -#include "vec/exec/format/text/text_reader.h" -#include "vec/exec/format/wal/wal_reader.h" -#include "vec/exec/scan/scan_node.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/exprs/vslot_ref.h" -#include "vec/functions/function.h" -#include "vec/functions/function_string.h" -#include "vec/functions/simple_function_factory.h" -#include "vec/utils/stringop_substring.h" +#include "storage/segment/column_reader.h" namespace cctz { class time_zone; } // namespace cctz namespace doris { -namespace vectorized { class ShardedKVCache; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" using namespace ErrorCode; const std::string FileScanner::FileReadBytesProfile = "FileReadBytes"; const std::string FileScanner::FileReadTimeProfile = "FileReadTime"; -FileScanner::FileScanner(RuntimeState* state, pipeline::FileScanLocalState* local_state, +FileScanner::FileScanner(RuntimeState* state, FileScanLocalState* local_state, int64_t limit, - std::shared_ptr split_source, + std::shared_ptr split_source, RuntimeProfile* profile, ShardedKVCache* kv_cache, const std::unordered_map* colname_to_slot_id) : Scanner(state, local_state, limit, profile), @@ -182,12 +177,12 @@ Status FileScanner::init(RuntimeState* state, const VExprContextSPtrs& conjuncts std::vector({false}))); // prepare pre filters if (_params->__isset.pre_filter_exprs_list) { - RETURN_IF_ERROR(doris::vectorized::VExpr::create_expr_trees( + RETURN_IF_ERROR(doris::VExpr::create_expr_trees( _params->pre_filter_exprs_list, _pre_conjunct_ctxs)); } else if (_params->__isset.pre_filter_exprs) { VExprContextSPtr context; RETURN_IF_ERROR( - doris::vectorized::VExpr::create_expr_tree(_params->pre_filter_exprs, context)); + doris::VExpr::create_expr_tree(_params->pre_filter_exprs, context)); _pre_conjunct_ctxs.emplace_back(context); } @@ -667,7 +662,7 @@ Status FileScanner::_fill_missing_columns(size_t rows) { // no default column, fill with null auto mutable_column = _src_block_ptr->get_by_position(_src_block_name_to_idx[kv.first]) .column->assume_mutable(); - auto* nullable_column = static_cast(mutable_column.get()); + auto* nullable_column = static_cast(mutable_column.get()); nullable_column->insert_many_defaults(rows); } else { // fill with default value @@ -707,7 +702,7 @@ Status FileScanner::_pre_filter_src_block() { SCOPED_TIMER(_pre_filter_timer); auto origin_column_num = _src_block_ptr->columns(); auto old_rows = _src_block_ptr->rows(); - RETURN_IF_ERROR(vectorized::VExprContext::filter_block(_pre_conjunct_ctxs, _src_block_ptr, + RETURN_IF_ERROR(VExprContext::filter_block(_pre_conjunct_ctxs, _src_block_ptr, origin_column_num)); _counter.num_rows_unselected += old_rows - _src_block_ptr->rows(); } @@ -726,7 +721,7 @@ Status FileScanner::_convert_to_output_block(Block* block) { int ctx_idx = 0; size_t rows = _src_block_ptr->rows(); - auto filter_column = vectorized::ColumnUInt8::create(rows, 1); + auto filter_column = ColumnUInt8::create(rows, 1); auto& filter_map = filter_column->get_data(); // After convert, the column_ptr should be copied into output block. @@ -763,7 +758,7 @@ Status FileScanner::_convert_to_output_block(Block* block) { for (int j = 0; j < mutable_output_columns.size(); ++j) { auto* slot_desc = _output_tuple_desc->slots()[j]; int dest_index = ctx_idx; - vectorized::ColumnPtr column_ptr; + ColumnPtr column_ptr; auto& ctx = _dest_vexpr_ctx[dest_index]; // PT1 => dest primitive type @@ -776,7 +771,7 @@ Status FileScanner::_convert_to_output_block(Block* block) { // is likely to be nullable if (LIKELY(column_ptr->is_nullable())) { const auto* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); for (int i = 0; i < rows; ++i) { if (filter_map[i] && nullable_column->is_null_at(i)) { // skip checks for non-mentioned columns in flexible partial update @@ -830,10 +825,10 @@ Status FileScanner::_convert_to_output_block(Block* block) { size_t dest_size = block->columns(); // do filter - block->insert(vectorized::ColumnWithTypeAndName(std::move(filter_column), - std::make_shared(), + block->insert(ColumnWithTypeAndName(std::move(filter_column), + std::make_shared(), "filter column")); - RETURN_IF_ERROR(vectorized::Block::filter_block(block, dest_size, dest_size)); + RETURN_IF_ERROR(Block::filter_block(block, dest_size, dest_size)); _counter.num_rows_filtered += rows - block->rows(); return Status::OK(); @@ -907,7 +902,7 @@ void FileScanner::_truncate_char_or_varchar_column(Block* block, int idx, int le Status FileScanner::_create_row_id_column_iterator() { auto& id_file_map = _state->get_id_file_map(); auto file_id = id_file_map->get_file_mapping_id(std::make_shared( - ((pipeline::FileScanLocalState*)_local_state)->parent_id(), _current_range, + ((FileScanLocalState*)_local_state)->parent_id(), _current_range, _should_enable_file_meta_cache())); _row_id_column_iterator_pair.first = std::make_shared( IdManager::ID_VERSION, BackendOptions::get_backend_id(), file_id); @@ -1223,7 +1218,7 @@ Status FileScanner::_init_parquet_reader(std::unique_ptr&& parque phmap::flat_hash_map>> slot_id_to_predicates = _local_state - ? _local_state->cast()._slot_id_to_predicates + ? _local_state->cast()._slot_id_to_predicates : phmap::flat_hash_map>> {}; if (range.__isset.table_format_params && range.table_format_params.table_format_type == "iceberg") { @@ -1543,8 +1538,8 @@ Status FileScanner::read_lines_from_range(const TFileRangeDesc& range, [&]() -> Status { switch (format_type) { case TFileFormatType::FORMAT_PARQUET: { - std::unique_ptr parquet_reader = - vectorized::ParquetReader::create_unique( + std::unique_ptr parquet_reader = + ParquetReader::create_unique( _profile, *_params, range, 1, const_cast(&_state->timezone_obj()), _io_ctx.get(), _state, file_meta_cache_ptr, false); @@ -1555,8 +1550,8 @@ Status FileScanner::read_lines_from_range(const TFileRangeDesc& range, break; } case TFileFormatType::FORMAT_ORC: { - std::unique_ptr orc_reader = - vectorized::OrcReader::create_unique( + std::unique_ptr orc_reader = + OrcReader::create_unique( _profile, _state, *_params, range, 1, _state->timezone(), _io_ctx.get(), file_meta_cache_ptr, false); @@ -1710,11 +1705,11 @@ Status FileScanner::_init_expr_ctxes() { // set column name to default value expr map for (auto* slot_desc : _real_tuple_desc->slots()) { - vectorized::VExprContextSPtr ctx; + VExprContextSPtr ctx; auto it = _params->default_value_of_src_slot.find(slot_desc->id()); if (it != std::end(_params->default_value_of_src_slot)) { if (!it->second.nodes.empty()) { - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(it->second, ctx)); + RETURN_IF_ERROR(VExpr::create_expr_tree(it->second, ctx)); RETURN_IF_ERROR(ctx->prepare(_state, *_default_val_row_desc)); RETURN_IF_ERROR(ctx->open(_state)); } @@ -1734,9 +1729,9 @@ Status FileScanner::_init_expr_ctxes() { slot_desc->id(), slot_desc->col_name()); } - vectorized::VExprContextSPtr ctx; + VExprContextSPtr ctx; if (!it->second.nodes.empty()) { - RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(it->second, ctx)); + RETURN_IF_ERROR(VExpr::create_expr_tree(it->second, ctx)); RETURN_IF_ERROR(ctx->prepare(_state, *_src_row_desc)); RETURN_IF_ERROR(ctx->open(_state)); } @@ -1784,8 +1779,8 @@ void FileScanner::try_stop() { } void FileScanner::update_realtime_counters() { - pipeline::FileScanLocalState* local_state = - static_cast(_local_state); + FileScanLocalState* local_state = + static_cast(_local_state); COUNTER_UPDATE(local_state->_scan_bytes, _file_reader_stats->read_bytes); COUNTER_UPDATE(local_state->_scan_rows, _file_reader_stats->read_rows); @@ -1846,8 +1841,8 @@ void FileScanner::_collect_profile_before_close() { _cur_reader->collect_profile_before_close(); } - pipeline::FileScanLocalState* local_state = - static_cast(_local_state); + FileScanLocalState* local_state = + static_cast(_local_state); COUNTER_UPDATE(local_state->_scan_bytes, _file_reader_stats->read_bytes); COUNTER_UPDATE(local_state->_scan_rows, _file_reader_stats->read_rows); @@ -1859,4 +1854,4 @@ void FileScanner::_collect_profile_before_close() { DorisMetrics::instance()->query_scan_rows->increment(_file_reader_stats->read_rows); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/file_scanner.h b/be/src/exec/scan/file_scanner.h similarity index 92% rename from be/src/vec/exec/scan/file_scanner.h rename to be/src/exec/scan/file_scanner.h index f42cf4c0372e01..e8c4adf3c1468c 100644 --- a/be/src/vec/exec/scan/file_scanner.h +++ b/be/src/exec/scan/file_scanner.h @@ -29,16 +29,16 @@ #include "common/factory_creator.h" #include "common/global_types.h" #include "common/status.h" -#include "exec/olap_common.h" +#include "core/block/block.h" +#include "exec/operator/file_scan_operator.h" +#include "exprs/vexpr_fwd.h" +#include "format/generic_reader.h" +#include "format/orc/vorc_reader.h" +#include "format/parquet/vparquet_reader.h" #include "io/io_common.h" -#include "pipeline/exec/file_scan_operator.h" #include "runtime/descriptors.h" -#include "util/runtime_profile.h" -#include "vec/core/block.h" -#include "vec/exec/format/generic_reader.h" -#include "vec/exec/format/orc/vorc_reader.h" -#include "vec/exec/format/parquet/vparquet_reader.h" -#include "vec/exprs/vexpr_fwd.h" +#include "runtime/runtime_profile.h" +#include "storage/olap_scan_common.h" namespace doris { class RuntimeState; @@ -46,14 +46,12 @@ class TFileRangeDesc; class TFileScanRange; class TFileScanRangeParams; -namespace vectorized { class ShardedKVCache; class VExpr; class VExprContext; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { class FileScanner : public Scanner { ENABLE_FACTORY_CREATOR(FileScanner); @@ -65,9 +63,9 @@ class FileScanner : public Scanner { static const std::string FileReadBytesProfile; static const std::string FileReadTimeProfile; - FileScanner(RuntimeState* state, pipeline::FileScanLocalState* parent, int64_t limit, - std::shared_ptr split_source, - RuntimeProfile* profile, ShardedKVCache* kv_cache, + FileScanner(RuntimeState* state, FileScanLocalState* parent, int64_t limit, + std::shared_ptr split_source, RuntimeProfile* profile, + ShardedKVCache* kv_cache, const std::unordered_map* colname_to_slot_id); Status _open_impl(RuntimeState* state) override; @@ -117,7 +115,7 @@ class FileScanner : public Scanner { protected: const TFileScanRangeParams* _params = nullptr; - std::shared_ptr _split_source; + std::shared_ptr _split_source; bool _first_scan_range = false; TFileRangeDesc _current_range; @@ -139,7 +137,7 @@ class FileScanner : public Scanner { // dest slot name to index in _dest_vexpr_ctx; std::unordered_map _dest_slot_name_to_idx; // col name to default value expr - std::unordered_map _col_default_value_ctx; + std::unordered_map _col_default_value_ctx; // the map values of dest slot id to src slot desc // if there is not key of dest slot id in dest_sid_to_src_sid_without_trans, it will be set to nullptr std::vector _src_slot_descs_order_by_dest; @@ -158,7 +156,7 @@ class FileScanner : public Scanner { std::map _source_file_col_name_types; // For load task - vectorized::VExprContextSPtrs _pre_conjunct_ctxs; + VExprContextSPtrs _pre_conjunct_ctxs; std::unique_ptr _src_row_desc; std::unique_ptr _dest_row_desc; // row desc for default exprs @@ -293,4 +291,4 @@ class FileScanner : public Scanner { _split_source->num_scan_ranges() < config::max_external_file_meta_cache_num / 3; } }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/jdbc_scanner.cpp b/be/src/exec/scan/jdbc_scanner.cpp similarity index 93% rename from be/src/vec/exec/scan/jdbc_scanner.cpp rename to be/src/exec/scan/jdbc_scanner.cpp index d64addfb4973bc..5f451c6fe6a940 100644 --- a/be/src/vec/exec/scan/jdbc_scanner.cpp +++ b/be/src/exec/scan/jdbc_scanner.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "jdbc_scanner.h" +#include "exec/scan/jdbc_scanner.h" #include #include @@ -23,20 +23,20 @@ #include #include "common/logging.h" +#include "core/block/block.h" +#include "core/block/column_with_type_and_name.h" +#include "core/column/column.h" +#include "core/data_type/data_type.h" +#include "exec/connector/vjdbc_connector.h" +#include "exprs/vexpr_context.h" #include "runtime/descriptors.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" -#include "util/runtime_profile.h" -#include "vec/columns/column.h" -#include "vec/core/block.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/data_types/data_type.h" -#include "vec/exec/vjdbc_connector.h" -#include "vec/exprs/vexpr_context.h" - -namespace doris::vectorized { - -JdbcScanner::JdbcScanner(RuntimeState* state, doris::pipeline::JDBCScanLocalState* local_state, - int64_t limit, const TupleId& tuple_id, const std::string& query_string, + +namespace doris { + +JdbcScanner::JdbcScanner(RuntimeState* state, doris::JDBCScanLocalState* local_state, int64_t limit, + const TupleId& tuple_id, const std::string& query_string, TOdbcTableType::type table_type, bool is_tvf, RuntimeProfile* profile) : Scanner(state, local_state, limit, profile), _jdbc_eos(false), @@ -192,4 +192,4 @@ Status JdbcScanner::close(RuntimeState* state) { RETURN_IF_ERROR(_jdbc_connector->close()); return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/jdbc_scanner.h b/be/src/exec/scan/jdbc_scanner.h similarity index 90% rename from be/src/vec/exec/scan/jdbc_scanner.h rename to be/src/exec/scan/jdbc_scanner.h index f19d8f9098d9f8..5b96855fa15a02 100644 --- a/be/src/vec/exec/scan/jdbc_scanner.h +++ b/be/src/exec/scan/jdbc_scanner.h @@ -26,16 +26,15 @@ #include "common/factory_creator.h" #include "common/global_types.h" #include "common/status.h" -#include "pipeline/exec/jdbc_scan_operator.h" -#include "util/runtime_profile.h" -#include "vec/exec/scan/scanner.h" -#include "vec/exec/vjdbc_connector.h" +#include "exec/connector/vjdbc_connector.h" +#include "exec/operator/jdbc_scan_operator.h" +#include "exec/scan/scanner.h" +#include "runtime/runtime_profile.h" namespace doris { class RuntimeState; class TupleDescriptor; -namespace vectorized { class Block; class VExprContext; @@ -45,7 +44,7 @@ class JdbcScanner : public Scanner { public: friend class JdbcConnector; - JdbcScanner(RuntimeState* state, doris::pipeline::JDBCScanLocalState* parent, int64_t limit, + JdbcScanner(RuntimeState* state, doris::JDBCScanLocalState* parent, int64_t limit, const TupleId& tuple_id, const std::string& query_string, TOdbcTableType::type table_type, bool is_tvf, RuntimeProfile* profile); Status _open_impl(RuntimeState* state) override; @@ -88,5 +87,4 @@ class JdbcScanner : public Scanner { std::unique_ptr _jdbc_connector; JdbcConnectorParam _jdbc_param; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/scan/meta_scanner.cpp b/be/src/exec/scan/meta_scanner.cpp similarity index 91% rename from be/src/vec/exec/scan/meta_scanner.cpp rename to be/src/exec/scan/meta_scanner.cpp index 65be075e616ef4..42273551c6ddd9 100644 --- a/be/src/vec/exec/scan/meta_scanner.cpp +++ b/be/src/exec/scan/meta_scanner.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "meta_scanner.h" +#include "exec/scan/meta_scanner.h" #include #include @@ -30,34 +30,32 @@ #include "common/cast_set.h" #include "common/logging.h" -#include "runtime/client_cache.h" -#include "runtime/define_primitive_type.h" +#include "core/block/block.h" +#include "core/column/column.h" +#include "core/column/column_nullable.h" +#include "core/column/column_string.h" +#include "core/column/column_vector.h" +#include "core/data_type/define_primitive_type.h" +#include "core/types.h" +#include "format/table/iceberg_sys_table_jni_reader.h" +#include "format/table/parquet_metadata_reader.h" #include "runtime/descriptors.h" #include "runtime/exec_env.h" #include "runtime/runtime_state.h" +#include "util/client_cache.h" #include "util/thrift_rpc_helper.h" -#include "vec/columns/column.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_string.h" -#include "vec/columns/column_vector.h" -#include "vec/core/block.h" -#include "vec/core/types.h" -#include "vec/exec/format/table/iceberg_sys_table_jni_reader.h" -#include "vec/exec/format/table/parquet_metadata_reader.h" namespace doris { class RuntimeProfile; -namespace vectorized { class VExprContext; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" -MetaScanner::MetaScanner(RuntimeState* state, pipeline::ScanLocalStateBase* local_state, - TupleId tuple_id, const TScanRangeParams& scan_range, int64_t limit, - RuntimeProfile* profile, TUserIdentity user_identity) +MetaScanner::MetaScanner(RuntimeState* state, ScanLocalStateBase* local_state, TupleId tuple_id, + const TScanRangeParams& scan_range, int64_t limit, RuntimeProfile* profile, + TUserIdentity user_identity) : Scanner(state, local_state, limit, profile), _meta_eos(false), _tuple_id(tuple_id), @@ -161,7 +159,7 @@ Status MetaScanner::_fill_block_with_remote_data(const std::vectorslots()[col_idx]; for (int _row_idx = 0; _row_idx < _batch_data.size(); _row_idx++) { - vectorized::IColumn* col_ptr = columns[col_idx].get(); + IColumn* col_ptr = columns[col_idx].get(); TCell& cell = _batch_data[_row_idx].column_value[col_idx]; if (cell.__isset.isNull && cell.isNull) { DCHECK(slot_desc->is_nullable()) @@ -178,55 +176,54 @@ Status MetaScanner::_fill_block_with_remote_data(const std::vectortype()->get_primitive_type()) { case TYPE_BOOLEAN: { bool data = cell.boolVal; - assert_cast(col_ptr)->insert_value((uint8_t)data); + assert_cast(col_ptr)->insert_value((uint8_t)data); break; } case TYPE_TINYINT: { int8_t data = (int8_t)cell.intVal; - assert_cast(col_ptr)->insert_value(data); + assert_cast(col_ptr)->insert_value(data); break; } case TYPE_SMALLINT: { int16_t data = (int16_t)cell.intVal; - assert_cast(col_ptr)->insert_value(data); + assert_cast(col_ptr)->insert_value(data); break; } case TYPE_INT: { int32_t data = cell.intVal; - assert_cast(col_ptr)->insert_value(data); + assert_cast(col_ptr)->insert_value(data); break; } case TYPE_BIGINT: { int64_t data = cell.longVal; - assert_cast(col_ptr)->insert_value(data); + assert_cast(col_ptr)->insert_value(data); break; } case TYPE_FLOAT: { auto data = static_cast(cell.doubleVal); - assert_cast(col_ptr)->insert_value(data); + assert_cast(col_ptr)->insert_value(data); break; } case TYPE_DOUBLE: { double data = cell.doubleVal; - assert_cast(col_ptr)->insert_value(data); + assert_cast(col_ptr)->insert_value(data); break; } case TYPE_DATEV2: { uint32_t data = (uint32_t)cell.longVal; - assert_cast(col_ptr)->insert_value(data); + assert_cast(col_ptr)->insert_value(data); break; } case TYPE_DATETIMEV2: { uint64_t data = cell.longVal; - assert_cast(col_ptr)->insert_value(data); + assert_cast(col_ptr)->insert_value(data); break; } case TYPE_STRING: case TYPE_CHAR: case TYPE_VARCHAR: { std::string data = cell.stringVal; - assert_cast(col_ptr)->insert_data(data.c_str(), - data.length()); + assert_cast(col_ptr)->insert_data(data.c_str(), data.length()); break; } default: { @@ -532,4 +529,4 @@ Status MetaScanner::close(RuntimeState* state) { } #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/meta_scanner.h b/be/src/exec/scan/meta_scanner.h similarity index 93% rename from be/src/vec/exec/scan/meta_scanner.h rename to be/src/exec/scan/meta_scanner.h index 1ea3b0f5d48629..362c85d20ac524 100644 --- a/be/src/vec/exec/scan/meta_scanner.h +++ b/be/src/exec/scan/meta_scanner.h @@ -26,8 +26,8 @@ #include "common/factory_creator.h" #include "common/global_types.h" #include "common/status.h" -#include "vec/exec/format/generic_reader.h" -#include "vec/exec/scan/scanner.h" +#include "exec/scan/scanner.h" +#include "format/generic_reader.h" namespace doris { class RuntimeProfile; @@ -38,19 +38,17 @@ class TScanRange; class TScanRangeParams; class TupleDescriptor; -namespace vectorized { class Block; class VExprContext; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class MetaScanner : public Scanner { ENABLE_FACTORY_CREATOR(MetaScanner); public: - MetaScanner(RuntimeState* state, pipeline::ScanLocalStateBase* local_state, TupleId tuple_id, + MetaScanner(RuntimeState* state, ScanLocalStateBase* local_state, TupleId tuple_id, const TScanRangeParams& scan_range, int64_t limit, RuntimeProfile* profile, TUserIdentity user_identity); @@ -101,4 +99,4 @@ class MetaScanner : public Scanner { std::unordered_map _src_block_name_to_idx; }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/olap_scanner.cpp b/be/src/exec/scan/olap_scanner.cpp similarity index 96% rename from be/src/vec/exec/scan/olap_scanner.cpp rename to be/src/exec/scan/olap_scanner.cpp index e413b8e6628b6b..df89b01c2ea490 100644 --- a/be/src/vec/exec/scan/olap_scanner.cpp +++ b/be/src/exec/scan/olap_scanner.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/scan/olap_scanner.h" +#include "exec/scan/olap_scanner.h" #include #include @@ -36,38 +36,38 @@ #include "common/config.h" #include "common/consts.h" #include "common/logging.h" -#include "exec/olap_utils.h" +#include "common/metrics/doris_metrics.h" +#include "core/block/block.h" +#include "exec/common/variant_util.h" +#include "exec/operator/olap_scan_operator.h" +#include "exec/scan/scan_node.h" #include "exprs/function_filter.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" #include "io/cache/block_file_cache_profile.h" #include "io/io_common.h" -#include "olap/id_manager.h" -#include "olap/inverted_index_profile.h" -#include "olap/olap_common.h" -#include "olap/olap_tuple.h" -#include "olap/schema_cache.h" -#include "olap/storage_engine.h" -#include "olap/tablet_schema.h" -#include "pipeline/exec/olap_scan_operator.h" #include "runtime/descriptors.h" #include "runtime/exec_env.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" #include "service/backend_options.h" -#include "util/doris_metrics.h" -#include "util/runtime_profile.h" -#include "vec/common/variant_util.h" -#include "vec/core/block.h" -#include "vec/exec/scan/scan_node.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/json/path_in_data.h" -#include "vec/olap/block_reader.h" - -namespace doris::vectorized { +#include "storage/cache/schema_cache.h" +#include "storage/id_manager.h" +#include "storage/index/inverted/inverted_index_profile.h" +#include "storage/iterator/block_reader.h" +#include "storage/olap_common.h" +#include "storage/olap_tuple.h" +#include "storage/olap_utils.h" +#include "storage/storage_engine.h" +#include "storage/tablet/tablet_schema.h" +#include "util/json/path_in_data.h" + +namespace doris { #include "common/compile_check_avoid_begin.h" using ReadSource = TabletReadSource; -OlapScanner::OlapScanner(pipeline::ScanLocalStateBase* parent, OlapScanner::Params&& params) +OlapScanner::OlapScanner(ScanLocalStateBase* parent, OlapScanner::Params&& params) : Scanner(params.state, parent, params.limit, params.profile), _key_ranges(std::move(params.key_ranges)), _tablet_reader_params({.tablet = std::move(params.tablet), @@ -128,7 +128,7 @@ static std::string read_columns_to_string(TabletSchemaSPtr tablet_schema, } Status OlapScanner::prepare() { - auto* local_state = static_cast(_local_state); + auto* local_state = static_cast(_local_state); auto& tablet = _tablet_reader_params.tablet; auto& tablet_schema = _tablet_reader_params.tablet_schema; DBUG_EXECUTE_IF("CloudTablet.capture_rs_readers.return.e-230", { @@ -268,9 +268,8 @@ Status OlapScanner::prepare() { // Initialize tablet_reader_params RETURN_IF_ERROR(_init_tablet_reader_params( - local_state->_parent->cast()._slot_id_to_slot_desc, - _key_ranges, local_state->_slot_id_to_predicates, - local_state->_push_down_functions)); + local_state->_parent->cast()._slot_id_to_slot_desc, _key_ranges, + local_state->_slot_id_to_predicates, local_state->_push_down_functions)); } // add read columns in profile @@ -308,7 +307,7 @@ Status OlapScanner::prepare() { Status OlapScanner::_open_impl(RuntimeState* state) { RETURN_IF_ERROR(Scanner::_open_impl(state)); - SCOPED_TIMER(_local_state->cast()._reader_init_timer); + SCOPED_TIMER(_local_state->cast()._reader_init_timer); auto res = _tablet_reader->init(_tablet_reader_params); if (!res.ok()) { @@ -366,11 +365,9 @@ Status OlapScanner::_init_tablet_reader_params( _tablet_reader_params.vir_cid_to_idx_in_block = _vir_cid_to_idx_in_block; _tablet_reader_params.vir_col_idx_to_type = _vir_col_idx_to_type; _tablet_reader_params.score_runtime = _score_runtime; - _tablet_reader_params.output_columns = - ((pipeline::OlapScanLocalState*)_local_state)->_output_column_ids; + _tablet_reader_params.output_columns = ((OlapScanLocalState*)_local_state)->_output_column_ids; _tablet_reader_params.ann_topn_runtime = _ann_topn_runtime; - for (const auto& ele : - ((pipeline::OlapScanLocalState*)_local_state)->_cast_types_for_variants) { + for (const auto& ele : ((OlapScanLocalState*)_local_state)->_cast_types_for_variants) { _tablet_reader_params.target_cast_type_for_variants[ele.first] = ele.second; }; auto& tablet_schema = _tablet_reader_params.tablet_schema; @@ -454,7 +451,7 @@ Status OlapScanner::_init_tablet_reader_params( DBUG_EXECUTE_IF("NewOlapScanner::_init_tablet_reader_params.block", DBUG_BLOCK); if (!_state->skip_storage_engine_merge()) { - auto* olap_scan_local_state = (pipeline::OlapScanLocalState*)_local_state; + auto* olap_scan_local_state = (OlapScanLocalState*)_local_state; TOlapScanNode& olap_scan_node = olap_scan_local_state->olap_scan_node(); // order by table keys optimization for topn // will only read head/tail of data file since it's already sorted by keys @@ -522,7 +519,7 @@ Status OlapScanner::_init_variant_columns() { TabletColumn subcol = TabletColumn::create_materialized_variant_column( tablet_schema->column_by_uid(slot->col_unique_id()).name_lower_case(), slot->column_paths(), slot->col_unique_id(), - assert_cast(*remove_nullable(slot->type())) + assert_cast(*remove_nullable(slot->type())) .variant_max_subcolumns_count()); if (tablet_schema->field_index(*subcol.path_info_ptr()) < 0) { tablet_schema->append_column(subcol, TabletSchema::ColumnType::VARIANT); @@ -643,8 +640,7 @@ Status OlapScanner::close(RuntimeState* state) { } void OlapScanner::update_realtime_counters() { - pipeline::OlapScanLocalState* local_state = - static_cast(_local_state); + OlapScanLocalState* local_state = static_cast(_local_state); const OlapReaderStatistics& stats = _tablet_reader->stats(); COUNTER_UPDATE(local_state->_read_compressed_counter, stats.compressed_bytes_read); COUNTER_UPDATE(local_state->_read_uncompressed_counter, stats.uncompressed_bytes_read); @@ -704,7 +700,7 @@ void OlapScanner::_collect_profile_before_close() { // Update counters for OlapScanner // Update counters from tablet reader's stats auto& stats = _tablet_reader->stats(); - auto* local_state = (pipeline::OlapScanLocalState*)_local_state; + auto* local_state = (OlapScanLocalState*)_local_state; COUNTER_UPDATE(local_state->_io_timer, stats.io_ns); COUNTER_UPDATE(local_state->_read_compressed_counter, stats.compressed_bytes_read); COUNTER_UPDATE(local_state->_scan_bytes, stats.uncompressed_bytes_read); @@ -918,4 +914,4 @@ void OlapScanner::_collect_profile_before_close() { } #include "common/compile_check_avoid_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/olap_scanner.h b/be/src/exec/scan/olap_scanner.h similarity index 81% rename from be/src/vec/exec/scan/olap_scanner.h rename to be/src/exec/scan/olap_scanner.h index 8870cc9d7a1d13..2187be4ce45bdd 100644 --- a/be/src/vec/exec/scan/olap_scanner.h +++ b/be/src/exec/scan/olap_scanner.h @@ -30,15 +30,15 @@ #include "common/factory_creator.h" #include "common/status.h" -#include "olap/data_dir.h" -#include "olap/rowset/rowset_meta.h" -#include "olap/rowset/rowset_reader.h" -#include "olap/tablet.h" -#include "olap/tablet_reader.h" -#include "olap/tablet_schema.h" +#include "core/data_type/data_type.h" +#include "exec/scan/scanner.h" #include "runtime/runtime_state.h" -#include "vec/data_types/data_type.h" -#include "vec/exec/scan/scanner.h" +#include "storage/data_dir.h" +#include "storage/rowset/rowset_meta.h" +#include "storage/rowset/rowset_reader.h" +#include "storage/tablet/tablet.h" +#include "storage/tablet/tablet_reader.h" +#include "storage/tablet/tablet_schema.h" namespace doris { @@ -47,12 +47,8 @@ class FunctionFilter; class RuntimeProfile; class RuntimeState; class TPaloScanRange; -namespace pipeline { class ScanLocalStateBase; struct FilterPredicates; -} // namespace pipeline - -namespace vectorized { class Block; @@ -71,7 +67,7 @@ class OlapScanner : public Scanner { bool aggregation; }; - OlapScanner(pipeline::ScanLocalStateBase* parent, Params&& params); + OlapScanner(ScanLocalStateBase* parent, Params&& params); Status prepare() override; @@ -112,21 +108,20 @@ class OlapScanner : public Scanner { std::unordered_set _tablet_columns_convert_to_null_set; // This three fields are copied from OlapScanLocalState. - std::map _slot_id_to_virtual_column_expr; + std::map _slot_id_to_virtual_column_expr; std::map _slot_id_to_index_in_block; - std::map _slot_id_to_col_type; + std::map _slot_id_to_col_type; // ColumnId of virtual column to its expr context - std::map _virtual_column_exprs; + std::map _virtual_column_exprs; // ColumnId of virtual column to its index in block std::map _vir_cid_to_idx_in_block; // The idx of vir_col in block to its data type. - std::map _vir_col_idx_to_type; - std::shared_ptr _score_runtime; + std::map _vir_col_idx_to_type; + std::shared_ptr _score_runtime; std::shared_ptr _ann_topn_runtime; VectorSearchUserParams _vector_search_params; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/olap/parallel_scanner_builder.cpp b/be/src/exec/scan/parallel_scanner_builder.cpp similarity index 98% rename from be/src/olap/parallel_scanner_builder.cpp rename to be/src/exec/scan/parallel_scanner_builder.cpp index a978cb56336ae0..807c99b9ee77ab 100644 --- a/be/src/olap/parallel_scanner_builder.cpp +++ b/be/src/exec/scan/parallel_scanner_builder.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "parallel_scanner_builder.h" +#include "exec/scan/parallel_scanner_builder.h" #include @@ -23,16 +23,14 @@ #include "cloud/cloud_tablet_hotspot.h" #include "cloud/config.h" #include "common/status.h" -#include "olap/base_tablet.h" -#include "olap/rowset/beta_rowset.h" -#include "olap/segment_loader.h" -#include "pipeline/exec/olap_scan_operator.h" -#include "vec/exec/scan/olap_scanner.h" +#include "exec/operator/olap_scan_operator.h" +#include "exec/scan/olap_scanner.h" +#include "storage/rowset/beta_rowset.h" +#include "storage/segment/segment_loader.h" +#include "storage/tablet/base_tablet.h" namespace doris { -using namespace vectorized; - Status ParallelScannerBuilder::build_scanners(std::list& scanners) { RETURN_IF_ERROR(_load()); if (_scan_parallelism_by_segment) { diff --git a/be/src/olap/parallel_scanner_builder.h b/be/src/exec/scan/parallel_scanner_builder.h similarity index 86% rename from be/src/olap/parallel_scanner_builder.h rename to be/src/exec/scan/parallel_scanner_builder.h index 7c57711bc700c3..901901746b1144 100644 --- a/be/src/olap/parallel_scanner_builder.h +++ b/be/src/exec/scan/parallel_scanner_builder.h @@ -22,28 +22,24 @@ #include #include -#include "olap/base_tablet.h" -#include "olap/rowset/rowset_fwd.h" -#include "olap/rowset/segment_v2/row_ranges.h" -#include "olap/segment_loader.h" -#include "olap/tablet.h" -#include "vec/exec/scan/olap_scanner.h" +#include "exec/scan/olap_scanner.h" +#include "storage/rowset/rowset_fwd.h" +#include "storage/segment/row_ranges.h" +#include "storage/segment/segment_loader.h" +#include "storage/tablet/base_tablet.h" +#include "storage/tablet/tablet.h" namespace doris { -namespace pipeline { class OlapScanLocalState; -} -namespace vectorized { class Scanner; -} -using ScannerSPtr = std::shared_ptr; +using ScannerSPtr = std::shared_ptr; class ParallelScannerBuilder { public: - ParallelScannerBuilder(pipeline::OlapScanLocalState* parent, + ParallelScannerBuilder(OlapScanLocalState* parent, const std::vector& tablets, std::vector& read_sources, const std::shared_ptr& profile, @@ -77,11 +73,11 @@ class ParallelScannerBuilder { // Build scanners so that each segment is handled by its own scanner. Status _build_scanners_by_segment(std::list& scanners); - std::shared_ptr _build_scanner( - BaseTabletSPtr tablet, int64_t version, const std::vector& key_ranges, - TabletReadSource&& read_source); + std::shared_ptr _build_scanner(BaseTabletSPtr tablet, int64_t version, + const std::vector& key_ranges, + TabletReadSource&& read_source); - pipeline::OlapScanLocalState* _parent; + OlapScanLocalState* _parent; /// Max scanners count limit to build size_t _max_scanners_count {16}; diff --git a/be/src/vec/exec/scan/scan_node.h b/be/src/exec/scan/scan_node.h similarity index 93% rename from be/src/vec/exec/scan/scan_node.h rename to be/src/exec/scan/scan_node.h index de2045aef17b58..ee45a99eb6e0f7 100644 --- a/be/src/vec/exec/scan/scan_node.h +++ b/be/src/exec/scan/scan_node.h @@ -17,9 +17,9 @@ #pragma once -#include "vec/exec/scan/scanner.h" +#include "exec/scan/scanner.h" -namespace doris::vectorized { +namespace doris { class Scanner; class VSlotRef; @@ -41,4 +41,4 @@ class ScannerDelegate { ScannerDelegate(ScannerDelegate&&) = delete; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/scanner.cpp b/be/src/exec/scan/scanner.cpp similarity index 93% rename from be/src/vec/exec/scan/scanner.cpp rename to be/src/exec/scan/scanner.cpp index aad88f1b41ba6d..521b7cd317f98c 100644 --- a/be/src/vec/exec/scan/scanner.cpp +++ b/be/src/exec/scan/scanner.cpp @@ -15,24 +15,24 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/scan/scanner.h" +#include "exec/scan/scanner.h" #include #include "common/config.h" #include "common/status.h" -#include "pipeline/exec/scan_operator.h" +#include "core/block/column_with_type_and_name.h" +#include "core/column/column_nothing.h" +#include "exec/operator/scan_operator.h" +#include "exec/scan/scan_node.h" +#include "exprs/vexpr_context.h" #include "runtime/descriptors.h" +#include "runtime/runtime_profile.h" #include "util/defer_op.h" -#include "util/runtime_profile.h" -#include "vec/columns/column_nothing.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/exec/scan/scan_node.h" -#include "vec/exprs/vexpr_context.h" -namespace doris::vectorized { +namespace doris { -Scanner::Scanner(RuntimeState* state, pipeline::ScanLocalStateBase* local_state, int64_t limit, +Scanner::Scanner(RuntimeState* state, ScanLocalStateBase* local_state, int64_t limit, RuntimeProfile* profile) : _state(state), _local_state(local_state), @@ -76,7 +76,7 @@ Status Scanner::init(RuntimeState* state, const VExprContextSPtrs& conjuncts) { return Status::OK(); } -Status Scanner::get_block_after_projects(RuntimeState* state, vectorized::Block* block, bool* eos) { +Status Scanner::get_block_after_projects(RuntimeState* state, Block* block, bool* eos) { auto& row_descriptor = _local_state->_parent->row_descriptor(); if (_output_row_descriptor) { if (_alreay_eos) { @@ -177,7 +177,7 @@ Status Scanner::_filter_output_block(Block* block) { return st; } -Status Scanner::_do_projections(vectorized::Block* origin_block, vectorized::Block* output_block) { +Status Scanner::_do_projections(Block* origin_block, Block* output_block) { SCOPED_RAW_TIMER(&_per_scanner_timer); SCOPED_RAW_TIMER(&_projection_timer); @@ -185,7 +185,7 @@ Status Scanner::_do_projections(vectorized::Block* origin_block, vectorized::Blo if (rows == 0) { return Status::OK(); } - vectorized::Block input_block = *origin_block; + Block input_block = *origin_block; std::vector result_column_ids; for (auto& projections : _intermediate_projections) { @@ -266,4 +266,4 @@ void Scanner::update_scan_cpu_timer() { } } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/scanner.h b/be/src/exec/scan/scanner.h similarity index 91% rename from be/src/vec/exec/scan/scanner.h rename to be/src/exec/scan/scanner.h index 9840eac1fd8ae5..4a8a7739ff89fa 100644 --- a/be/src/vec/exec/scan/scanner.h +++ b/be/src/exec/scan/scanner.h @@ -23,26 +23,22 @@ #include #include "common/status.h" -#include "olap/tablet.h" +#include "core/block/block.h" #include "runtime/exec_env.h" #include "runtime/runtime_state.h" +#include "storage/tablet/tablet.h" #include "util/stopwatch.hpp" -#include "vec/core/block.h" namespace doris { class RuntimeProfile; class TupleDescriptor; -namespace vectorized { class VExprContext; -} // namespace vectorized -namespace pipeline { class ScanLocalStateBase; -} // namespace pipeline } // namespace doris -namespace doris::vectorized { +namespace doris { // Counter for load struct ScannerCounter { @@ -54,7 +50,7 @@ struct ScannerCounter { class Scanner { public: - Scanner(RuntimeState* state, pipeline::ScanLocalStateBase* local_state, int64_t limit, + Scanner(RuntimeState* state, ScanLocalStateBase* local_state, int64_t limit, RuntimeProfile* profile); //only used for FileScanner read one line. @@ -85,7 +81,7 @@ class Scanner { } Status get_block(RuntimeState* state, Block* block, bool* eos); - Status get_block_after_projects(RuntimeState* state, vectorized::Block* block, bool* eos); + Status get_block_after_projects(RuntimeState* state, Block* block, bool* eos); virtual Status close(RuntimeState* state); @@ -123,7 +119,7 @@ class Scanner { // Filter the output block finally. Status _filter_output_block(Block* block); - Status _do_projections(vectorized::Block* origin_block, vectorized::Block* output_block); + Status _do_projections(Block* origin_block, Block* output_block); public: int64_t get_time_cost_ns() const { return _per_scanner_timer; } @@ -189,7 +185,7 @@ class Scanner { protected: RuntimeState* _state = nullptr; - pipeline::ScanLocalStateBase* _local_state = nullptr; + ScanLocalStateBase* _local_state = nullptr; // Set if scan node has sort limit info int64_t _limit = -1; @@ -217,9 +213,9 @@ class Scanner { VExprContextSPtrs _conjuncts; VExprContextSPtrs _projections; // Used in common subexpression elimination to compute intermediate results. - std::vector _intermediate_projections; - vectorized::Block _origin_block; - vectorized::Block _padding_block; + std::vector _intermediate_projections; + Block _origin_block; + Block _padding_block; bool _alreay_eos = false; VExprContextSPtrs _common_expr_ctxs_push_down; @@ -257,4 +253,4 @@ class Scanner { using ScannerSPtr = std::shared_ptr; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/scanner_context.cpp b/be/src/exec/scan/scanner_context.cpp similarity index 95% rename from be/src/vec/exec/scan/scanner_context.cpp rename to be/src/exec/scan/scanner_context.cpp index 4aabf67c2618ad..f7376fd294637d 100644 --- a/be/src/vec/exec/scan/scanner_context.cpp +++ b/be/src/exec/scan/scanner_context.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "scanner_context.h" +#include "exec/scan/scanner_context.h" #include #include @@ -34,34 +34,34 @@ #include "common/config.h" #include "common/exception.h" #include "common/logging.h" +#include "common/metrics/doris_metrics.h" #include "common/status.h" -#include "olap/tablet.h" -#include "pipeline/exec/scan_operator.h" +#include "core/block/block.h" +#include "exec/operator/scan_operator.h" +#include "exec/scan/scan_node.h" +#include "exec/scan/scanner_scheduler.h" #include "runtime/descriptors.h" #include "runtime/exec_env.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" -#include "util/doris_metrics.h" -#include "util/runtime_profile.h" +#include "storage/tablet/tablet.h" #include "util/time.h" #include "util/uid_util.h" -#include "vec/core/block.h" -#include "vec/exec/scan/scan_node.h" -#include "vec/exec/scan/scanner_scheduler.h" -namespace doris::vectorized { +namespace doris { using namespace std::chrono_literals; #include "common/compile_check_begin.h" -ScannerContext::ScannerContext( - RuntimeState* state, pipeline::ScanLocalStateBase* local_state, - const TupleDescriptor* output_tuple_desc, const RowDescriptor* output_row_descriptor, - const std::list>& scanners, int64_t limit_, - std::shared_ptr dependency +ScannerContext::ScannerContext(RuntimeState* state, ScanLocalStateBase* local_state, + const TupleDescriptor* output_tuple_desc, + const RowDescriptor* output_row_descriptor, + const std::list>& scanners, + int64_t limit_, std::shared_ptr dependency #ifdef BE_TEST - , - int num_parallel_instances + , + int num_parallel_instances #endif - ) + ) : HasTaskExecutionCtx(state), _state(state), _local_state(local_state), @@ -123,7 +123,7 @@ Status ScannerContext::init() { if (auto* task_executor_scheduler = dynamic_cast(_scanner_scheduler)) { std::shared_ptr task_executor = task_executor_scheduler->task_executor(); - vectorized::TaskId task_id(fmt::format("{}-{}", print_id(_state->query_id()), ctx_id)); + TaskId task_id(fmt::format("{}-{}", print_id(_state->query_id()), ctx_id)); _task_handle = DORIS_TRY(task_executor->create_task( task_id, []() { return 0.0; }, config::task_executor_initial_max_concurrency_per_task > 0 @@ -179,7 +179,7 @@ Status ScannerContext::init() { ScannerContext::~ScannerContext() { SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(_resource_ctx->memory_context()->mem_tracker()); _tasks_queue.clear(); - vectorized::BlockUPtr block; + BlockUPtr block; while (_free_blocks.try_dequeue(block)) { // do nothing } @@ -194,8 +194,8 @@ ScannerContext::~ScannerContext() { } } -vectorized::BlockUPtr ScannerContext::get_free_block(bool force) { - vectorized::BlockUPtr block = nullptr; +BlockUPtr ScannerContext::get_free_block(bool force) { + BlockUPtr block = nullptr; if (_free_blocks.try_dequeue(block)) { DCHECK(block->mem_reuse()); _block_memory_usage -= block->allocated_bytes(); @@ -204,12 +204,12 @@ vectorized::BlockUPtr ScannerContext::get_free_block(bool force) { // The caller of get_free_block will increase the memory usage } else if (_block_memory_usage < _max_bytes_in_queue || force) { _newly_create_free_blocks_num->update(1); - block = vectorized::Block::create_unique(_output_tuple_desc->slots(), 0); + block = Block::create_unique(_output_tuple_desc->slots(), 0); } return block; } -void ScannerContext::return_free_block(vectorized::BlockUPtr block) { +void ScannerContext::return_free_block(BlockUPtr block) { // If under low memory mode, should not return the freeblock, it will occupy too much memory. if (!_local_state->low_memory_mode() && block->mem_reuse() && _block_memory_usage < _max_bytes_in_queue) { @@ -261,8 +261,7 @@ void ScannerContext::push_back_scan_task(std::shared_ptr scan_task) { _dependency->set_ready(); } -Status ScannerContext::get_block_from_queue(RuntimeState* state, vectorized::Block* block, - bool* eos, int id) { +Status ScannerContext::get_block_from_queue(RuntimeState* state, Block* block, bool* eos, int id) { if (state->is_cancelled()) { _set_scanner_done(); return state->cancel_reason(); @@ -615,4 +614,4 @@ bool ScannerContext::low_memory_mode() const { return _local_state->low_memory_mode(); } #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/scanner_context.h b/be/src/exec/scan/scanner_context.h similarity index 89% rename from be/src/vec/exec/scan/scanner_context.h rename to be/src/exec/scan/scanner_context.h index d6c3793ff09c73..939635751bcf6d 100644 --- a/be/src/vec/exec/scan/scanner_context.h +++ b/be/src/exec/scan/scanner_context.h @@ -32,13 +32,13 @@ #include "common/config.h" #include "common/factory_creator.h" +#include "common/metrics/doris_metrics.h" #include "common/status.h" #include "concurrentqueue.h" -#include "util/doris_metrics.h" -#include "util/runtime_profile.h" -#include "vec/core/block.h" -#include "vec/exec/executor/split_runner.h" -#include "vec/exec/scan/scanner.h" +#include "core/block/block.h" +#include "exec/scan/scanner.h" +#include "exec/scan/task_executor/split_runner.h" +#include "runtime/runtime_profile.h" namespace doris { @@ -46,12 +46,8 @@ class RuntimeState; class TupleDescriptor; class WorkloadGroup; -namespace pipeline { class ScanLocalStateBase; class Dependency; -} // namespace pipeline - -namespace vectorized { class Scanner; class ScannerDelegate; @@ -85,7 +81,7 @@ class ScanTask { public: std::weak_ptr scanner; - std::list> cached_blocks; + std::list> cached_blocks; bool is_first_schedule = true; // Use weak_ptr to avoid circular references and potential memory leaks with SplitRunner. // ScannerContext only needs to observe the lifetime of SplitRunner without owning it. @@ -119,11 +115,11 @@ class ScannerContext : public std::enable_shared_from_this, friend class ScannerScheduler; public: - ScannerContext(RuntimeState* state, pipeline::ScanLocalStateBase* local_state, + ScannerContext(RuntimeState* state, ScanLocalStateBase* local_state, const TupleDescriptor* output_tuple_desc, const RowDescriptor* output_row_descriptor, - const std::list>& scanners, - int64_t limit_, std::shared_ptr dependency + const std::list>& scanners, int64_t limit_, + std::shared_ptr dependency #ifdef BE_TEST , int num_parallel_instances @@ -133,8 +129,8 @@ class ScannerContext : public std::enable_shared_from_this, ~ScannerContext() override; Status init(); - vectorized::BlockUPtr get_free_block(bool force); - void return_free_block(vectorized::BlockUPtr block); + BlockUPtr get_free_block(bool force); + void return_free_block(BlockUPtr block); void clear_free_blocks(); inline void inc_block_usage(size_t usage) { _block_memory_usage += usage; } @@ -145,7 +141,7 @@ class ScannerContext : public std::enable_shared_from_this, // Get next block from blocks queue. Called by ScanNode/ScanOperator // Set eos to true if there is no more data to read. - Status get_block_from_queue(RuntimeState* state, vectorized::Block* block, bool* eos, int id); + Status get_block_from_queue(RuntimeState* state, Block* block, bool* eos, int id); [[nodiscard]] Status validate_block_schema(Block* block); @@ -184,7 +180,7 @@ class ScannerContext : public std::enable_shared_from_this, int32_t low_memory_mode_scanners() const { return 4; } - pipeline::ScanLocalStateBase* local_state() const { return _local_state; } + ScanLocalStateBase* local_state() const { return _local_state; } // the unique id of this context std::string ctx_id; @@ -210,7 +206,7 @@ class ScannerContext : public std::enable_shared_from_this, void _set_scanner_done(); RuntimeState* _state = nullptr; - pipeline::ScanLocalStateBase* _local_state = nullptr; + ScanLocalStateBase* _local_state = nullptr; // the comment of same fields in VScanNode const TupleDescriptor* _output_tuple_desc = nullptr; @@ -224,7 +220,7 @@ class ScannerContext : public std::enable_shared_from_this, std::atomic_bool _is_finished = false; // Lazy-allocated blocks for all scanners to share, for memory reuse. - moodycamel::ConcurrentQueue _free_blocks; + moodycamel::ConcurrentQueue _free_blocks; int _batch_size; // The limit from SQL's limit clause @@ -245,8 +241,8 @@ class ScannerContext : public std::enable_shared_from_this, RuntimeProfile::Counter* _newly_create_free_blocks_num = nullptr; RuntimeProfile::Counter* _scale_up_scanners_counter = nullptr; std::shared_ptr _resource_ctx; - std::shared_ptr _dependency = nullptr; - std::shared_ptr _task_handle; + std::shared_ptr _dependency = nullptr; + std::shared_ptr _task_handle; std::atomic _block_memory_usage = 0; @@ -270,5 +266,4 @@ class ScannerContext : public std::enable_shared_from_this, // TODO: Add implementation of runtime_info_feed_back // adaptive scan concurrency related end }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/scan/scanner_scheduler.cpp b/be/src/exec/scan/scanner_scheduler.cpp similarity index 95% rename from be/src/vec/exec/scan/scanner_scheduler.cpp rename to be/src/exec/scan/scanner_scheduler.cpp index fcbf265c3b3afe..bb1574b05eec8e 100644 --- a/be/src/vec/exec/scan/scanner_scheduler.cpp +++ b/be/src/exec/scan/scanner_scheduler.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "scanner_scheduler.h" +#include "exec/scan/scanner_scheduler.h" #include #include @@ -31,26 +31,25 @@ #include "common/exception.h" #include "common/logging.h" #include "common/status.h" -#include "file_scanner.h" -#include "olap/tablet.h" -#include "pipeline/pipeline_task.h" +#include "core/block/block.h" +#include "exec/pipeline/pipeline_task.h" +#include "exec/scan/file_scanner.h" +#include "exec/scan/olap_scanner.h" // IWYU pragma: keep +#include "exec/scan/scan_node.h" +#include "exec/scan/scanner.h" +#include "exec/scan/scanner_context.h" #include "runtime/exec_env.h" #include "runtime/runtime_state.h" #include "runtime/thread_context.h" #include "runtime/workload_group/workload_group_manager.h" +#include "storage/tablet/tablet.h" #include "util/async_io.h" // IWYU pragma: keep #include "util/cpu_info.h" #include "util/defer_op.h" #include "util/thread.h" #include "util/threadpool.h" -#include "vec/columns/column_nothing.h" -#include "vec/core/block.h" -#include "vec/exec/scan/olap_scanner.h" // IWYU pragma: keep -#include "vec/exec/scan/scan_node.h" -#include "vec/exec/scan/scanner.h" -#include "vec/exec/scan/scanner_context.h" -namespace doris::vectorized { +namespace doris { Status ScannerScheduler::submit(std::shared_ptr ctx, std::shared_ptr scan_task) { @@ -268,8 +267,7 @@ void ScannerScheduler::_scanner_scan(std::shared_ptr ctx, scan_task->cached_blocks.back().first->rows() + free_block->rows() <= ctx->batch_size()) { size_t block_size = scan_task->cached_blocks.back().first->allocated_bytes(); - vectorized::MutableBlock mutable_block( - scan_task->cached_blocks.back().first.get()); + MutableBlock mutable_block(scan_task->cached_blocks.back().first.get()); status = mutable_block.merge(*free_block); if (!status.ok()) { LOG(WARNING) << "Block merge failed: " << status.to_string(); @@ -375,7 +373,7 @@ int ScannerScheduler::default_min_active_file_scan_threads() { } void ScannerScheduler::_make_sure_virtual_col_is_materialized( - const std::shared_ptr& scanner, vectorized::Block* free_block) { + const std::shared_ptr& scanner, Block* free_block) { #ifndef NDEBUG // Currently, virtual column can only be used on olap table. std::shared_ptr olap_scanner = std::dynamic_pointer_cast(scanner); @@ -390,8 +388,8 @@ void ScannerScheduler::_make_sure_virtual_col_is_materialized( size_t idx = 0; for (const auto& entry : *free_block) { // Virtual column must be materialized on the end of SegmentIterator's next batch method. - const vectorized::ColumnNothing* column_nothing = - vectorized::check_and_get_column(entry.column.get()); + const ColumnNothing* column_nothing = + check_and_get_column(entry.column.get()); if (column_nothing == nullptr) { idx++; continue; @@ -439,4 +437,4 @@ bool ScannerSplitRunner::is_auto_reschedule() const { return false; } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/scanner_scheduler.h b/be/src/exec/scan/scanner_scheduler.h similarity index 93% rename from be/src/vec/exec/scan/scanner_scheduler.h rename to be/src/exec/scan/scanner_scheduler.h index 089f3e1e5b75e7..de1553b026ed35 100644 --- a/be/src/vec/exec/scan/scanner_scheduler.h +++ b/be/src/exec/scan/scanner_scheduler.h @@ -22,25 +22,23 @@ #include "common/be_mock_util.h" #include "common/status.h" +#include "exec/scan/scanner_context.h" +#include "exec/scan/task_executor/listenable_future.h" +#include "exec/scan/task_executor/ticker.h" +#include "exec/scan/task_executor/time_sharing/time_sharing_task_executor.h" #include "util/threadpool.h" -#include "vec/exec/executor/listenable_future.h" -#include "vec/exec/executor/ticker.h" -#include "vec/exec/executor/time_sharing/time_sharing_task_executor.h" -#include "vec/exec/scan/scanner_context.h" namespace doris { class ExecEnv; -namespace vectorized { class Scanner; class Block; -} // namespace vectorized template class BlockingQueue; } // namespace doris -namespace doris::vectorized { +namespace doris { class ScannerDelegate; class ScanTask; class ScannerContext; @@ -49,7 +47,7 @@ class ScannerScheduler; struct SimplifiedScanTask { SimplifiedScanTask() = default; SimplifiedScanTask(std::function scan_func, - std::shared_ptr scanner_context, + std::shared_ptr scanner_context, std::shared_ptr scan_task) { this->scan_func = scan_func; this->scanner_context = scanner_context; @@ -57,7 +55,7 @@ struct SimplifiedScanTask { } std::function scan_func; - std::shared_ptr scanner_context = nullptr; + std::shared_ptr scanner_context = nullptr; std::shared_ptr scan_task = nullptr; }; @@ -145,7 +143,7 @@ class ScannerScheduler { std::shared_ptr scan_task); static void _make_sure_virtual_col_is_materialized(const std::shared_ptr& scanner, - vectorized::Block* block); + Block* block); }; class ThreadPoolSimplifiedScanScheduler MOCK_REMOVE(final) : public ScannerScheduler { @@ -327,7 +325,7 @@ class TaskExecutorSimplifiedScanScheduler final : public ScannerScheduler { Status submit_scan_task(SimplifiedScanTask scan_task, const std::string& task_id_string) override { if (!_is_stop) { - vectorized::TaskId task_id(task_id_string); + TaskId task_id(task_id_string); std::shared_ptr task_handle = DORIS_TRY(_task_executor->create_task( task_id, []() { return 0.0; }, config::task_executor_initial_max_concurrency_per_task > 0 @@ -361,8 +359,8 @@ class TaskExecutorSimplifiedScanScheduler final : public ScannerScheduler { void reset_thread_num(int new_max_thread_num, int new_min_thread_num, int min_active_scan_threads) override { _min_active_scan_threads = min_active_scan_threads; - auto task_executor = std::dynamic_pointer_cast( - _task_executor); + auto task_executor = + std::dynamic_pointer_cast(_task_executor); int cur_max_thread_num = task_executor->max_threads(); int cur_min_thread_num = task_executor->min_threads(); if (cur_max_thread_num == new_max_thread_num && cur_min_thread_num == new_min_thread_num) { @@ -394,20 +392,20 @@ class TaskExecutorSimplifiedScanScheduler final : public ScannerScheduler { } int get_queue_size() override { - auto task_executor = std::dynamic_pointer_cast( - _task_executor); + auto task_executor = + std::dynamic_pointer_cast(_task_executor); return task_executor->get_queue_size(); } int get_active_threads() override { - auto task_executor = std::dynamic_pointer_cast( - _task_executor); + auto task_executor = + std::dynamic_pointer_cast(_task_executor); return task_executor->num_active_threads(); } std::vector thread_debug_info() override { - auto task_executor = std::dynamic_pointer_cast( - _task_executor); + auto task_executor = + std::dynamic_pointer_cast(_task_executor); return task_executor->debug_info(); } @@ -426,4 +424,4 @@ class TaskExecutorSimplifiedScanScheduler final : public ScannerScheduler { std::shared_ptr _task_executor = nullptr; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/simplified_scan_scheduler.cpp b/be/src/exec/scan/simplified_scan_scheduler.cpp similarity index 91% rename from be/src/vec/exec/scan/simplified_scan_scheduler.cpp rename to be/src/exec/scan/simplified_scan_scheduler.cpp index befebda57322f4..275461ff1dd409 100644 --- a/be/src/vec/exec/scan/simplified_scan_scheduler.cpp +++ b/be/src/exec/scan/simplified_scan_scheduler.cpp @@ -17,10 +17,10 @@ #include -#include "scanner_scheduler.h" -#include "vec/exec/scan/scanner_context.h" +#include "exec/scan/scanner_context.h" +#include "exec/scan/scanner_scheduler.h" -namespace doris::vectorized { +namespace doris { class ScannerDelegate; class ScanTask; @@ -37,4 +37,4 @@ Status ThreadPoolSimplifiedScanScheduler::schedule_scan_task( std::unique_lock wl(_lock); return scanner_ctx->schedule_scan_task(current_scan_task, transfer_lock, wl); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/split_source_connector.cpp b/be/src/exec/scan/split_source_connector.cpp similarity index 96% rename from be/src/vec/exec/scan/split_source_connector.cpp rename to be/src/exec/scan/split_source_connector.cpp index cefe5b70216a49..81748261d98145 100644 --- a/be/src/vec/exec/scan/split_source_connector.cpp +++ b/be/src/exec/scan/split_source_connector.cpp @@ -15,12 +15,12 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/scan/split_source_connector.h" +#include "exec/scan/split_source_connector.h" #include "runtime/exec_env.h" #include "runtime/query_context.h" -namespace doris::vectorized { +namespace doris { using apache::thrift::transport::TTransportException; @@ -83,4 +83,4 @@ Status RemoteSplitSourceConnector::get_next(bool* has_next, TFileRangeDesc* rang return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/scan/split_source_connector.h b/be/src/exec/scan/split_source_connector.h similarity index 98% rename from be/src/vec/exec/scan/split_source_connector.h rename to be/src/exec/scan/split_source_connector.h index 3463ddbb56c514..5e61c16b9bcf04 100644 --- a/be/src/vec/exec/scan/split_source_connector.h +++ b/be/src/exec/scan/split_source_connector.h @@ -18,10 +18,10 @@ #pragma once #include "common/config.h" -#include "runtime/client_cache.h" #include "runtime/runtime_state.h" +#include "util/client_cache.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" /* @@ -168,4 +168,4 @@ class RemoteSplitSourceConnector : public SplitSourceConnector { }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/executor/listenable_future.h b/be/src/exec/scan/task_executor/listenable_future.h similarity index 99% rename from be/src/vec/exec/executor/listenable_future.h rename to be/src/exec/scan/task_executor/listenable_future.h index 157c747b787320..1ca6bf57dd5374 100644 --- a/be/src/vec/exec/executor/listenable_future.h +++ b/be/src/exec/scan/task_executor/listenable_future.h @@ -29,7 +29,6 @@ #include "glog/logging.h" namespace doris { -namespace vectorized { struct Void { bool operator==(const Void&) const { return true; } @@ -225,5 +224,4 @@ inline SharedListenableFuture null_future = SharedListenableFuture::create_ready(Void {}); } // namespace listenable_future -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/split_runner.h b/be/src/exec/scan/task_executor/split_runner.h similarity index 93% rename from be/src/vec/exec/executor/split_runner.h rename to be/src/exec/scan/task_executor/split_runner.h index efaa72fa822985..493ff9ff5b8003 100644 --- a/be/src/vec/exec/executor/split_runner.h +++ b/be/src/exec/scan/task_executor/split_runner.h @@ -20,10 +20,9 @@ #include #include "common/status.h" -#include "vec/exec/executor/listenable_future.h" +#include "exec/scan/task_executor/listenable_future.h" namespace doris { -namespace vectorized { class SplitRunner { public: @@ -37,5 +36,4 @@ class SplitRunner { virtual bool is_auto_reschedule() const { return true; } }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/task_executor.h b/be/src/exec/scan/task_executor/task_executor.h similarity index 91% rename from be/src/vec/exec/executor/task_executor.h rename to be/src/exec/scan/task_executor/task_executor.h index 98526b1b81cad0..454b235506b987 100644 --- a/be/src/vec/exec/executor/task_executor.h +++ b/be/src/exec/scan/task_executor/task_executor.h @@ -21,12 +21,11 @@ #include #include -#include "vec/exec/executor/listenable_future.h" -#include "vec/exec/executor/split_runner.h" -#include "vec/exec/executor/task_id.h" +#include "exec/scan/task_executor/listenable_future.h" +#include "exec/scan/task_executor/split_runner.h" +#include "exec/scan/task_executor/task_id.h" namespace doris { -namespace vectorized { class TaskHandle; @@ -57,5 +56,4 @@ class TaskExecutor { const std::shared_ptr& split) = 0; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/task_handle.h b/be/src/exec/scan/task_executor/task_handle.h similarity index 92% rename from be/src/vec/exec/executor/task_handle.h rename to be/src/exec/scan/task_executor/task_handle.h index da6a7d028b2d9a..69f79ad6bad43d 100644 --- a/be/src/vec/exec/executor/task_handle.h +++ b/be/src/exec/scan/task_executor/task_handle.h @@ -18,10 +18,9 @@ #pragma once #include "common/status.h" -#include "vec/exec/executor/task_id.h" +#include "exec/scan/task_executor/task_id.h" namespace doris { -namespace vectorized { class TaskHandle { public: @@ -31,5 +30,4 @@ class TaskHandle { virtual TaskId task_id() const = 0; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/task_id.h b/be/src/exec/scan/task_executor/task_id.h similarity index 88% rename from be/src/vec/exec/executor/task_id.h rename to be/src/exec/scan/task_executor/task_id.h index 347bafef74e777..e69e73434093ae 100644 --- a/be/src/vec/exec/executor/task_id.h +++ b/be/src/exec/scan/task_executor/task_id.h @@ -20,7 +20,6 @@ #include namespace doris { -namespace vectorized { class TaskId { public: @@ -32,13 +31,12 @@ class TaskId { std::string _id; }; -} // namespace vectorized } // namespace doris namespace std { template <> -struct hash { - size_t operator()(const doris::vectorized::TaskId& task_id) const { +struct hash { + size_t operator()(const doris::TaskId& task_id) const { return std::hash {}(task_id.to_string()); } }; diff --git a/be/src/vec/exec/executor/ticker.h b/be/src/exec/scan/task_executor/ticker.h similarity index 96% rename from be/src/vec/exec/executor/ticker.h rename to be/src/exec/scan/task_executor/ticker.h index 5b36e26ebafb9a..e84e2bd4e28eb0 100644 --- a/be/src/vec/exec/executor/ticker.h +++ b/be/src/exec/scan/task_executor/ticker.h @@ -21,7 +21,6 @@ #include namespace doris { -namespace vectorized { class Ticker { public: @@ -45,5 +44,4 @@ class SystemTicker : public Ticker { } }; -} // namespace vectorized } // namespace doris \ No newline at end of file diff --git a/be/src/vec/exec/executor/time_sharing/multilevel_split_queue.cpp b/be/src/exec/scan/task_executor/time_sharing/multilevel_split_queue.cpp similarity index 98% rename from be/src/vec/exec/executor/time_sharing/multilevel_split_queue.cpp rename to be/src/exec/scan/task_executor/time_sharing/multilevel_split_queue.cpp index f27e9ba1a62614..8f09da6d3b973b 100644 --- a/be/src/vec/exec/executor/time_sharing/multilevel_split_queue.cpp +++ b/be/src/exec/scan/task_executor/time_sharing/multilevel_split_queue.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/executor/time_sharing/multilevel_split_queue.h" +#include "exec/scan/task_executor/time_sharing/multilevel_split_queue.h" #include #include @@ -23,7 +23,6 @@ #include namespace doris { -namespace vectorized { MultilevelSplitQueue::MultilevelSplitQueue(double level_time_multiplier) : _level_time_multiplier(level_time_multiplier), _level_waiting_splits() { @@ -227,5 +226,4 @@ void MultilevelSplitQueue::clear() { } } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/time_sharing/multilevel_split_queue.h b/be/src/exec/scan/task_executor/time_sharing/multilevel_split_queue.h similarity index 94% rename from be/src/vec/exec/executor/time_sharing/multilevel_split_queue.h rename to be/src/exec/scan/task_executor/time_sharing/multilevel_split_queue.h index 14d1363f6d7c27..871c0854309226 100644 --- a/be/src/vec/exec/executor/time_sharing/multilevel_split_queue.h +++ b/be/src/exec/scan/task_executor/time_sharing/multilevel_split_queue.h @@ -21,12 +21,11 @@ #include #include "common/factory_creator.h" -#include "vec/exec/executor/time_sharing/prioritized_split_runner.h" -#include "vec/exec/executor/time_sharing/priority.h" -#include "vec/exec/executor/time_sharing/split_queue.h" +#include "exec/scan/task_executor/time_sharing/prioritized_split_runner.h" +#include "exec/scan/task_executor/time_sharing/priority.h" +#include "exec/scan/task_executor/time_sharing/split_queue.h" namespace doris { -namespace vectorized { struct SplitRunnerComparator { bool operator()(const std::shared_ptr& a, @@ -97,5 +96,4 @@ class MultilevelSplitQueue : public SplitQueue { std::array, LEVEL_THRESHOLD_SECONDS.size()> _level_min_priority; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/time_sharing/prioritized_split_runner.cpp b/be/src/exec/scan/task_executor/time_sharing/prioritized_split_runner.cpp similarity index 96% rename from be/src/vec/exec/executor/time_sharing/prioritized_split_runner.cpp rename to be/src/exec/scan/task_executor/time_sharing/prioritized_split_runner.cpp index 8e12ebb14bba86..032ba00473b71f 100644 --- a/be/src/vec/exec/executor/time_sharing/prioritized_split_runner.cpp +++ b/be/src/exec/scan/task_executor/time_sharing/prioritized_split_runner.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/executor/time_sharing/prioritized_split_runner.h" +#include "exec/scan/task_executor/time_sharing/prioritized_split_runner.h" #include @@ -23,10 +23,9 @@ #include #include -#include "vec/exec/executor/time_sharing/time_sharing_task_handle.h" +#include "exec/scan/task_executor/time_sharing/time_sharing_task_handle.h" namespace doris { -namespace vectorized { std::atomic PrioritizedSplitRunner::_next_worker_id(0); @@ -157,5 +156,4 @@ std::string PrioritizedSplitRunner::get_info() const { return ""; } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/time_sharing/prioritized_split_runner.h b/be/src/exec/scan/task_executor/time_sharing/prioritized_split_runner.h similarity index 93% rename from be/src/vec/exec/executor/time_sharing/prioritized_split_runner.h rename to be/src/exec/scan/task_executor/time_sharing/prioritized_split_runner.h index ca5181448ebb99..b6279962934f65 100644 --- a/be/src/vec/exec/executor/time_sharing/prioritized_split_runner.h +++ b/be/src/exec/scan/task_executor/time_sharing/prioritized_split_runner.h @@ -20,14 +20,13 @@ #include #include "common/factory_creator.h" +#include "exec/scan/task_executor/listenable_future.h" +#include "exec/scan/task_executor/split_runner.h" +#include "exec/scan/task_executor/ticker.h" +#include "exec/scan/task_executor/time_sharing/priority.h" #include "util/stopwatch.hpp" -#include "vec/exec/executor/listenable_future.h" -#include "vec/exec/executor/split_runner.h" -#include "vec/exec/executor/ticker.h" -#include "vec/exec/executor/time_sharing/priority.h" namespace doris { -namespace vectorized { class TimeSharingTaskHandle; @@ -101,5 +100,4 @@ class PrioritizedSplitRunner : public std::enable_shared_from_this namespace doris { -namespace vectorized { /** * Task (and split) priority is composed of a level and a within-level @@ -63,5 +62,4 @@ class Priority { int64_t _level_priority; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/time_sharing/split_concurrency_controller.h b/be/src/exec/scan/task_executor/time_sharing/split_concurrency_controller.h similarity index 98% rename from be/src/vec/exec/executor/time_sharing/split_concurrency_controller.h rename to be/src/exec/scan/task_executor/time_sharing/split_concurrency_controller.h index de85de06fd5e8b..4dc5b529f48040 100644 --- a/be/src/vec/exec/executor/time_sharing/split_concurrency_controller.h +++ b/be/src/exec/scan/task_executor/time_sharing/split_concurrency_controller.h @@ -24,7 +24,7 @@ #include "common/factory_creator.h" #include "common/status.h" -namespace doris::vectorized { +namespace doris { class SplitConcurrencyController { ENABLE_FACTORY_CREATOR(SplitConcurrencyController); @@ -84,4 +84,4 @@ class SplitConcurrencyController { void _reset_adjust_counter() { _thread_nanos_since_adjust = 0; } }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/exec/executor/time_sharing/split_queue.h b/be/src/exec/scan/task_executor/time_sharing/split_queue.h similarity index 90% rename from be/src/vec/exec/executor/time_sharing/split_queue.h rename to be/src/exec/scan/task_executor/time_sharing/split_queue.h index b8b6ccd9f2e87e..8f1050b4424cf9 100644 --- a/be/src/vec/exec/executor/time_sharing/split_queue.h +++ b/be/src/exec/scan/task_executor/time_sharing/split_queue.h @@ -20,11 +20,10 @@ #include #include -#include "vec/exec/executor/time_sharing/prioritized_split_runner.h" -#include "vec/exec/executor/time_sharing/priority.h" +#include "exec/scan/task_executor/time_sharing/prioritized_split_runner.h" +#include "exec/scan/task_executor/time_sharing/priority.h" namespace doris { -namespace vectorized { class SplitQueue { public: @@ -44,5 +43,4 @@ class SplitQueue { virtual int64_t get_level_min_priority(int level, int64_t scheduled_nanos) = 0; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/time_sharing/time_sharing_task_executor.cpp b/be/src/exec/scan/task_executor/time_sharing/time_sharing_task_executor.cpp similarity index 95% rename from be/src/vec/exec/executor/time_sharing/time_sharing_task_executor.cpp rename to be/src/exec/scan/task_executor/time_sharing/time_sharing_task_executor.cpp index 4459f20037babe..5f22ba2e6f2cf8 100644 --- a/be/src/vec/exec/executor/time_sharing/time_sharing_task_executor.cpp +++ b/be/src/exec/scan/task_executor/time_sharing/time_sharing_task_executor.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/executor/time_sharing/time_sharing_task_executor.h" +#include "exec/scan/task_executor/time_sharing/time_sharing_task_executor.h" #include #include @@ -24,39 +24,29 @@ #include #include "common/exception.h" +#include "common/metrics/doris_metrics.h" +#include "exec/scan/task_executor/time_sharing/multilevel_split_queue.h" +#include "exec/scan/task_executor/time_sharing/time_sharing_task_handle.h" #include "util/debug_points.h" #include "util/defer_op.h" -#include "util/doris_metrics.h" #include "util/thread.h" #include "util/threadpool.h" #include "util/uid_util.h" -#include "vec/exec/executor/time_sharing/multilevel_split_queue.h" -#include "vec/exec/executor/time_sharing/time_sharing_task_handle.h" namespace doris { -namespace vectorized { #include "common/compile_check_begin.h" -// Same with definations in threadpool.cpp -// Why use same name: -// We do not want to add seperate metrics for TimeSharingTaskExecutor. -// TimeSharingTaskExecutor is actually a specialized ThreadPool, which uses a time_sharing queuing policy. -// So we want it have same metrics ends up in the finale prometheus. -// This is safe: -// 1. different compile unit. -// 2. different metric tags when registering to prometheus. -// The name of these varialbs will be useds as metric name in prometheus. -DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(thread_pool_active_threads, MetricUnit::NOUNIT); -DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(thread_pool_queue_size, MetricUnit::NOUNIT); -DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(thread_pool_max_queue_size, MetricUnit::NOUNIT); -DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(thread_pool_max_threads, MetricUnit::NOUNIT); -DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(thread_pool_submit_failed, MetricUnit::NOUNIT); -DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(thread_pool_task_execution_time_ns_total, - MetricUnit::NANOSECONDS); -DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(thread_pool_task_execution_count_total, MetricUnit::NOUNIT); -DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(thread_pool_task_wait_worker_time_ns_total, - MetricUnit::NANOSECONDS); -DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(thread_pool_task_wait_worker_count_total, MetricUnit::NOUNIT); +// Reuse metric prototypes defined in util/threadpool.cpp to avoid duplicate symbol +// definitions. Declare them as extern here. +extern ::doris::MetricPrototype METRIC_thread_pool_active_threads; +extern ::doris::MetricPrototype METRIC_thread_pool_queue_size; +extern ::doris::MetricPrototype METRIC_thread_pool_max_queue_size; +extern ::doris::MetricPrototype METRIC_thread_pool_max_threads; +extern ::doris::MetricPrototype METRIC_thread_pool_submit_failed; +extern ::doris::MetricPrototype METRIC_thread_pool_task_execution_time_ns_total; +extern ::doris::MetricPrototype METRIC_thread_pool_task_execution_count_total; +extern ::doris::MetricPrototype METRIC_thread_pool_task_wait_worker_time_ns_total; +extern ::doris::MetricPrototype METRIC_thread_pool_task_wait_worker_count_total; SplitThreadPoolToken::SplitThreadPoolToken(TimeSharingTaskExecutor* pool, TimeSharingTaskExecutor::ExecutionMode mode, @@ -749,8 +739,7 @@ Result> TimeSharingTaskExecutor::create_task( Status TimeSharingTaskExecutor::add_task(const TaskId& task_id, std::shared_ptr task_handle) { std::lock_guard lock(_mutex); - _tasks[task_id] = - std::dynamic_pointer_cast(task_handle); + _tasks[task_id] = std::dynamic_pointer_cast(task_handle); return Status::OK(); } @@ -962,5 +951,4 @@ size_t TimeSharingTaskExecutor::waiting_splits_size() const { return _tokenless->num_tasks(); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/time_sharing/time_sharing_task_executor.h b/be/src/exec/scan/task_executor/time_sharing/time_sharing_task_executor.h similarity index 98% rename from be/src/vec/exec/executor/time_sharing/time_sharing_task_executor.h rename to be/src/exec/scan/task_executor/time_sharing/time_sharing_task_executor.h index 3550449beb76bd..ba38ddb04dac8b 100644 --- a/be/src/vec/exec/executor/time_sharing/time_sharing_task_executor.h +++ b/be/src/exec/scan/task_executor/time_sharing/time_sharing_task_executor.h @@ -32,15 +32,14 @@ #include #include +#include "exec/scan/task_executor/listenable_future.h" +#include "exec/scan/task_executor/task_executor.h" +#include "exec/scan/task_executor/ticker.h" +#include "exec/scan/task_executor/time_sharing/multilevel_split_queue.h" +#include "exec/scan/task_executor/time_sharing/prioritized_split_runner.h" #include "util/threadpool.h" -#include "vec/exec/executor/listenable_future.h" -#include "vec/exec/executor/task_executor.h" -#include "vec/exec/executor/ticker.h" -#include "vec/exec/executor/time_sharing/multilevel_split_queue.h" -#include "vec/exec/executor/time_sharing/prioritized_split_runner.h" namespace doris { -namespace vectorized { class TimeSharingTaskExecutor; class SplitThreadPoolToken; @@ -508,5 +507,4 @@ class SplitThreadPoolToken { int _num_unsubmitted_tasks; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/time_sharing/time_sharing_task_handle.cpp b/be/src/exec/scan/task_executor/time_sharing/time_sharing_task_handle.cpp similarity index 98% rename from be/src/vec/exec/executor/time_sharing/time_sharing_task_handle.cpp rename to be/src/exec/scan/task_executor/time_sharing/time_sharing_task_handle.cpp index 8c4b80ce5a6b0a..42b8aae638d8d3 100644 --- a/be/src/vec/exec/executor/time_sharing/time_sharing_task_handle.cpp +++ b/be/src/exec/scan/task_executor/time_sharing/time_sharing_task_handle.cpp @@ -15,10 +15,9 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/executor/time_sharing/time_sharing_task_handle.h" +#include "exec/scan/task_executor/time_sharing/time_sharing_task_handle.h" namespace doris { -namespace vectorized { #include "common/compile_check_begin.h" TimeSharingTaskHandle::TimeSharingTaskHandle( @@ -192,5 +191,4 @@ std::shared_ptr TimeSharingTaskHandle::get_split( } } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/time_sharing/time_sharing_task_handle.h b/be/src/exec/scan/task_executor/time_sharing/time_sharing_task_handle.h similarity index 89% rename from be/src/vec/exec/executor/time_sharing/time_sharing_task_handle.h rename to be/src/exec/scan/task_executor/time_sharing/time_sharing_task_handle.h index af0a58c0560690..0b92830c4fff61 100644 --- a/be/src/vec/exec/executor/time_sharing/time_sharing_task_handle.h +++ b/be/src/exec/scan/task_executor/time_sharing/time_sharing_task_handle.h @@ -24,15 +24,14 @@ #include #include -#include "vec/exec/executor/task_handle.h" -#include "vec/exec/executor/task_id.h" -#include "vec/exec/executor/time_sharing/prioritized_split_runner.h" -#include "vec/exec/executor/time_sharing/priority.h" -#include "vec/exec/executor/time_sharing/split_concurrency_controller.h" -#include "vec/exec/executor/time_sharing/split_queue.h" +#include "exec/scan/task_executor/task_handle.h" +#include "exec/scan/task_executor/task_id.h" +#include "exec/scan/task_executor/time_sharing/prioritized_split_runner.h" +#include "exec/scan/task_executor/time_sharing/priority.h" +#include "exec/scan/task_executor/time_sharing/split_concurrency_controller.h" +#include "exec/scan/task_executor/time_sharing/split_queue.h" namespace doris { -namespace vectorized { class MultilevelSplitQueue; @@ -87,5 +86,4 @@ class TimeSharingTaskHandle : public TaskHandle { Priority _priority {0, 0}; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/tools/simulator/histogram.cpp b/be/src/exec/scan/task_executor/tools/simulator/histogram.cpp similarity index 97% rename from be/src/vec/exec/executor/tools/simulator/histogram.cpp rename to be/src/exec/scan/task_executor/tools/simulator/histogram.cpp index 2da24649a25b8c..52270db2fa2bd0 100644 --- a/be/src/vec/exec/executor/tools/simulator/histogram.cpp +++ b/be/src/exec/scan/task_executor/tools/simulator/histogram.cpp @@ -15,13 +15,12 @@ // specific language governing permissions and limitations // under the License. -#include "histogram.h" +#include "exec/scan/task_executor/tools/simulator/histogram.h" #include #include namespace doris { -namespace vectorized { std::string HistogramUtils::format_nanos(int64_t nanos) { constexpr int64_t NS_PER_SEC = 1'000'000'000; @@ -60,5 +59,4 @@ std::string HistogramUtils::format_nanos(int64_t nanos) { return oss.str(); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/tools/simulator/histogram.h b/be/src/exec/scan/task_executor/tools/simulator/histogram.h similarity index 98% rename from be/src/vec/exec/executor/tools/simulator/histogram.h rename to be/src/exec/scan/task_executor/tools/simulator/histogram.h index fc1fde29559c09..ae0f487cfd838e 100644 --- a/be/src/vec/exec/executor/tools/simulator/histogram.h +++ b/be/src/exec/scan/task_executor/tools/simulator/histogram.h @@ -31,7 +31,6 @@ #include namespace doris { -namespace vectorized { class HistogramUtils { public: @@ -126,5 +125,4 @@ class Histogram { std::string to_string(const char* value) const { return std::string(value); } }; -} // namespace vectorized } // namespace doris \ No newline at end of file diff --git a/be/src/vec/exec/executor/tools/simulator/scheduled_executor.h b/be/src/exec/scan/task_executor/tools/simulator/scheduled_executor.h similarity index 97% rename from be/src/vec/exec/executor/tools/simulator/scheduled_executor.h rename to be/src/exec/scan/task_executor/tools/simulator/scheduled_executor.h index 6866e3c190a96b..af957631516bb4 100644 --- a/be/src/vec/exec/executor/tools/simulator/scheduled_executor.h +++ b/be/src/exec/scan/task_executor/tools/simulator/scheduled_executor.h @@ -27,10 +27,9 @@ #include #include -#include "vec/exec/executor/tools/simulator/simulation_split.h" +#include "exec/scan/task_executor/tools/simulator/simulation_split.h" namespace doris { -namespace vectorized { struct ScheduledTask { std::chrono::steady_clock::time_point execute_at; @@ -114,5 +113,4 @@ class ScheduledThreadPoolExecutor : public ScheduledExecutor { std::atomic _stop {false}; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/tools/simulator/simulation_controller.cpp b/be/src/exec/scan/task_executor/tools/simulator/simulation_controller.cpp similarity index 97% rename from be/src/vec/exec/executor/tools/simulator/simulation_controller.cpp rename to be/src/exec/scan/task_executor/tools/simulator/simulation_controller.cpp index 93c00bbbb6ca2a..fbc0b8de4cce4e 100644 --- a/be/src/vec/exec/executor/tools/simulator/simulation_controller.cpp +++ b/be/src/exec/scan/task_executor/tools/simulator/simulation_controller.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/executor/tools/simulator/simulation_controller.h" +#include "exec/scan/task_executor/tools/simulator/simulation_controller.h" #include #include @@ -30,11 +30,10 @@ #include #include "common/exception.h" -#include "vec/exec/executor/time_sharing/time_sharing_task_executor.h" -#include "vec/exec/executor/tools/simulator/simulation_task.h" +#include "exec/scan/task_executor/time_sharing/time_sharing_task_executor.h" +#include "exec/scan/task_executor/tools/simulator/simulation_task.h" namespace doris { -namespace vectorized { SimulationController::SimulationController( std::shared_ptr executor, @@ -243,5 +242,4 @@ SimulationController::completed_tasks() const { return _completed_tasks; } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/tools/simulator/simulation_controller.h b/be/src/exec/scan/task_executor/tools/simulator/simulation_controller.h similarity index 95% rename from be/src/vec/exec/executor/tools/simulator/simulation_controller.h rename to be/src/exec/scan/task_executor/tools/simulator/simulation_controller.h index 93aabce72a52a0..24d667d354f98c 100644 --- a/be/src/vec/exec/executor/tools/simulator/simulation_controller.h +++ b/be/src/exec/scan/task_executor/tools/simulator/simulation_controller.h @@ -29,12 +29,11 @@ #include #include -#include "vec/exec/executor/time_sharing/time_sharing_task_executor.h" -#include "vec/exec/executor/tools/simulator/split_generators.h" -#include "vec/exec/executor/tools/simulator/split_specification.h" +#include "exec/scan/task_executor/time_sharing/time_sharing_task_executor.h" +#include "exec/scan/task_executor/tools/simulator/split_generators.h" +#include "exec/scan/task_executor/tools/simulator/split_specification.h" namespace doris { -namespace vectorized { class SimulationTask; @@ -153,5 +152,4 @@ class SimulationController { static constexpr int DEFAULT_MIN_SPLITS = 3; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/tools/simulator/simulation_fifo_split_queue.h b/be/src/exec/scan/task_executor/tools/simulator/simulation_fifo_split_queue.h similarity index 96% rename from be/src/vec/exec/executor/tools/simulator/simulation_fifo_split_queue.h rename to be/src/exec/scan/task_executor/tools/simulator/simulation_fifo_split_queue.h index 6e33fada0c16f4..36c58d91ad12b9 100644 --- a/be/src/vec/exec/executor/tools/simulator/simulation_fifo_split_queue.h +++ b/be/src/exec/scan/task_executor/tools/simulator/simulation_fifo_split_queue.h @@ -22,10 +22,9 @@ #include #include -#include "vec/exec/executor/time_sharing/split_queue.h" +#include "exec/scan/task_executor/time_sharing/split_queue.h" namespace doris { -namespace vectorized { class SimulationFIFOSplitQueue : public SplitQueue { public: @@ -90,5 +89,4 @@ class SimulationFIFOSplitQueue : public SplitQueue { std::queue> _queue; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/tools/simulator/simulation_split.cpp b/be/src/exec/scan/task_executor/tools/simulator/simulation_split.cpp similarity index 95% rename from be/src/vec/exec/executor/tools/simulator/simulation_split.cpp rename to be/src/exec/scan/task_executor/tools/simulator/simulation_split.cpp index 64b69129ea9dc0..100655ab115022 100644 --- a/be/src/vec/exec/executor/tools/simulator/simulation_split.cpp +++ b/be/src/exec/scan/task_executor/tools/simulator/simulation_split.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/executor/tools/simulator/simulation_split.h" +#include "exec/scan/task_executor/tools/simulator/simulation_split.h" #include #include @@ -24,12 +24,11 @@ #include #include -#include "vec/exec/executor/split_runner.h" -#include "vec/exec/executor/tools/simulator/scheduled_executor.h" -#include "vec/exec/executor/tools/simulator/simulation_task.h" +#include "exec/scan/task_executor/split_runner.h" +#include "exec/scan/task_executor/tools/simulator/scheduled_executor.h" +#include "exec/scan/task_executor/tools/simulator/simulation_task.h" namespace doris { -namespace vectorized { SimulationSplit::SimulationSplit(SimulationTask* task, std::chrono::nanoseconds scheduled_time) : _task(task), _scheduled_time(scheduled_time) {} @@ -177,5 +176,4 @@ SharedListenableFuture IntermediateSplit::get_process_result() { return _future; } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/tools/simulator/simulation_split.h b/be/src/exec/scan/task_executor/tools/simulator/simulation_split.h similarity index 97% rename from be/src/vec/exec/executor/tools/simulator/simulation_split.h rename to be/src/exec/scan/task_executor/tools/simulator/simulation_split.h index f8eee81be92033..8fa4c0cf555464 100644 --- a/be/src/vec/exec/executor/tools/simulator/simulation_split.h +++ b/be/src/exec/scan/task_executor/tools/simulator/simulation_split.h @@ -24,10 +24,9 @@ #include #include -#include "vec/exec/executor/split_runner.h" +#include "exec/scan/task_executor/split_runner.h" namespace doris { -namespace vectorized { class SimulationTask; class ScheduledExecutor; @@ -124,5 +123,4 @@ class IntermediateSplit : public SimulationSplit { SharedListenableFuture get_process_result() override; }; -} // namespace vectorized } // namespace doris \ No newline at end of file diff --git a/be/src/vec/exec/executor/tools/simulator/simulation_task.cpp b/be/src/exec/scan/task_executor/tools/simulator/simulation_task.cpp similarity index 96% rename from be/src/vec/exec/executor/tools/simulator/simulation_task.cpp rename to be/src/exec/scan/task_executor/tools/simulator/simulation_task.cpp index a52605c59cf5be..512d55889332d6 100644 --- a/be/src/vec/exec/executor/tools/simulator/simulation_task.cpp +++ b/be/src/exec/scan/task_executor/tools/simulator/simulation_task.cpp @@ -15,14 +15,13 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/executor/tools/simulator/simulation_task.h" +#include "exec/scan/task_executor/tools/simulator/simulation_task.h" #include -#include "vec/exec/executor/tools/simulator/simulation_split.h" +#include "exec/scan/task_executor/tools/simulator/simulation_split.h" namespace doris { -namespace vectorized { SimulationTask::SimulationTask(TimeSharingTaskExecutor& executor, const SimulationController::TasksSpecification& spec, @@ -142,5 +141,4 @@ bool SimulationTask::is_killed() const { return _killed.load(); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/tools/simulator/simulation_task.h b/be/src/exec/scan/task_executor/tools/simulator/simulation_task.h similarity index 89% rename from be/src/vec/exec/executor/tools/simulator/simulation_task.h rename to be/src/exec/scan/task_executor/tools/simulator/simulation_task.h index c3e3850c1aba1e..43606eb416c5da 100644 --- a/be/src/vec/exec/executor/tools/simulator/simulation_task.h +++ b/be/src/exec/scan/task_executor/tools/simulator/simulation_task.h @@ -26,13 +26,12 @@ #include #include -#include "vec/exec/executor/time_sharing/time_sharing_task_executor.h" -#include "vec/exec/executor/tools/simulator/simulation_controller.h" -#include "vec/exec/executor/tools/simulator/simulation_split.h" -#include "vec/exec/executor/tools/simulator/split_specification.h" +#include "exec/scan/task_executor/time_sharing/time_sharing_task_executor.h" +#include "exec/scan/task_executor/tools/simulator/simulation_controller.h" +#include "exec/scan/task_executor/tools/simulator/simulation_split.h" +#include "exec/scan/task_executor/tools/simulator/split_specification.h" namespace doris { -namespace vectorized { class SimulationSplit; @@ -95,7 +94,7 @@ class LeafTask : public SimulationTask { class IntermediateTask : public SimulationTask { private: - std::shared_ptr _split_spec; + std::shared_ptr _split_spec; public: IntermediateTask(TimeSharingTaskExecutor& executor, @@ -105,5 +104,4 @@ class IntermediateTask : public SimulationTask { void schedule(TimeSharingTaskExecutor& executor, int num_splits) override; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/tools/simulator/split_generators.cpp b/be/src/exec/scan/task_executor/tools/simulator/split_generators.cpp similarity index 90% rename from be/src/vec/exec/executor/tools/simulator/split_generators.cpp rename to be/src/exec/scan/task_executor/tools/simulator/split_generators.cpp index 4bd4a9214030a0..9a213048ffdbbc 100644 --- a/be/src/vec/exec/executor/tools/simulator/split_generators.cpp +++ b/be/src/exec/scan/task_executor/tools/simulator/split_generators.cpp @@ -15,14 +15,13 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/executor/tools/simulator/split_generators.h" +#include "exec/scan/task_executor/tools/simulator/split_generators.h" #include -#include "vec/exec/executor/tools/simulator/split_specification.h" +#include "exec/scan/task_executor/tools/simulator/split_specification.h" namespace doris { -namespace vectorized { // ======================== IntermediateSplitGenerator Implementation ======================== @@ -194,12 +193,12 @@ int64_t _generate_leaf_split_quanta_micros(std::mt19937& gen, double origin, dou int64_t AggregatedLeafSplitGenerator::_generate_leaf_split_total_scheduled_millis( double origin, double bound) const { - return ::doris::vectorized::_generate_leaf_split_total_scheduled_millis(_gen, origin, bound); + return ::doris::_generate_leaf_split_total_scheduled_millis(_gen, origin, bound); } int64_t AggregatedLeafSplitGenerator::_generate_leaf_split_quanta_micros(double origin, double bound) const { - return ::doris::vectorized::_generate_leaf_split_quanta_micros(_gen, origin, bound); + return ::doris::_generate_leaf_split_quanta_micros(_gen, origin, bound); } std::unique_ptr AggregatedLeafSplitGenerator::next() const { @@ -214,12 +213,12 @@ std::unique_ptr AggregatedLeafSplitGenerator::next() const { int64_t FastLeafSplitGenerator::_generate_leaf_split_total_scheduled_millis(double origin, double bound) const { - return ::doris::vectorized::_generate_leaf_split_total_scheduled_millis(_gen, origin, bound); + return ::doris::_generate_leaf_split_total_scheduled_millis(_gen, origin, bound); } int64_t FastLeafSplitGenerator::_generate_leaf_split_quanta_micros(double origin, double bound) const { - return ::doris::vectorized::_generate_leaf_split_quanta_micros(_gen, origin, bound); + return ::doris::_generate_leaf_split_quanta_micros(_gen, origin, bound); } std::unique_ptr FastLeafSplitGenerator::next() const { @@ -234,12 +233,12 @@ std::unique_ptr FastLeafSplitGenerator::next() const { int64_t SlowLeafSplitGenerator::_generate_leaf_split_total_scheduled_millis(double origin, double bound) const { - return ::doris::vectorized::_generate_leaf_split_total_scheduled_millis(_gen, origin, bound); + return ::doris::_generate_leaf_split_total_scheduled_millis(_gen, origin, bound); } int64_t SlowLeafSplitGenerator::_generate_leaf_split_quanta_micros(double origin, double bound) const { - return ::doris::vectorized::_generate_leaf_split_quanta_micros(_gen, origin, bound); + return ::doris::_generate_leaf_split_quanta_micros(_gen, origin, bound); } std::unique_ptr SlowLeafSplitGenerator::next() const { @@ -254,12 +253,12 @@ std::unique_ptr SlowLeafSplitGenerator::next() const { int64_t L4LeafSplitGenerator::_generate_leaf_split_total_scheduled_millis(double origin, double bound) const { - return ::doris::vectorized::_generate_leaf_split_total_scheduled_millis(_gen, origin, bound); + return ::doris::_generate_leaf_split_total_scheduled_millis(_gen, origin, bound); } int64_t L4LeafSplitGenerator::_generate_leaf_split_quanta_micros(double origin, double bound) const { - return ::doris::vectorized::_generate_leaf_split_quanta_micros(_gen, origin, bound); + return ::doris::_generate_leaf_split_quanta_micros(_gen, origin, bound); } std::unique_ptr L4LeafSplitGenerator::next() const { @@ -274,12 +273,12 @@ std::unique_ptr L4LeafSplitGenerator::next() const { int64_t QuantaExceedingSplitGenerator::_generate_leaf_split_total_scheduled_millis( double origin, double bound) const { - return ::doris::vectorized::_generate_leaf_split_total_scheduled_millis(_gen, origin, bound); + return ::doris::_generate_leaf_split_total_scheduled_millis(_gen, origin, bound); } int64_t QuantaExceedingSplitGenerator::_generate_leaf_split_quanta_micros(double origin, double bound) const { - return ::doris::vectorized::_generate_leaf_split_quanta_micros(_gen, origin, bound); + return ::doris::_generate_leaf_split_quanta_micros(_gen, origin, bound); } std::unique_ptr QuantaExceedingSplitGenerator::next() const { @@ -296,5 +295,4 @@ std::unique_ptr SimpleLeafSplitGenerator::next() const { return std::make_unique(_total_nanos, _quanta_nanos); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/tools/simulator/split_generators.h b/be/src/exec/scan/task_executor/tools/simulator/split_generators.h similarity index 97% rename from be/src/vec/exec/executor/tools/simulator/split_generators.h rename to be/src/exec/scan/task_executor/tools/simulator/split_generators.h index 559d6bab250ae7..62f16294fee4a5 100644 --- a/be/src/vec/exec/executor/tools/simulator/split_generators.h +++ b/be/src/exec/scan/task_executor/tools/simulator/split_generators.h @@ -20,10 +20,9 @@ #include #include -#include "vec/exec/executor/tools/simulator/split_specification.h" +#include "exec/scan/task_executor/tools/simulator/split_specification.h" namespace doris { -namespace vectorized { class SplitGenerator { public: @@ -124,5 +123,4 @@ class SimpleLeafSplitGenerator : public SplitGenerator { int64_t _quanta_nanos; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/tools/simulator/split_specification.cpp b/be/src/exec/scan/task_executor/tools/simulator/split_specification.cpp similarity index 90% rename from be/src/vec/exec/executor/tools/simulator/split_specification.cpp rename to be/src/exec/scan/task_executor/tools/simulator/split_specification.cpp index e8c5b0ff72b4b3..9619ad5f175ac7 100644 --- a/be/src/vec/exec/executor/tools/simulator/split_specification.cpp +++ b/be/src/exec/scan/task_executor/tools/simulator/split_specification.cpp @@ -15,12 +15,11 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/executor/tools/simulator/split_specification.h" +#include "exec/scan/task_executor/tools/simulator/split_specification.h" -#include "vec/exec/executor/tools/simulator/simulation_split.h" +#include "exec/scan/task_executor/tools/simulator/simulation_split.h" namespace doris { -namespace vectorized { std::unique_ptr LeafSplitSpecification::instantiate(SimulationTask* task) const { return std::make_unique(task, std::chrono::nanoseconds {_scheduled_time_nanos}, @@ -38,5 +37,4 @@ std::unique_ptr IntermediateSplitSpecification::instantiate( between_quanta, scheduled_time); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/tools/simulator/split_specification.h b/be/src/exec/scan/task_executor/tools/simulator/split_specification.h similarity index 98% rename from be/src/vec/exec/executor/tools/simulator/split_specification.h rename to be/src/exec/scan/task_executor/tools/simulator/split_specification.h index b733066c67f989..e2d57f6aad4f51 100644 --- a/be/src/vec/exec/executor/tools/simulator/split_specification.h +++ b/be/src/exec/scan/task_executor/tools/simulator/split_specification.h @@ -22,7 +22,6 @@ #include namespace doris { -namespace vectorized { class SimulationTask; class SimulationSplit; @@ -76,5 +75,4 @@ class IntermediateSplitSpecification : public SplitSpecification { const int64_t _between_quanta_nanos; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/exec/executor/tools/simulator/task_executor_simulator.cpp b/be/src/exec/scan/task_executor/tools/simulator/task_executor_simulator.cpp similarity index 98% rename from be/src/vec/exec/executor/tools/simulator/task_executor_simulator.cpp rename to be/src/exec/scan/task_executor/tools/simulator/task_executor_simulator.cpp index 127abebd9ffb8d..5184281dfac3ae 100644 --- a/be/src/vec/exec/executor/tools/simulator/task_executor_simulator.cpp +++ b/be/src/exec/scan/task_executor/tools/simulator/task_executor_simulator.cpp @@ -15,18 +15,17 @@ // specific language governing permissions and limitations // under the License. -#include "vec/exec/executor/tools/simulator/task_executor_simulator.h" +#include "exec/scan/task_executor/tools/simulator/task_executor_simulator.h" #include #include #include #include -#include "vec/exec/executor/time_sharing/multilevel_split_queue.h" -#include "vec/exec/executor/tools/simulator/histogram.h" +#include "exec/scan/task_executor/time_sharing/multilevel_split_queue.h" +#include "exec/scan/task_executor/tools/simulator/histogram.h" namespace doris { -namespace vectorized { TaskSimulator::TaskSimulator(const std::string& config_file) : _config_file(config_file) { _start_time = std::chrono::high_resolution_clock::now(); @@ -552,7 +551,6 @@ std::string TaskSimulator::_format_stats(std::vector& list) { return oss.str(); } -} // namespace vectorized } // namespace doris int main(int argc, char** argv) { @@ -562,7 +560,7 @@ int main(int argc, char** argv) { } std::string config_file = argv[1]; - doris::vectorized::TaskSimulator simulator(config_file); + doris::TaskSimulator simulator(config_file); auto status = simulator.init(); if (!status.ok()) { diff --git a/be/src/vec/exec/executor/tools/simulator/task_executor_simulator.h b/be/src/exec/scan/task_executor/tools/simulator/task_executor_simulator.h similarity index 88% rename from be/src/vec/exec/executor/tools/simulator/task_executor_simulator.h rename to be/src/exec/scan/task_executor/tools/simulator/task_executor_simulator.h index acbcf9a3d8e63a..713ed9e77fd6ff 100644 --- a/be/src/vec/exec/executor/tools/simulator/task_executor_simulator.h +++ b/be/src/exec/scan/task_executor/tools/simulator/task_executor_simulator.h @@ -23,14 +23,13 @@ #include #include -#include "vec/exec/executor/time_sharing/time_sharing_task_executor.h" -#include "vec/exec/executor/tools/simulator/simulation_controller.h" -#include "vec/exec/executor/tools/simulator/simulation_fifo_split_queue.h" -#include "vec/exec/executor/tools/simulator/simulation_task.h" -#include "vec/exec/executor/tools/simulator/split_generators.h" +#include "exec/scan/task_executor/time_sharing/time_sharing_task_executor.h" +#include "exec/scan/task_executor/tools/simulator/simulation_controller.h" +#include "exec/scan/task_executor/tools/simulator/simulation_fifo_split_queue.h" +#include "exec/scan/task_executor/tools/simulator/simulation_task.h" +#include "exec/scan/task_executor/tools/simulator/split_generators.h" namespace doris { -namespace vectorized { class TaskSimulator { public: @@ -92,5 +91,4 @@ class TaskSimulator { std::chrono::time_point _start_time; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/runtime/vector_search_user_params.cpp b/be/src/exec/scan/vector_search_user_params.cpp similarity index 96% rename from be/src/vec/runtime/vector_search_user_params.cpp rename to be/src/exec/scan/vector_search_user_params.cpp index 9a62a8bf667678..b8e679936abcb2 100644 --- a/be/src/vec/runtime/vector_search_user_params.cpp +++ b/be/src/exec/scan/vector_search_user_params.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/runtime/vector_search_user_params.h" +#include "exec/scan/vector_search_user_params.h" #include diff --git a/be/src/vec/runtime/vector_search_user_params.h b/be/src/exec/scan/vector_search_user_params.h similarity index 100% rename from be/src/vec/runtime/vector_search_user_params.h rename to be/src/exec/scan/vector_search_user_params.h diff --git a/be/src/exec/schema_scanner/schema_scanner_helper.cpp b/be/src/exec/schema_scanner/schema_scanner_helper.cpp deleted file mode 100644 index c3d9ecfee9d261..00000000000000 --- a/be/src/exec/schema_scanner/schema_scanner_helper.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#include "exec/schema_scanner/schema_scanner_helper.h" - -#include "cctz/time_zone.h" -#include "runtime/client_cache.h" -#include "runtime/exec_env.h" -#include "runtime/primitive_type.h" -#include "runtime/runtime_state.h" -#include "util/thrift_rpc_helper.h" -#include "vec/common/string_ref.h" -#include "vec/core/block.h" -#include "vec/data_types/data_type_factory.hpp" - -namespace doris { - -void SchemaScannerHelper::insert_string_value(int col_index, std::string_view str_val, - vectorized::Block* block) { - vectorized::MutableColumnPtr mutable_col_ptr; - mutable_col_ptr = block->get_by_position(col_index).column->assume_mutable(); - auto* nullable_column = assert_cast(mutable_col_ptr.get()); - vectorized::IColumn* col_ptr = &nullable_column->get_nested_column(); - assert_cast(col_ptr)->insert_data(str_val.data(), str_val.size()); - nullable_column->push_false_to_nullmap(1); -} - -void SchemaScannerHelper::insert_datetime_value(int col_index, const std::vector& datas, - vectorized::Block* block) { - vectorized::MutableColumnPtr mutable_col_ptr; - mutable_col_ptr = block->get_by_position(col_index).column->assume_mutable(); - auto* nullable_column = assert_cast(mutable_col_ptr.get()); - vectorized::IColumn* col_ptr = &nullable_column->get_nested_column(); - auto data = datas[0]; - assert_cast(col_ptr)->insert_data(reinterpret_cast(data), - 0); - nullable_column->push_false_to_nullmap(1); -} - -void SchemaScannerHelper::insert_datetime_value(int col_index, int64_t timestamp, - const cctz::time_zone& ctz, - vectorized::Block* block) { - vectorized::MutableColumnPtr mutable_col_ptr; - mutable_col_ptr = block->get_by_position(col_index).column->assume_mutable(); - auto* nullable_column = assert_cast(mutable_col_ptr.get()); - vectorized::IColumn* col_ptr = &nullable_column->get_nested_column(); - - std::vector datas(1); - VecDateTimeValue src[1]; - src[0].from_unixtime(timestamp, ctz); - datas[0] = src; - auto data = datas[0]; - assert_cast(col_ptr)->insert_data(reinterpret_cast(data), - 0); - nullable_column->push_false_to_nullmap(1); -} - -void SchemaScannerHelper::insert_bool_value(int col_index, bool bool_val, - vectorized::Block* block) { - vectorized::MutableColumnPtr mutable_col_ptr; - mutable_col_ptr = block->get_by_position(col_index).column->assume_mutable(); - auto* nullable_column = assert_cast(mutable_col_ptr.get()); - vectorized::IColumn* col_ptr = &nullable_column->get_nested_column(); - assert_cast(col_ptr)->insert_value(bool_val); - nullable_column->push_false_to_nullmap(1); -} - -void SchemaScannerHelper::insert_int32_value(int col_index, int32_t int_val, - vectorized::Block* block) { - vectorized::MutableColumnPtr mutable_col_ptr; - mutable_col_ptr = block->get_by_position(col_index).column->assume_mutable(); - auto* nullable_column = assert_cast(mutable_col_ptr.get()); - vectorized::IColumn* col_ptr = &nullable_column->get_nested_column(); - assert_cast(col_ptr)->insert_value(int_val); - nullable_column->push_false_to_nullmap(1); -} - -void SchemaScannerHelper::insert_int64_value(int col_index, int64_t int_val, - vectorized::Block* block) { - vectorized::MutableColumnPtr mutable_col_ptr; - mutable_col_ptr = block->get_by_position(col_index).column->assume_mutable(); - auto* nullable_column = assert_cast(mutable_col_ptr.get()); - vectorized::IColumn* col_ptr = &nullable_column->get_nested_column(); - assert_cast(col_ptr)->insert_value(int_val); - nullable_column->push_false_to_nullmap(1); -} - -void SchemaScannerHelper::insert_double_value(int col_index, double double_val, - vectorized::Block* block) { - vectorized::MutableColumnPtr mutable_col_ptr; - mutable_col_ptr = block->get_by_position(col_index).column->assume_mutable(); - auto* nullable_column = assert_cast(mutable_col_ptr.get()); - vectorized::IColumn* col_ptr = &nullable_column->get_nested_column(); - assert_cast(col_ptr)->insert_value(double_val); - nullable_column->push_false_to_nullmap(1); -} -} // namespace doris diff --git a/be/src/vec/sink/autoinc_buffer.cpp b/be/src/exec/sink/autoinc_buffer.cpp similarity index 97% rename from be/src/vec/sink/autoinc_buffer.cpp rename to be/src/exec/sink/autoinc_buffer.cpp index 00b58fc6bddd24..64e0279e477cde 100644 --- a/be/src/vec/sink/autoinc_buffer.cpp +++ b/be/src/exec/sink/autoinc_buffer.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/autoinc_buffer.h" +#include "exec/sink/autoinc_buffer.h" #include @@ -24,13 +24,13 @@ #include "common/logging.h" #include "common/status.h" -#include "runtime/client_cache.h" #include "runtime/exec_env.h" +#include "runtime/runtime_profile.h" +#include "util/client_cache.h" #include "util/debug_points.h" -#include "util/runtime_profile.h" #include "util/thrift_rpc_helper.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" AutoIncIDBuffer::AutoIncIDBuffer(int64_t db_id, int64_t table_id, int64_t column_id) @@ -187,4 +187,4 @@ Status AutoIncIDBuffer::_launch_async_fetch_task(size_t length) { return Status::OK(); } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/sink/autoinc_buffer.h b/be/src/exec/sink/autoinc_buffer.h similarity index 98% rename from be/src/vec/sink/autoinc_buffer.h rename to be/src/exec/sink/autoinc_buffer.h index 82be3d9faad00f..fb4ac093ea919c 100644 --- a/be/src/vec/sink/autoinc_buffer.h +++ b/be/src/exec/sink/autoinc_buffer.h @@ -24,7 +24,7 @@ #include "common/status.h" #include "util/threadpool.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class VOlapTableSink; @@ -148,5 +148,5 @@ class GlobalAutoIncBuffers { std::mutex _mutex; }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/sink/delta_writer_v2_pool.cpp b/be/src/exec/sink/delta_writer_v2_pool.cpp similarity index 95% rename from be/src/vec/sink/delta_writer_v2_pool.cpp rename to be/src/exec/sink/delta_writer_v2_pool.cpp index c9ae424d4d4fe4..d2aebdf6e16ce4 100644 --- a/be/src/vec/sink/delta_writer_v2_pool.cpp +++ b/be/src/exec/sink/delta_writer_v2_pool.cpp @@ -15,17 +15,15 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/delta_writer_v2_pool.h" +#include "exec/sink/delta_writer_v2_pool.h" -#include "olap/delta_writer_v2.h" -#include "util/runtime_profile.h" +#include "load/delta_writer/delta_writer_v2.h" +#include "runtime/runtime_profile.h" namespace doris { #include "common/compile_check_begin.h" class TExpr; -namespace vectorized { - DeltaWriterV2Map::DeltaWriterV2Map(UniqueId load_id, int num_use, DeltaWriterV2Pool* pool) : _load_id(load_id), _use_cnt(num_use), _pool(pool) {} @@ -103,5 +101,4 @@ void DeltaWriterV2Pool::erase(UniqueId load_id) { _pool.erase(load_id); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/delta_writer_v2_pool.h b/be/src/exec/sink/delta_writer_v2_pool.h similarity index 98% rename from be/src/vec/sink/delta_writer_v2_pool.h rename to be/src/exec/sink/delta_writer_v2_pool.h index 677d062f6b3363..f349aa6e8f8d06 100644 --- a/be/src/vec/sink/delta_writer_v2_pool.h +++ b/be/src/exec/sink/delta_writer_v2_pool.h @@ -56,8 +56,6 @@ namespace doris { class DeltaWriterV2; class RuntimeProfile; -namespace vectorized { - class DeltaWriterV2Pool; class DeltaWriterV2Map { @@ -107,7 +105,6 @@ class DeltaWriterV2Pool { std::unordered_map> _pool; }; -} // namespace vectorized } // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/sink/load_stream_map_pool.cpp b/be/src/exec/sink/load_stream_map_pool.cpp similarity index 99% rename from be/src/vec/sink/load_stream_map_pool.cpp rename to be/src/exec/sink/load_stream_map_pool.cpp index e68977ea64efd4..eb9a3c669b6a58 100644 --- a/be/src/vec/sink/load_stream_map_pool.cpp +++ b/be/src/exec/sink/load_stream_map_pool.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/load_stream_map_pool.h" +#include "exec/sink/load_stream_map_pool.h" #include "util/debug_points.h" diff --git a/be/src/vec/sink/load_stream_map_pool.h b/be/src/exec/sink/load_stream_map_pool.h similarity index 93% rename from be/src/vec/sink/load_stream_map_pool.h rename to be/src/exec/sink/load_stream_map_pool.h index 6186aa85c860dd..cb210b3663ccde 100644 --- a/be/src/vec/sink/load_stream_map_pool.h +++ b/be/src/exec/sink/load_stream_map_pool.h @@ -48,20 +48,19 @@ #include "common/config.h" #include "common/status.h" -#include "exec/tablet_info.h" +#include "core/allocator.h" +#include "core/block/block.h" +#include "core/column/column.h" +#include "core/data_type/data_type.h" +#include "exec/sink/load_stream_stub.h" +#include "exprs/vexpr_fwd.h" #include "runtime/exec_env.h" #include "runtime/memory/mem_tracker.h" +#include "runtime/runtime_profile.h" #include "runtime/thread_context.h" -#include "runtime/types.h" +#include "storage/tablet_info.h" #include "util/countdown_latch.h" -#include "util/runtime_profile.h" #include "util/stopwatch.hpp" -#include "vec/columns/column.h" -#include "vec/common/allocator.h" -#include "vec/core/block.h" -#include "vec/data_types/data_type.h" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/sink/load_stream_stub.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/vec/sink/load_stream_stub.cpp b/be/src/exec/sink/load_stream_stub.cpp similarity index 99% rename from be/src/vec/sink/load_stream_stub.cpp rename to be/src/exec/sink/load_stream_stub.cpp index faf2b0c17769be..bc54ebd16fc6f2 100644 --- a/be/src/vec/sink/load_stream_stub.cpp +++ b/be/src/exec/sink/load_stream_stub.cpp @@ -15,13 +15,13 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/load_stream_stub.h" +#include "exec/sink/load_stream_stub.h" #include #include "common/cast_set.h" -#include "olap/rowset/rowset_writer.h" #include "runtime/query_context.h" +#include "storage/rowset/rowset_writer.h" #include "util/brpc_client_cache.h" #include "util/debug_points.h" #include "util/network_util.h" diff --git a/be/src/vec/sink/load_stream_stub.h b/be/src/exec/sink/load_stream_stub.h similarity index 97% rename from be/src/vec/sink/load_stream_stub.h rename to be/src/exec/sink/load_stream_stub.h index b97e7e801b6922..4dfe2e252d9e72 100644 --- a/be/src/vec/sink/load_stream_stub.h +++ b/be/src/exec/sink/load_stream_stub.h @@ -52,20 +52,19 @@ #include "common/config.h" #include "common/status.h" -#include "exec/tablet_info.h" +#include "core/allocator.h" +#include "core/block/block.h" +#include "core/column/column.h" +#include "core/data_type/data_type.h" +#include "exprs/vexpr_fwd.h" #include "runtime/exec_env.h" #include "runtime/memory/mem_tracker.h" +#include "runtime/runtime_profile.h" #include "runtime/thread_context.h" -#include "runtime/types.h" +#include "storage/tablet_info.h" #include "util/countdown_latch.h" #include "util/debug_points.h" -#include "util/runtime_profile.h" #include "util/stopwatch.hpp" -#include "vec/columns/column.h" -#include "vec/common/allocator.h" -#include "vec/core/block.h" -#include "vec/data_types/data_type.h" -#include "vec/exprs/vexpr_fwd.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/vec/sink/scale_writer_partitioning_exchanger.hpp b/be/src/exec/sink/scale_writer_partitioning_exchanger.hpp similarity index 94% rename from be/src/vec/sink/scale_writer_partitioning_exchanger.hpp rename to be/src/exec/sink/scale_writer_partitioning_exchanger.hpp index 405ac2ec552c6c..3756dbe11e7898 100644 --- a/be/src/vec/sink/scale_writer_partitioning_exchanger.hpp +++ b/be/src/exec/sink/scale_writer_partitioning_exchanger.hpp @@ -20,11 +20,11 @@ #include #include -#include "vec/core/block.h" -#include "vec/exec/skewed_partition_rebalancer.h" -#include "vec/runtime/partitioner.h" +#include "core/block/block.h" +#include "exec/connector/skewed_partition_rebalancer.h" +#include "exec/partitioner/partitioner.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class ScaleWriterPartitioner final : public PartitionerBase { public: @@ -46,8 +46,7 @@ class ScaleWriterPartitioner final : public PartitionerBase { min_partition_data_processed_rebalance_threshold), _min_data_processed_rebalance_threshold(min_data_processed_rebalance_threshold) { _crc_partitioner = - std::make_unique>( - _partition_count); + std::make_unique>(_partition_count); } ~ScaleWriterPartitioner() override = default; @@ -126,4 +125,4 @@ class ScaleWriterPartitioner final : public PartitionerBase { const long _min_data_processed_rebalance_threshold; }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/sink/tablet_sink_hash_partitioner.cpp b/be/src/exec/sink/tablet_sink_hash_partitioner.cpp similarity index 90% rename from be/src/vec/sink/tablet_sink_hash_partitioner.cpp rename to be/src/exec/sink/tablet_sink_hash_partitioner.cpp index d5547d6e277057..8501585dafd673 100644 --- a/be/src/vec/sink/tablet_sink_hash_partitioner.cpp +++ b/be/src/exec/sink/tablet_sink_hash_partitioner.cpp @@ -15,22 +15,22 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/tablet_sink_hash_partitioner.h" +#include "exec/sink/tablet_sink_hash_partitioner.h" #include #include #include -#include "pipeline/exec/operator.h" +#include "exec/operator/operator.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" TabletSinkHashPartitioner::TabletSinkHashPartitioner(uint32_t partition_count, int64_t txn_id, TOlapTableSchemaParam tablet_sink_schema, TOlapTablePartitionParam tablet_sink_partition, TOlapTableLocationParam tablet_sink_location, const TTupleId& tablet_sink_tuple_id, - pipeline::ExchangeSinkLocalState* local_state) + ExchangeSinkLocalState* local_state) : PartitionerBase(partition_count), _txn_id(txn_id), _tablet_sink_schema(std::move(tablet_sink_schema)), @@ -52,14 +52,14 @@ Status TabletSinkHashPartitioner::open(RuntimeState* state) { RETURN_IF_ERROR(_schema->init(_tablet_sink_schema)); _vpartition = std::make_unique(_schema, _tablet_sink_partition); RETURN_IF_ERROR(_vpartition->init()); - auto find_tablet_mode = vectorized::OlapTabletFinder::FindTabletMode::FIND_TABLET_EVERY_ROW; + auto find_tablet_mode = OlapTabletFinder::FindTabletMode::FIND_TABLET_EVERY_ROW; _tablet_finder = - std::make_unique(_vpartition.get(), find_tablet_mode); + std::make_unique(_vpartition.get(), find_tablet_mode); _tablet_sink_tuple_desc = state->desc_tbl().get_tuple_descriptor(_tablet_sink_tuple_id); _tablet_sink_row_desc = state->obj_pool()->add(new RowDescriptor(_tablet_sink_tuple_desc, false)); auto& ctxs = - _local_state->parent()->cast().tablet_sink_expr_ctxs(); + _local_state->parent()->cast().tablet_sink_expr_ctxs(); _tablet_sink_expr_ctxs.resize(ctxs.size()); for (size_t i = 0; i < _tablet_sink_expr_ctxs.size(); i++) { RETURN_IF_ERROR(ctxs[i]->clone(state, _tablet_sink_expr_ctxs[i])); @@ -67,7 +67,7 @@ Status TabletSinkHashPartitioner::open(RuntimeState* state) { // if _part_type == TPartitionType::OLAP_TABLE_SINK_HASH_PARTITIONED, we handle the processing of auto_increment column // on exchange node rather than on TabletWriter _block_convertor = - std::make_unique(_tablet_sink_tuple_desc); + std::make_unique(_tablet_sink_tuple_desc); _block_convertor->init_autoinc_info(_schema->db_id(), _schema->table_id(), state->batch_size()); _location = state->obj_pool()->add(new OlapTableLocationParam(_tablet_sink_location)); _row_distribution.init( @@ -99,7 +99,7 @@ Status TabletSinkHashPartitioner::do_partitioning(RuntimeState* state, Block* bl std::ranges::fill(_hash_vals, invalid_val); int64_t dummy_stats = 0; // _local_state->rows_input_counter() updated in sink and write. - std::shared_ptr convert_block = std::make_shared(); + std::shared_ptr convert_block = std::make_shared(); RETURN_IF_ERROR(_row_distribution.generate_rows_distribution( *block, convert_block, _row_part_tablet_ids, dummy_stats)); @@ -164,4 +164,4 @@ Status TabletSinkHashPartitioner::close(RuntimeState* state) { } return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/sink/tablet_sink_hash_partitioner.h b/be/src/exec/sink/tablet_sink_hash_partitioner.h similarity index 78% rename from be/src/vec/sink/tablet_sink_hash_partitioner.h rename to be/src/exec/sink/tablet_sink_hash_partitioner.h index 9f84fd429fa211..ee594814074462 100644 --- a/be/src/vec/sink/tablet_sink_hash_partitioner.h +++ b/be/src/exec/sink/tablet_sink_hash_partitioner.h @@ -17,16 +17,16 @@ #pragma once -#include "exec/tablet_info.h" -#include "pipeline/exec/exchange_sink_operator.h" +#include "core/block/block.h" +#include "exec/operator/exchange_sink_operator.h" +#include "exec/partitioner/partitioner.h" +#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 "vec/core/block.h" -#include "vec/runtime/partitioner.h" -#include "vec/sink/vrow_distribution.h" -#include "vec/sink/vtablet_block_convertor.h" -#include "vec/sink/vtablet_finder.h" +#include "storage/tablet_info.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class TabletSinkHashPartitioner final : public PartitionerBase { public: @@ -35,7 +35,7 @@ class TabletSinkHashPartitioner final : public PartitionerBase { TOlapTablePartitionParam tablet_sink_partition, TOlapTableLocationParam tablet_sink_location, const TTupleId& tablet_sink_tuple_id, - pipeline::ExchangeSinkLocalState* local_state); + ExchangeSinkLocalState* local_state); ~TabletSinkHashPartitioner() override = default; @@ -68,20 +68,20 @@ class TabletSinkHashPartitioner final : public PartitionerBase { const TOlapTablePartitionParam _tablet_sink_partition; const TOlapTableLocationParam _tablet_sink_location; const TTupleId _tablet_sink_tuple_id; - mutable pipeline::ExchangeSinkLocalState* _local_state; + mutable ExchangeSinkLocalState* _local_state; mutable OlapTableLocationParam* _location = nullptr; - mutable vectorized::VRowDistribution _row_distribution; - mutable vectorized::VExprContextSPtrs _tablet_sink_expr_ctxs; + mutable VRowDistribution _row_distribution; + mutable VExprContextSPtrs _tablet_sink_expr_ctxs; mutable std::unique_ptr _vpartition = nullptr; - mutable std::unique_ptr _tablet_finder = nullptr; + mutable std::unique_ptr _tablet_finder = nullptr; mutable std::shared_ptr _schema = nullptr; - mutable std::unique_ptr _block_convertor = nullptr; + mutable std::unique_ptr _block_convertor = nullptr; mutable TupleDescriptor* _tablet_sink_tuple_desc = nullptr; mutable RowDescriptor* _tablet_sink_row_desc = nullptr; - mutable std::vector _row_part_tablet_ids; + mutable std::vector _row_part_tablet_ids; mutable std::vector _hash_vals; mutable std::vector _skipped; }; #include "common/compile_check_end.h" -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/sink/vrow_distribution.cpp b/be/src/exec/sink/vrow_distribution.cpp similarity index 97% rename from be/src/vec/sink/vrow_distribution.cpp rename to be/src/exec/sink/vrow_distribution.cpp index b2b7a9e83e1b4d..5792cb732b5a97 100644 --- a/be/src/vec/sink/vrow_distribution.cpp +++ b/be/src/exec/sink/vrow_distribution.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/vrow_distribution.h" +#include "exec/sink/vrow_distribution.h" #include #include @@ -27,24 +27,24 @@ #include "common/cast_set.h" #include "common/logging.h" +#include "common/metrics/doris_metrics.h" #include "common/status.h" -#include "runtime/client_cache.h" +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/column/column_nullable.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type.h" +#include "exec/sink/writer/vtablet_writer.h" #include "runtime/exec_env.h" #include "runtime/query_context.h" #include "runtime/runtime_state.h" #include "service/backend_options.h" +#include "util/client_cache.h" #include "util/debug_points.h" -#include "util/doris_metrics.h" #include "util/thrift_rpc_helper.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/data_types/data_type.h" -#include "vec/sink/writer/vtablet_writer.h" - -namespace doris::vectorized { + +namespace doris { #include "common/compile_check_begin.h" std::pair VRowDistribution::_get_partition_function() { @@ -378,7 +378,7 @@ Status VRowDistribution::_deal_missing_map(const Block& input_block, Block* bloc col_strs.resize(part_col_num); col_null_maps.reserve(part_col_num); - auto format_options = vectorized::DataTypeSerDe::get_default_format_options(); + auto format_options = DataTypeSerDe::get_default_format_options(); format_options.timezone = &_state->timezone_obj(); for (int i = 0; i < part_col_num; ++i) { @@ -592,4 +592,4 @@ void VRowDistribution::_reset_find_tablets(int64_t rows) { _tablet_indexes.assign(rows, 0); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/sink/vrow_distribution.h b/be/src/exec/sink/vrow_distribution.h similarity index 96% rename from be/src/vec/sink/vrow_distribution.h rename to be/src/exec/sink/vrow_distribution.h index b0161bdd13a95a..fc26872b4bf737 100644 --- a/be/src/vec/sink/vrow_distribution.h +++ b/be/src/exec/sink/vrow_distribution.h @@ -31,17 +31,17 @@ #include #include "common/status.h" -#include "exec/tablet_info.h" +#include "core/block/block.h" +#include "core/custom_allocator.h" +#include "exec/sink/vtablet_block_convertor.h" +#include "exec/sink/vtablet_finder.h" +#include "exprs/vexpr_context.h" +#include "exprs/vexpr_fwd.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" -#include "util/runtime_profile.h" -#include "vec/common/custom_allocator.h" -#include "vec/core/block.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/sink/vtablet_block_convertor.h" -#include "vec/sink/vtablet_finder.h" - -namespace doris::vectorized { +#include "storage/tablet_info.h" + +namespace doris { #include "common/compile_check_begin.h" class IndexChannel; @@ -254,6 +254,6 @@ class VRowDistribution { std::set _new_partition_ids; // if contains, not to replace it again. }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/sink/vtablet_block_convertor.cpp b/be/src/exec/sink/vtablet_block_convertor.cpp similarity index 83% rename from be/src/vec/sink/vtablet_block_convertor.cpp rename to be/src/exec/sink/vtablet_block_convertor.cpp index 961c314422a4bd..6bfff911082a3b 100644 --- a/be/src/vec/sink/vtablet_block_convertor.cpp +++ b/be/src/exec/sink/vtablet_block_convertor.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/vtablet_block_convertor.h" +#include "exec/sink/vtablet_block_convertor.h" #include #include @@ -31,52 +31,52 @@ #include "common/compiler_util.h" // IWYU pragma: keep #include "common/consts.h" #include "common/status.h" -#include "olap/olap_common.h" -#include "runtime/define_primitive_type.h" +#include "core/assert_cast.h" +#include "core/binary_cast.hpp" +#include "core/block/block.h" +#include "core/column/column.h" +#include "core/column/column_array.h" +#include "core/column/column_const.h" +#include "core/column/column_decimal.h" +#include "core/column/column_map.h" +#include "core/column/column_nullable.h" +#include "core/column/column_string.h" +#include "core/column/column_struct.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type/data_type_decimal.h" +#include "core/data_type/data_type_factory.hpp" +#include "core/data_type/data_type_map.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/data_type_struct.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/types.h" +#include "core/wide_integer_to_string.h" +#include "exprs/function/function_helpers.h" +#include "exprs/function/simple_function_factory.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" #include "runtime/descriptors.h" -#include "runtime/primitive_type.h" #include "runtime/runtime_state.h" #include "service/brpc.h" -#include "util/binary_cast.hpp" +#include "storage/olap_common.h" #include "util/brpc_client_cache.h" #include "util/thread.h" -#include "vec/columns/column.h" -#include "vec/columns/column_array.h" -#include "vec/columns/column_const.h" -#include "vec/columns/column_decimal.h" -#include "vec/columns/column_map.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_string.h" -#include "vec/columns/column_struct.h" -#include "vec/common/assert_cast.h" -#include "vec/core/block.h" -#include "vec/core/types.h" -#include "vec/core/wide_integer_to_string.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_array.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/data_types/data_type_factory.hpp" -#include "vec/data_types/data_type_map.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/data_types/data_type_struct.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/functions/function_helpers.h" -#include "vec/functions/simple_function_factory.h" - -namespace doris::vectorized { + +namespace doris { #include "common/compile_check_begin.h" Status OlapTableBlockConvertor::validate_and_convert_block( - RuntimeState* state, vectorized::Block* input_block, - std::shared_ptr& block, vectorized::VExprContextSPtrs output_vexpr_ctxs, + RuntimeState* state, Block* input_block, + std::shared_ptr& block, VExprContextSPtrs output_vexpr_ctxs, size_t rows, bool& has_filtered_rows) { DCHECK(input_block->rows() > 0); - block = vectorized::Block::create_shared(input_block->get_columns_with_type_and_name()); + block = Block::create_shared(input_block->get_columns_with_type_and_name()); if (!output_vexpr_ctxs.empty()) { // Do vectorized expr here to speed up load - RETURN_IF_ERROR(vectorized::VExprContext::get_output_block_after_execute_exprs( + RETURN_IF_ERROR(VExprContext::get_output_block_after_execute_exprs( output_vexpr_ctxs, *input_block, block.get())); } @@ -166,11 +166,11 @@ DecimalV2Value OlapTableBlockConvertor::_get_decimalv2_min_or_max(const DataType template DecimalType OlapTableBlockConvertor::_get_decimalv3_min_or_max(const DataTypePtr& type) { std::map* pmap; - if constexpr (std::is_same_v) { + if constexpr (std::is_same_v) { pmap = IsMin ? &_min_decimal32_val : &_max_decimal32_val; - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { pmap = IsMin ? &_min_decimal64_val : &_max_decimal64_val; - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { pmap = IsMin ? &_min_decimal128_val : &_max_decimal128_val; } else { pmap = IsMin ? &_min_decimal256_val : &_max_decimal256_val; @@ -184,18 +184,18 @@ DecimalType OlapTableBlockConvertor::_get_decimalv3_min_or_max(const DataTypePtr DecimalType value; if constexpr (IsMin) { - value = vectorized::min_decimal_value(type->get_precision()); + value = min_decimal_value(type->get_precision()); } else { - value = vectorized::max_decimal_value(type->get_precision()); + value = max_decimal_value(type->get_precision()); } pmap->emplace(type->get_precision(), value.value); return value; } Status OlapTableBlockConvertor::_internal_validate_column( - RuntimeState* state, vectorized::Block* block, const DataTypePtr& type, - vectorized::ColumnPtr column, size_t slot_index, fmt::memory_buffer& error_prefix, - const size_t row_count, vectorized::IColumn::Permutation* rows) { + RuntimeState* state, Block* block, const DataTypePtr& type, + ColumnPtr column, size_t slot_index, fmt::memory_buffer& error_prefix, + const size_t row_count, IColumn::Permutation* rows) { DCHECK((rows == nullptr) || (rows->size() == row_count)); fmt::memory_buffer error_msg; auto set_invalid_and_append_error_msg = [&](size_t row) { @@ -209,7 +209,7 @@ Status OlapTableBlockConvertor::_internal_validate_column( return ret; }; - const auto* column_ptr = vectorized::check_and_get_column(*column); + const auto* column_ptr = check_and_get_column(*column); const auto& real_column_ptr = column_ptr == nullptr ? column : (column_ptr->get_nested_column_ptr()); const auto* null_map = column_ptr == nullptr ? nullptr : column_ptr->get_null_map_data().data(); @@ -221,9 +221,9 @@ Status OlapTableBlockConvertor::_internal_validate_column( // may change orig_column if substring function is performed auto string_column_checker = [&state, &error_msg, need_to_validate, set_invalid_and_append_error_msg]( - vectorized::ColumnPtr& orig_column, + ColumnPtr& orig_column, const DataTypePtr& orig_type, - vectorized::IColumn::Permutation* rows, + IColumn::Permutation* rows, const std::vector& filter_map) { int limit = config::string_type_length_soft_limit_bytes; int len = -1; @@ -238,11 +238,11 @@ Status OlapTableBlockConvertor::_internal_validate_column( } const auto* tmp_column_ptr = - vectorized::check_and_get_column(*orig_column); + check_and_get_column(*orig_column); const auto& tmp_real_column_ptr = tmp_column_ptr == nullptr ? orig_column : (tmp_column_ptr->get_nested_column_ptr()); const auto* column_string = - assert_cast(tmp_real_column_ptr.get()); + assert_cast(tmp_real_column_ptr.get()); const auto* null_map = tmp_column_ptr == nullptr ? nullptr : tmp_column_ptr->get_null_map_data().data(); @@ -282,7 +282,7 @@ Status OlapTableBlockConvertor::_internal_validate_column( {len_column, len_type, "len"}, {nullptr, input_type, "result"}}); RETURN_IF_ERROR(func->execute(nullptr, tmp_block, {0, 1, 2}, 3, row_count)); - column_string = assert_cast( + column_string = assert_cast( tmp_block.get_by_position(3).column.get()); orig_column = orig_column->is_nullable() @@ -331,7 +331,7 @@ Status OlapTableBlockConvertor::_internal_validate_column( } case TYPE_JSONB: { const auto* column_string = - assert_cast(real_column_ptr.get()); + assert_cast(real_column_ptr.get()); for (size_t j = 0; j < row_count; ++j) { if (!_filter_map[j]) { if (type->is_nullable() && column_ptr && column_ptr->is_null_at(j)) { @@ -349,14 +349,14 @@ Status OlapTableBlockConvertor::_internal_validate_column( break; } case TYPE_DECIMALV2: { - auto* column_decimal = const_cast( - assert_cast(real_column_ptr.get())); + auto* column_decimal = const_cast( + assert_cast(real_column_ptr.get())); const auto& max_decimalv2 = _get_decimalv2_min_or_max(type); const auto& min_decimalv2 = _get_decimalv2_min_or_max(type); for (size_t j = 0; j < row_count; ++j) { auto row = rows ? (*rows)[j] : j; if (need_to_validate(j, row, _filter_map, null_map)) { - auto dec_val = binary_cast( + auto dec_val = binary_cast( column_decimal->get_data()[j]); bool invalid = false; @@ -390,8 +390,8 @@ Status OlapTableBlockConvertor::_internal_validate_column( } case TYPE_DECIMAL32: { #define CHECK_VALIDATION_FOR_DECIMALV3(DecimalType) \ - auto column_decimal = const_cast*>( \ - assert_cast*>( \ + auto column_decimal = const_cast*>( \ + assert_cast*>( \ real_column_ptr.get())); \ const auto& max_decimal = _get_decimalv3_min_or_max(type); \ const auto& min_decimal = _get_decimalv3_min_or_max(type); \ @@ -422,30 +422,30 @@ Status OlapTableBlockConvertor::_internal_validate_column( } \ } \ } - CHECK_VALIDATION_FOR_DECIMALV3(vectorized::Decimal32); + CHECK_VALIDATION_FOR_DECIMALV3(Decimal32); break; } case TYPE_DECIMAL64: { - CHECK_VALIDATION_FOR_DECIMALV3(vectorized::Decimal64); + CHECK_VALIDATION_FOR_DECIMALV3(Decimal64); break; } case TYPE_DECIMAL128I: { - CHECK_VALIDATION_FOR_DECIMALV3(vectorized::Decimal128V3); + CHECK_VALIDATION_FOR_DECIMALV3(Decimal128V3); break; } case TYPE_DECIMAL256: { - CHECK_VALIDATION_FOR_DECIMALV3(vectorized::Decimal256); + CHECK_VALIDATION_FOR_DECIMALV3(Decimal256); break; } #undef CHECK_VALIDATION_FOR_DECIMALV3 case TYPE_ARRAY: { const auto* column_array = - assert_cast(real_column_ptr.get()); + assert_cast(real_column_ptr.get()); const auto* type_array = - assert_cast(remove_nullable(type).get()); + assert_cast(remove_nullable(type).get()); auto nested_type = type_array->get_nested_type(); const auto& offsets = column_array->get_offsets(); - vectorized::IColumn::Permutation permutation(offsets.back()); + IColumn::Permutation permutation(offsets.back()); for (size_t r = 0; r < row_count; ++r) { for (size_t c = offsets[r - 1]; c < offsets[r]; ++c) { permutation[c] = rows ? (*rows)[r] : r; @@ -459,7 +459,7 @@ Status OlapTableBlockConvertor::_internal_validate_column( case TYPE_STRING: { RETURN_IF_ERROR( string_column_checker(data_column_ptr, nested_type, &permutation, _filter_map)); - const_cast(column_array)->get_data_ptr() = + const_cast(column_array)->get_data_ptr() = std::move(data_column_ptr); break; } @@ -471,15 +471,15 @@ Status OlapTableBlockConvertor::_internal_validate_column( break; } case TYPE_MAP: { - const auto* column_map = assert_cast(real_column_ptr.get()); + const auto* column_map = assert_cast(real_column_ptr.get()); RETURN_IF_ERROR((const_cast(column_map))->deduplicate_keys(true)); const auto* type_map = - assert_cast(remove_nullable(type).get()); + assert_cast(remove_nullable(type).get()); auto key_type = type_map->get_key_type(); auto val_type = type_map->get_value_type(); const auto& offsets = column_map->get_offsets(); - vectorized::IColumn::Permutation permutation(offsets.back()); + IColumn::Permutation permutation(offsets.back()); for (size_t r = 0; r < row_count; ++r) { for (size_t c = offsets[r - 1]; c < offsets[r]; ++c) { permutation[c] = rows ? (*rows)[r] : r; @@ -494,7 +494,7 @@ Status OlapTableBlockConvertor::_internal_validate_column( auto key_column_ptr = column_map->get_keys_ptr(); RETURN_IF_ERROR( string_column_checker(key_column_ptr, key_type, &permutation, _filter_map)); - const_cast(column_map)->get_keys_ptr() = + const_cast(column_map)->get_keys_ptr() = std::move(key_column_ptr); break; } @@ -512,7 +512,7 @@ Status OlapTableBlockConvertor::_internal_validate_column( auto value_column_ptr = column_map->get_values_ptr(); RETURN_IF_ERROR( string_column_checker(value_column_ptr, val_type, &permutation, _filter_map)); - const_cast(column_map)->get_values_ptr() = + const_cast(column_map)->get_values_ptr() = std::move(value_column_ptr); break; } @@ -526,9 +526,9 @@ Status OlapTableBlockConvertor::_internal_validate_column( } case TYPE_STRUCT: { const auto column_struct = - assert_cast(real_column_ptr.get()); + assert_cast(real_column_ptr.get()); const auto* type_struct = - assert_cast(remove_nullable(type).get()); + assert_cast(remove_nullable(type).get()); DCHECK(type_struct->get_elements().size() == column_struct->tuple_size()); fmt::format_to(error_prefix, "STRUCT type failed: "); for (size_t sc = 0; sc < column_struct->tuple_size(); ++sc) { @@ -540,7 +540,7 @@ Status OlapTableBlockConvertor::_internal_validate_column( auto element_column_ptr = column_struct->get_column_ptr(sc); RETURN_IF_ERROR(string_column_checker(element_column_ptr, element_type, nullptr, _filter_map)); - const_cast(column_struct)->get_column_ptr(sc) = + const_cast(column_struct)->get_column_ptr(sc) = std::move(element_column_ptr); break; } @@ -555,7 +555,7 @@ Status OlapTableBlockConvertor::_internal_validate_column( break; } case TYPE_AGG_STATE: { - auto* column_string = vectorized::check_and_get_column(*real_column_ptr); + auto* column_string = check_and_get_column(*real_column_ptr); if (column_string) { RETURN_IF_ERROR(string_column_checker(column, type, rows, _filter_map)); } @@ -583,7 +583,7 @@ Status OlapTableBlockConvertor::_internal_validate_column( return Status::OK(); } -Status OlapTableBlockConvertor::_validate_data(RuntimeState* state, vectorized::Block* block, +Status OlapTableBlockConvertor::_validate_data(RuntimeState* state, Block* block, const size_t rows, int& filtered_rows) { filtered_rows = 0; Defer defer {[&] { @@ -605,20 +605,20 @@ Status OlapTableBlockConvertor::_validate_data(RuntimeState* state, vectorized:: return Status::OK(); } -void OlapTableBlockConvertor::_convert_to_dest_desc_block(doris::vectorized::Block* block) { +void OlapTableBlockConvertor::_convert_to_dest_desc_block(doris::Block* block) { for (int i = 0; i < _output_tuple_desc->slots().size() && i < block->columns(); ++i) { SlotDescriptor* desc = _output_tuple_desc->slots()[i]; if (desc->is_nullable() != block->get_by_position(i).type->is_nullable()) { if (desc->is_nullable()) { block->get_by_position(i).type = - vectorized::make_nullable(block->get_by_position(i).type); + make_nullable(block->get_by_position(i).type); block->get_by_position(i).column = - vectorized::make_nullable(block->get_by_position(i).column); + make_nullable(block->get_by_position(i).column); } else { - block->get_by_position(i).type = assert_cast( + block->get_by_position(i).type = assert_cast( *block->get_by_position(i).type) .get_nested_type(); - block->get_by_position(i).column = assert_cast( + block->get_by_position(i).column = assert_cast( *block->get_by_position(i).column) .get_nested_column_ptr(); } @@ -626,19 +626,19 @@ void OlapTableBlockConvertor::_convert_to_dest_desc_block(doris::vectorized::Blo } } -Status OlapTableBlockConvertor::_fill_auto_inc_cols(vectorized::Block* block, size_t rows) { +Status OlapTableBlockConvertor::_fill_auto_inc_cols(Block* block, size_t rows) { size_t idx = _auto_inc_col_idx.value(); SlotDescriptor* slot = _output_tuple_desc->slots()[idx]; DCHECK(slot->type()->get_primitive_type() == PrimitiveType::TYPE_BIGINT); DCHECK(!slot->is_nullable()); size_t null_value_count = 0; - auto dst_column = vectorized::ColumnInt64::create(); - vectorized::ColumnInt64::Container& dst_values = dst_column->get_data(); + auto dst_column = ColumnInt64::create(); + ColumnInt64::Container& dst_values = dst_column->get_data(); - vectorized::ColumnPtr src_column_ptr = block->get_by_position(idx).column; + ColumnPtr src_column_ptr = block->get_by_position(idx).column; if (const auto* const_column = - check_and_get_column(src_column_ptr.get())) { + check_and_get_column(src_column_ptr.get())) { // for insert stmt like "insert into tbl1 select null,col1,col2,... from tbl2" or // "insert into tbl1 select 1,col1,col2,... from tbl2", the type of literal's column // will be `ColumnConst` @@ -662,7 +662,7 @@ Status OlapTableBlockConvertor::_fill_auto_inc_cols(vectorized::Block* block, si dst_values.resize_fill(rows, value); } } else if (const auto* src_nullable_column = - check_and_get_column(src_column_ptr.get())) { + check_and_get_column(src_column_ptr.get())) { auto src_nested_column_ptr = src_nullable_column->get_nested_column_ptr(); const auto& null_map_data = src_nullable_column->get_null_map_data(); dst_values.reserve(rows); @@ -687,10 +687,10 @@ Status OlapTableBlockConvertor::_fill_auto_inc_cols(vectorized::Block* block, si return Status::OK(); } -Status OlapTableBlockConvertor::_partial_update_fill_auto_inc_cols(vectorized::Block* block, +Status OlapTableBlockConvertor::_partial_update_fill_auto_inc_cols(Block* block, size_t rows) { - auto dst_column = vectorized::ColumnInt64::create(); - vectorized::ColumnInt64::Container& dst_values = dst_column->get_data(); + auto dst_column = ColumnInt64::create(); + ColumnInt64::Container& dst_values = dst_column->get_data(); size_t null_value_count = rows; std::vector> res; RETURN_IF_ERROR(_auto_inc_id_buffer->sync_request_ids(null_value_count, &res)); @@ -701,10 +701,10 @@ Status OlapTableBlockConvertor::_partial_update_fill_auto_inc_cols(vectorized::B for (size_t i = 0; i < rows; i++) { dst_values.emplace_back(_auto_inc_id_allocator.next_id()); } - block->insert(vectorized::ColumnWithTypeAndName(std::move(dst_column), + block->insert(ColumnWithTypeAndName(std::move(dst_column), std::make_shared(), BeConsts::PARTIAL_UPDATE_AUTO_INC_COL)); return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/sink/vtablet_block_convertor.h b/be/src/exec/sink/vtablet_block_convertor.h similarity index 67% rename from be/src/vec/sink/vtablet_block_convertor.h rename to be/src/exec/sink/vtablet_block_convertor.h index 1856e5a5147695..e25e47568c5464 100644 --- a/be/src/vec/sink/vtablet_block_convertor.h +++ b/be/src/exec/sink/vtablet_block_convertor.h @@ -25,17 +25,16 @@ #include #include "common/status.h" -#include "runtime/decimalv2_value.h" +#include "core/block/block.h" +#include "core/column/column.h" +#include "core/data_type/data_type_factory.hpp" +#include "core/value/decimalv2_value.h" +#include "exec/sink/autoinc_buffer.h" +#include "exprs/vexpr_fwd.h" #include "runtime/descriptors.h" -#include "runtime/types.h" #include "util/bitmap.h" -#include "vec/columns/column.h" -#include "vec/core/block.h" -#include "vec/data_types/data_type_factory.hpp" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/sink/autoinc_buffer.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class OlapTableBlockConvertor { @@ -43,9 +42,9 @@ class OlapTableBlockConvertor { OlapTableBlockConvertor(TupleDescriptor* output_tuple_desc) : _output_tuple_desc(output_tuple_desc) {} - Status validate_and_convert_block(RuntimeState* state, vectorized::Block* input_block, - std::shared_ptr& block, - vectorized::VExprContextSPtrs output_vexpr_ctxs, size_t rows, + Status validate_and_convert_block(RuntimeState* state, Block* input_block, + std::shared_ptr& block, + VExprContextSPtrs output_vexpr_ctxs, size_t rows, bool& has_filtered_rows); const char* filter_map() const { return _filter_map.data(); } @@ -67,35 +66,32 @@ class OlapTableBlockConvertor { template DecimalType _get_decimalv3_min_or_max(const DataTypePtr& type); - Status _validate_column(RuntimeState* state, vectorized::Block* block, const DataTypePtr& type, - vectorized::ColumnPtr column, size_t slot_index, - fmt::memory_buffer& error_prefix, const size_t row_count, - vectorized::IColumn::Permutation* rows = nullptr) { + Status _validate_column(RuntimeState* state, Block* block, const DataTypePtr& type, + ColumnPtr column, size_t slot_index, fmt::memory_buffer& error_prefix, + const size_t row_count, IColumn::Permutation* rows = nullptr) { RETURN_IF_CATCH_EXCEPTION({ return _internal_validate_column(state, block, type, column, slot_index, error_prefix, row_count, rows); }); } - Status _internal_validate_column(RuntimeState* state, vectorized::Block* block, - const DataTypePtr& type, vectorized::ColumnPtr column, - size_t slot_index, fmt::memory_buffer& error_prefix, - const size_t row_count, - vectorized::IColumn::Permutation* rows = nullptr); + Status _internal_validate_column(RuntimeState* state, Block* block, const DataTypePtr& type, + ColumnPtr column, size_t slot_index, + fmt::memory_buffer& error_prefix, const size_t row_count, + IColumn::Permutation* rows = nullptr); // make input data valid for OLAP table // return number of invalid/filtered rows. // invalid row number is set in Bitmap - Status _validate_data(RuntimeState* state, vectorized::Block* block, const size_t rows, - int& filtered_rows); + Status _validate_data(RuntimeState* state, Block* block, const size_t rows, int& filtered_rows); // some output column of output expr may have different nullable property with dest slot desc // so here need to do the convert operation - void _convert_to_dest_desc_block(vectorized::Block* block); + void _convert_to_dest_desc_block(Block* block); - Status _fill_auto_inc_cols(vectorized::Block* block, size_t rows); + Status _fill_auto_inc_cols(Block* block, size_t rows); - Status _partial_update_fill_auto_inc_cols(vectorized::Block* block, size_t rows); + Status _partial_update_fill_auto_inc_cols(Block* block, size_t rows); TupleDescriptor* _output_tuple_desc = nullptr; @@ -123,5 +119,5 @@ class OlapTableBlockConvertor { bool _is_partial_update_and_auto_inc = false; }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/sink/vtablet_finder.cpp b/be/src/exec/sink/vtablet_finder.cpp similarity index 96% rename from be/src/vec/sink/vtablet_finder.cpp rename to be/src/exec/sink/vtablet_finder.cpp index 580becb77eae85..5a0a38fb3784bf 100644 --- a/be/src/vec/sink/vtablet_finder.cpp +++ b/be/src/exec/sink/vtablet_finder.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/vtablet_finder.h" +#include "exec/sink/vtablet_finder.h" #include #include @@ -27,11 +27,11 @@ #include "common/compiler_util.h" // IWYU pragma: keep #include "common/status.h" -#include "exec/tablet_info.h" +#include "core/block/block.h" #include "runtime/runtime_state.h" -#include "vec/core/block.h" +#include "storage/tablet_info.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" Status OlapTabletFinder::find_tablets(RuntimeState* state, Block* block, int rows, std::vector& partitions, @@ -101,4 +101,4 @@ Status OlapTabletFinder::find_tablets(RuntimeState* state, Block* block, int row return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/sink/vtablet_finder.h b/be/src/exec/sink/vtablet_finder.h similarity index 87% rename from be/src/vec/sink/vtablet_finder.h rename to be/src/exec/sink/vtablet_finder.h index 3adece57ce76e6..ce1f0299ad97fa 100644 --- a/be/src/vec/sink/vtablet_finder.h +++ b/be/src/exec/sink/vtablet_finder.h @@ -21,12 +21,12 @@ #include #include "common/status.h" -#include "exec/tablet_info.h" +#include "core/block/block.h" +#include "exec/common/hash_table/phmap_fwd_decl.h" +#include "storage/tablet_info.h" #include "util/bitmap.h" -#include "vec/common/hash_table/phmap_fwd_decl.h" -#include "vec/core/block.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class OlapTabletFinder { @@ -43,7 +43,7 @@ class OlapTabletFinder { OlapTabletFinder(VOlapTablePartitionParam* vpartition, FindTabletMode mode) : _vpartition(vpartition), _find_tablet_mode(mode), _filter_bitmap(1024) {}; - Status find_tablets(RuntimeState* state, vectorized::Block* block, int rows, + Status find_tablets(RuntimeState* state, Block* block, int rows, std::vector& partitions, std::vector& tablet_index, std::vector& skip, std::vector* miss_rows = nullptr); @@ -55,7 +55,7 @@ class OlapTabletFinder { bool is_single_tablet() { return _partition_to_tablet_map.size() == 1; } // all partitions for multi find-processes of its relative writer. - const vectorized::flat_hash_set& partition_ids() { return _partition_ids; } + const flat_hash_set& partition_ids() { return _partition_ids; } int64_t num_filtered_rows() const { return _num_filtered_rows; } @@ -69,12 +69,12 @@ class OlapTabletFinder { VOlapTablePartitionParam* _vpartition = nullptr; FindTabletMode _find_tablet_mode; std::map _partition_to_tablet_map; - vectorized::flat_hash_set _partition_ids; + flat_hash_set _partition_ids; int64_t _num_filtered_rows = 0; int64_t _num_immutable_partition_filtered_rows = 0; Bitmap _filter_bitmap; }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/sink/writer/async_result_writer.cpp b/be/src/exec/sink/writer/async_result_writer.cpp similarity index 91% rename from be/src/vec/sink/writer/async_result_writer.cpp rename to be/src/exec/sink/writer/async_result_writer.cpp index 21421b34a60bc9..00d274507712ab 100644 --- a/be/src/vec/sink/writer/async_result_writer.cpp +++ b/be/src/exec/sink/writer/async_result_writer.cpp @@ -15,28 +15,27 @@ // specific language governing permissions and limitations // under the License. -#include "async_result_writer.h" +#include "exec/sink/writer/async_result_writer.h" #include "common/status.h" -#include "pipeline/dependency.h" +#include "core/block/block.h" +#include "core/block/materialize_block.h" +#include "exec/pipeline/dependency.h" +#include "exprs/vexpr_context.h" #include "runtime/exec_env.h" #include "runtime/fragment_mgr.h" #include "runtime/runtime_state.h" -#include "vec/core/block.h" -#include "vec/core/materialize_block.h" -#include "vec/exprs/vexpr_context.h" namespace doris { class ObjectPool; class RowDescriptor; class TExpr; -namespace vectorized { #include "common/compile_check_begin.h" -AsyncResultWriter::AsyncResultWriter(const doris::vectorized::VExprContextSPtrs& output_expr_ctxs, - std::shared_ptr dep, - std::shared_ptr fin_dep) +AsyncResultWriter::AsyncResultWriter(const doris::VExprContextSPtrs& output_expr_ctxs, + std::shared_ptr dep, + std::shared_ptr fin_dep) : _vec_output_expr_ctxs(output_expr_ctxs), _dependency(dep), _finish_dependency(fin_dep) {} Status AsyncResultWriter::sink(Block* block, bool eos) { @@ -222,14 +221,13 @@ void AsyncResultWriter::_set_ready_to_finish() { _finish_dependency->set_ready(); } -Status AsyncResultWriter::_projection_block(doris::vectorized::Block& input_block, - doris::vectorized::Block* output_block) { +Status AsyncResultWriter::_projection_block(doris::Block& input_block, doris::Block* output_block) { Status status = Status::OK(); if (input_block.rows() == 0) { return status; } - RETURN_IF_ERROR(vectorized::VExprContext::get_output_block_after_execute_exprs( - _vec_output_expr_ctxs, input_block, output_block)); + RETURN_IF_ERROR(VExprContext::get_output_block_after_execute_exprs(_vec_output_expr_ctxs, + input_block, output_block)); materialize_block_inplace(*output_block); return status; } @@ -255,8 +253,7 @@ void AsyncResultWriter::_return_free_block(std::unique_ptr b) { } } -std::unique_ptr AsyncResultWriter::_get_free_block(doris::vectorized::Block* block, - size_t rows) { +std::unique_ptr AsyncResultWriter::_get_free_block(doris::Block* block, size_t rows) { std::unique_ptr b; if (!_free_blocks.try_dequeue(b)) { b = block->create_same_struct_block(rows, true); @@ -274,5 +271,4 @@ void AsyncResultWriter::set_low_memory_mode() { _low_memory_mode = true; clear_blocks(_free_blocks, _memory_used_counter); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/async_result_writer.h b/be/src/exec/sink/writer/async_result_writer.h similarity index 88% rename from be/src/vec/sink/writer/async_result_writer.h rename to be/src/exec/sink/writer/async_result_writer.h index dce1f5a773d992..99d4f8eaa59eff 100644 --- a/be/src/vec/sink/writer/async_result_writer.h +++ b/be/src/exec/sink/writer/async_result_writer.h @@ -21,9 +21,9 @@ #include #include // IWYU pragma: keep -#include "runtime/result_writer.h" -#include "util/runtime_profile.h" -#include "vec/exprs/vexpr_fwd.h" +#include "exec/sink/writer/result_writer.h" +#include "exprs/vexpr_fwd.h" +#include "runtime/runtime_profile.h" namespace doris { class ObjectPool; @@ -32,13 +32,9 @@ class RuntimeState; class TDataSink; class TExpr; -namespace pipeline { class Dependency; class PipelineTask; -} // namespace pipeline - -namespace vectorized { class Block; /* * In the pipeline execution engine, there are usually a large number of io operations on the sink side that @@ -54,9 +50,8 @@ class Block; */ class AsyncResultWriter : public ResultWriter { public: - AsyncResultWriter(const VExprContextSPtrs& output_expr_ctxs, - std::shared_ptr dep, - std::shared_ptr fin_dep); + AsyncResultWriter(const VExprContextSPtrs& output_expr_ctxs, std::shared_ptr dep, + std::shared_ptr fin_dep); void force_close(Status s); @@ -99,12 +94,11 @@ class AsyncResultWriter : public ResultWriter { bool _eos = false; std::atomic_bool _low_memory_mode = false; - std::shared_ptr _dependency; - std::shared_ptr _finish_dependency; + std::shared_ptr _dependency; + std::shared_ptr _finish_dependency; moodycamel::ConcurrentQueue> _free_blocks; RuntimeProfile::Counter* _memory_used_counter = nullptr; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/iceberg/partition_data.h b/be/src/exec/sink/writer/iceberg/partition_data.h similarity index 85% rename from be/src/vec/sink/writer/iceberg/partition_data.h rename to be/src/exec/sink/writer/iceberg/partition_data.h index d3dfb1e8eccb87..33500c7b806e73 100644 --- a/be/src/vec/sink/writer/iceberg/partition_data.h +++ b/be/src/exec/sink/writer/iceberg/partition_data.h @@ -17,15 +17,14 @@ #pragma once -#include "vec/exec/format/table/iceberg/struct_like.h" +#include "format/table/iceberg/struct_like.h" namespace doris { -namespace vectorized { #include "common/compile_check_begin.h" -class PartitionData : public iceberg::StructLike { +class IcebergPartitionData : public iceberg::StructLike { public: - explicit PartitionData(std::vector partition_values) + explicit IcebergPartitionData(std::vector partition_values) : _partition_values(std::move(partition_values)) {} std::any get(size_t pos) const override { @@ -39,6 +38,5 @@ class PartitionData : public iceberg::StructLike { std::vector _partition_values; }; -} // namespace vectorized } // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/sink/writer/iceberg/partition_transformers.cpp b/be/src/exec/sink/writer/iceberg/partition_transformers.cpp similarity index 98% rename from be/src/vec/sink/writer/iceberg/partition_transformers.cpp rename to be/src/exec/sink/writer/iceberg/partition_transformers.cpp index 7159dfb6f12c5c..8b49d68573c1e4 100644 --- a/be/src/vec/sink/writer/iceberg/partition_transformers.cpp +++ b/be/src/exec/sink/writer/iceberg/partition_transformers.cpp @@ -15,15 +15,14 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/writer/iceberg/partition_transformers.h" +#include "exec/sink/writer/iceberg/partition_transformers.h" #include -#include "vec/core/types.h" -#include "vec/exec/format/table/iceberg/partition_spec.h" +#include "core/types.h" +#include "format/table/iceberg/partition_spec.h" namespace doris { -namespace vectorized { const std::chrono::sys_days PartitionColumnTransformUtils::EPOCH = std::chrono::sys_days( std::chrono::year {1970} / std::chrono::January / std::chrono::day {1}); @@ -281,5 +280,4 @@ std::string PartitionColumnTransform::get_partition_value(const DataTypePtr type return "null"; } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/iceberg/partition_transformers.h b/be/src/exec/sink/writer/iceberg/partition_transformers.h similarity index 97% rename from be/src/vec/sink/writer/iceberg/partition_transformers.h rename to be/src/exec/sink/writer/iceberg/partition_transformers.h index be97a2a25e26a9..bf00849452bc6d 100644 --- a/be/src/vec/sink/writer/iceberg/partition_transformers.h +++ b/be/src/exec/sink/writer/iceberg/partition_transformers.h @@ -17,11 +17,10 @@ #pragma once -#include "runtime/types.h" +#include "core/data_type/data_type_factory.hpp" +#include "exec/common/stringop_substring.h" +#include "exprs/function/function_string.h" #include "util/bit_util.h" -#include "vec/data_types/data_type_factory.hpp" -#include "vec/functions/function_string.h" -#include "vec/utils/stringop_substring.h" namespace doris { @@ -30,7 +29,6 @@ class Type; class PartitionField; }; // namespace iceberg -namespace vectorized { #include "common/compile_check_begin.h" class IColumn; @@ -216,7 +214,7 @@ class IntegerTruncatePartitionColumnTransform : public PartitionColumnTransform bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -273,7 +271,7 @@ class BigintTruncatePartitionColumnTransform : public PartitionColumnTransform { bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -391,7 +389,7 @@ class IntBucketPartitionColumnTransform : public PartitionColumnTransform { bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -452,7 +450,7 @@ class BigintBucketPartitionColumnTransform : public PartitionColumnTransform { bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -515,7 +513,7 @@ class DecimalBucketPartitionColumnTransform : public PartitionColumnTransform { bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -589,7 +587,7 @@ class DateBucketPartitionColumnTransform : public PartitionColumnTransform { bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -655,7 +653,7 @@ class TimestampBucketPartitionColumnTransform : public PartitionColumnTransform bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -733,7 +731,7 @@ class StringBucketPartitionColumnTransform : public PartitionColumnTransform { bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -795,7 +793,7 @@ class DateYearPartitionColumnTransform : public PartitionColumnTransform { bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -864,7 +862,7 @@ class TimestampYearPartitionColumnTransform : public PartitionColumnTransform { bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -933,7 +931,7 @@ class DateMonthPartitionColumnTransform : public PartitionColumnTransform { bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -1002,7 +1000,7 @@ class TimestampMonthPartitionColumnTransform : public PartitionColumnTransform { bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -1071,7 +1069,7 @@ class DateDayPartitionColumnTransform : public PartitionColumnTransform { bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -1145,7 +1143,7 @@ class TimestampDayPartitionColumnTransform : public PartitionColumnTransform { bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -1218,7 +1216,7 @@ class TimestampHourPartitionColumnTransform : public PartitionColumnTransform { bool is_nullable = false; if (column_ptr->is_nullable()) { const ColumnNullable* nullable_column = - reinterpret_cast(column_ptr.get()); + reinterpret_cast(column_ptr.get()); is_nullable = true; null_map_column_ptr = nullable_column->get_null_map_column_ptr(); column_ptr = nullable_column->get_nested_column_ptr(); @@ -1297,6 +1295,5 @@ class VoidPartitionColumnTransform : public PartitionColumnTransform { DataTypePtr _target_type; }; -} // namespace vectorized } // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/sink/writer/iceberg/viceberg_partition_writer.cpp b/be/src/exec/sink/writer/iceberg/viceberg_partition_writer.cpp similarity index 95% rename from be/src/vec/sink/writer/iceberg/viceberg_partition_writer.cpp rename to be/src/exec/sink/writer/iceberg/viceberg_partition_writer.cpp index f5c4ed1dd545ff..1ae396f309e7b6 100644 --- a/be/src/vec/sink/writer/iceberg/viceberg_partition_writer.cpp +++ b/be/src/exec/sink/writer/iceberg/viceberg_partition_writer.cpp @@ -15,21 +15,20 @@ // specific language governing permissions and limitations // under the License. -#include "viceberg_partition_writer.h" +#include "exec/sink/writer/iceberg/viceberg_partition_writer.h" #include #include +#include "core/block/materialize_block.h" +#include "core/column/column_map.h" +#include "format/table/iceberg/schema.h" +#include "format/transformer/vorc_transformer.h" +#include "format/transformer/vparquet_transformer.h" #include "io/file_factory.h" #include "runtime/runtime_state.h" -#include "vec/columns/column_map.h" -#include "vec/core/materialize_block.h" -#include "vec/exec/format/table/iceberg/schema.h" -#include "vec/runtime/vorc_transformer.h" -#include "vec/runtime/vparquet_transformer.h" namespace doris { -namespace vectorized { VIcebergPartitionWriter::VIcebergPartitionWriter( const TDataSink& t_sink, std::vector partition_values, @@ -133,7 +132,7 @@ Status VIcebergPartitionWriter::close(const Status& status) { return result_status; } -Status VIcebergPartitionWriter::write(vectorized::Block& block) { +Status VIcebergPartitionWriter::write(Block& block) { RETURN_IF_ERROR(_file_format_transformer->write(block)); _row_count += block.rows(); return Status::OK(); @@ -208,5 +207,4 @@ std::string VIcebergPartitionWriter::_get_target_file_name() { _get_file_extension(_file_format_type, _compress_type)); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/iceberg/viceberg_partition_writer.h b/be/src/exec/sink/writer/iceberg/viceberg_partition_writer.h similarity index 92% rename from be/src/vec/sink/writer/iceberg/viceberg_partition_writer.h rename to be/src/exec/sink/writer/iceberg/viceberg_partition_writer.h index b4db050dd7136f..97b4dd3efdfac0 100644 --- a/be/src/vec/sink/writer/iceberg/viceberg_partition_writer.h +++ b/be/src/exec/sink/writer/iceberg/viceberg_partition_writer.h @@ -19,11 +19,11 @@ #include +#include "exec/sink/writer/iceberg/vpartition_writer_base.h" +#include "exprs/vexpr_fwd.h" +#include "format/table/iceberg/schema.h" +#include "format/transformer/vfile_format_transformer.h" #include "io/fs/file_writer.h" -#include "vec/exec/format/table/iceberg/schema.h" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/runtime/vfile_format_transformer.h" -#include "vec/sink/writer/iceberg/vpartition_writer_base.h" namespace doris { namespace io { @@ -38,8 +38,6 @@ namespace iceberg { class Schema; } -namespace vectorized { - class Block; class VFileFormatTransformer; @@ -58,7 +56,7 @@ class VIcebergPartitionWriter : public IPartitionWriterBase { Status open(RuntimeState* state, RuntimeProfile* profile, const RowDescriptor* row_desc) override; - Status write(vectorized::Block& block) override; + Status write(Block& block) override; Status close(const Status& status) override; @@ -104,5 +102,4 @@ class VIcebergPartitionWriter : public IPartitionWriterBase { RuntimeState* _state; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/iceberg/viceberg_sort_writer.cpp b/be/src/exec/sink/writer/iceberg/viceberg_sort_writer.cpp similarity index 94% rename from be/src/vec/sink/writer/iceberg/viceberg_sort_writer.cpp rename to be/src/exec/sink/writer/iceberg/viceberg_sort_writer.cpp index f3dfda3f7665d3..5be94279a3a945 100644 --- a/be/src/vec/sink/writer/iceberg/viceberg_sort_writer.cpp +++ b/be/src/exec/sink/writer/iceberg/viceberg_sort_writer.cpp @@ -15,14 +15,14 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/writer/iceberg/viceberg_sort_writer.h" +#include "exec/sink/writer/iceberg/viceberg_sort_writer.h" +#include "exec/spill/spill_stream.h" +#include "exec/spill/spill_stream_manager.h" #include "runtime/exec_env.h" #include "runtime/runtime_state.h" -#include "vec/spill/spill_stream.h" -#include "vec/spill/spill_stream_manager.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" Status VIcebergSortWriter::open(RuntimeState* state, RuntimeProfile* profile, @@ -40,9 +40,8 @@ Status VIcebergSortWriter::open(RuntimeState* state, RuntimeProfile* profile, // Create FullSorter for in-memory sorting with spill support enabled. // Parameters: limit=-1 (no limit), offset=0 (no offset) - _sorter = vectorized::FullSorter::create_unique(_vsort_exec_exprs, -1, 0, &_pool, - _sort_info.is_asc_order, _sort_info.nulls_first, - *row_desc, state, _profile); + _sorter = FullSorter::create_unique(_vsort_exec_exprs, -1, 0, &_pool, _sort_info.is_asc_order, + _sort_info.nulls_first, *row_desc, state, _profile); _sorter->init_profile(_profile); // Enable spill support so the sorter can be used with the spill framework _sorter->set_enable_spill(); @@ -53,7 +52,7 @@ Status VIcebergSortWriter::open(RuntimeState* state, RuntimeProfile* profile, return Status::OK(); } -Status VIcebergSortWriter::write(vectorized::Block& block) { +Status VIcebergSortWriter::write(Block& block) { // Append incoming block data to the sorter's internal buffer RETURN_IF_ERROR(_sorter->append_block(&block)); _update_spill_block_batch_row_count(block); @@ -149,7 +148,7 @@ Status VIcebergSortWriter::close(const Status& status) { return close_status; } -void VIcebergSortWriter::_update_spill_block_batch_row_count(const vectorized::Block& block) { +void VIcebergSortWriter::_update_spill_block_batch_row_count(const Block& block) { auto rows = block.rows(); // Calculate average row size from the first non-empty block to determine // the optimal batch size for spill operations @@ -327,9 +326,9 @@ int VIcebergSortWriter::_calc_max_merge_streams() const { Status VIcebergSortWriter::_create_merger(bool is_final_merge, size_t batch_size, int num_streams) { // Create a multi-way merge sorter that reads from multiple sorted spill streams - std::vector child_block_suppliers; - _merger = std::make_unique(_sorter->get_sort_description(), - batch_size, -1, 0, _profile); + std::vector child_block_suppliers; + _merger = std::make_unique(_sorter->get_sort_description(), batch_size, -1, 0, + _profile); _current_merging_streams.clear(); // For final merge: merge all remaining streams @@ -341,7 +340,7 @@ Status VIcebergSortWriter::_create_merger(bool is_final_merge, size_t batch_size stream->set_read_counters(_profile); _current_merging_streams.emplace_back(stream); // Create a block supplier lambda that reads the next block from the spill stream - child_block_suppliers.emplace_back([stream](vectorized::Block* block, bool* eos) { + child_block_suppliers.emplace_back([stream](Block* block, bool* eos) { return stream->read_next_block_sync(block, eos); }); _sorted_streams.pop_front(); @@ -371,4 +370,4 @@ void VIcebergSortWriter::_cleanup_spill_streams() { } #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/sink/writer/iceberg/viceberg_sort_writer.h b/be/src/exec/sink/writer/iceberg/viceberg_sort_writer.h similarity index 91% rename from be/src/vec/sink/writer/iceberg/viceberg_sort_writer.h rename to be/src/exec/sink/writer/iceberg/viceberg_sort_writer.h index 3df0f5a7d283d5..0348a048d07a62 100644 --- a/be/src/vec/sink/writer/iceberg/viceberg_sort_writer.h +++ b/be/src/exec/sink/writer/iceberg/viceberg_sort_writer.h @@ -23,28 +23,26 @@ #include #include "common/object_pool.h" -#include "util/runtime_profile.h" -#include "vec/common/sort/sorter.h" -#include "vec/core/block.h" -#include "vec/sink/writer/iceberg/viceberg_partition_writer.h" -#include "vec/sink/writer/iceberg/vpartition_writer_base.h" +#include "core/block/block.h" +#include "exec/sink/writer/iceberg/viceberg_partition_writer.h" +#include "exec/sink/writer/iceberg/vpartition_writer_base.h" +#include "exec/sort/sorter.h" +#include "runtime/runtime_profile.h" // Forward declarations to minimize header dependencies. // Previously, spill_stream.h and spill_stream_manager.h were included directly // in this header, causing heavy transitive includes for all files that include // viceberg_sort_writer.h. Moving implementations to .cpp allows us to forward-declare // these types and only include their headers in the .cpp file. -namespace doris::vectorized { +namespace doris { class SpillStream; using SpillStreamSPtr = std::shared_ptr; -} // namespace doris::vectorized +} // namespace doris namespace doris { class RuntimeState; class RuntimeProfile; -namespace vectorized { - /** * VIcebergSortWriter is a decorator around VIcebergPartitionWriter that adds sort-order support. * @@ -88,7 +86,7 @@ class VIcebergSortWriter : public IPartitionWriterBase { const RowDescriptor* row_desc) override; // Append data block to the sorter; triggers flush when target file size is reached - Status write(vectorized::Block& block) override; + Status write(Block& block) override; // Sort remaining data, perform multi-way merge if spill occurred, and close the writer. // Error handling: Tracks internal errors from intermediate operations and propagates @@ -115,7 +113,7 @@ class VIcebergSortWriter : public IPartitionWriterBase { private: // Calculate average row size from the first non-empty block to determine // the optimal batch row count for spill operations - void _update_spill_block_batch_row_count(const vectorized::Block& block); + void _update_spill_block_batch_row_count(const Block& block); // Sort in-memory data and flush to a Parquet/ORC file, then open a new writer Status _flush_to_file(); @@ -169,12 +167,12 @@ class VIcebergSortWriter : public IPartitionWriterBase { CreateWriterLambda _create_writer_lambda; // Sorter and merger for handling in-memory sorting and multi-way merge - std::unique_ptr _sorter; - std::unique_ptr _merger; + std::unique_ptr _sorter; + std::unique_ptr _merger; // Queue of spill streams waiting to be merged (FIFO order) - std::deque _sorted_streams; + std::deque _sorted_streams; // Streams currently being consumed by the merger - std::vector _current_merging_streams; + std::vector _current_merging_streams; // Target file size in bytes; files are split when this threshold is exceeded // Default: config::iceberg_sink_max_file_size (1GB) @@ -188,5 +186,4 @@ class VIcebergSortWriter : public IPartitionWriterBase { RuntimeProfile::Counter* _do_spill_count_counter = nullptr; }; -} // namespace vectorized } // namespace doris \ No newline at end of file diff --git a/be/src/vec/sink/writer/iceberg/viceberg_table_writer.cpp b/be/src/exec/sink/writer/iceberg/viceberg_table_writer.cpp similarity index 92% rename from be/src/vec/sink/writer/iceberg/viceberg_table_writer.cpp rename to be/src/exec/sink/writer/iceberg/viceberg_table_writer.cpp index 9b495f093a5967..33fbf49b96069d 100644 --- a/be/src/vec/sink/writer/iceberg/viceberg_table_writer.cpp +++ b/be/src/exec/sink/writer/iceberg/viceberg_table_writer.cpp @@ -15,31 +15,30 @@ // specific language governing permissions and limitations // under the License. -#include "viceberg_table_writer.h" - +#include "exec/sink/writer/iceberg/viceberg_table_writer.h" + +#include "core/block/block.h" +#include "core/block/column_with_type_and_name.h" +#include "core/block/materialize_block.h" +#include "core/column/column_const.h" +#include "core/data_type_serde/data_type_serde.h" +#include "exec/sink/writer/iceberg/partition_transformers.h" +#include "exec/sink/writer/iceberg/viceberg_partition_writer.h" +#include "exec/sink/writer/iceberg/viceberg_sort_writer.h" +#include "exec/sink/writer/vhive_utils.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" +#include "format/table/iceberg/partition_spec_parser.h" +#include "format/table/iceberg/schema_parser.h" #include "runtime/runtime_state.h" -#include "vec/columns/column_const.h" -#include "vec/core/block.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/core/materialize_block.h" -#include "vec/data_types/serde/data_type_serde.h" -#include "vec/exec/format/table/iceberg/partition_spec_parser.h" -#include "vec/exec/format/table/iceberg/schema_parser.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/sink/writer/iceberg/partition_transformers.h" -#include "vec/sink/writer/iceberg/viceberg_partition_writer.h" -#include "vec/sink/writer/iceberg/viceberg_sort_writer.h" -#include "vec/sink/writer/vhive_utils.h" namespace doris { -namespace vectorized { #include "common/compile_check_begin.h" VIcebergTableWriter::VIcebergTableWriter(const TDataSink& t_sink, const VExprContextSPtrs& output_expr_ctxs, - std::shared_ptr dep, - std::shared_ptr fin_dep) + std::shared_ptr dep, + std::shared_ptr fin_dep) : AsyncResultWriter(output_expr_ctxs, dep, fin_dep), _t_sink(t_sink) { DCHECK(_t_sink.__isset.iceberg_table_sink); } @@ -180,14 +179,14 @@ std::string VIcebergTableWriter::_build_static_partition_path() { return ss.str(); } -Status VIcebergTableWriter::write(RuntimeState* state, vectorized::Block& block) { +Status VIcebergTableWriter::write(RuntimeState* state, Block& block) { SCOPED_RAW_TIMER(&_send_data_ns); if (block.rows() == 0) { return Status::OK(); } Block output_block; - RETURN_IF_ERROR(vectorized::VExprContext::get_output_block_after_execute_exprs( - _vec_output_expr_ctxs, block, &output_block, false)); + RETURN_IF_ERROR(VExprContext::get_output_block_after_execute_exprs(_vec_output_expr_ctxs, block, + &output_block, false)); materialize_block_inplace(output_block); std::unordered_map, IColumn::Filter> writer_positions; @@ -304,7 +303,7 @@ Status VIcebergTableWriter::write(RuntimeState* state, vectorized::Block& block) } } for (int i = 0; i < output_block.rows(); ++i) { - std::optional partition_data; + std::optional partition_data; try { partition_data = _get_partition_data(&transformed_block, i); } catch (doris::Exception& e) { @@ -383,12 +382,11 @@ Status VIcebergTableWriter::write(RuntimeState* state, vectorized::Block& block) return Status::OK(); } -Status VIcebergTableWriter::_filter_block(doris::vectorized::Block& block, - const vectorized::IColumn::Filter* filter, - doris::vectorized::Block* output_block) { +Status VIcebergTableWriter::_filter_block(doris::Block& block, const IColumn::Filter* filter, + doris::Block* output_block) { const ColumnsWithTypeAndName& columns_with_type_and_name = block.get_columns_with_type_and_name(); - vectorized::ColumnsWithTypeAndName result_columns; + ColumnsWithTypeAndName result_columns; for (const auto& col : columns_with_type_and_name) { result_columns.emplace_back(col.column->clone_resized(col.column->size()), col.type, col.name); @@ -493,8 +491,7 @@ std::vector VIcebergTableWriter::_partition_values( } std::shared_ptr VIcebergTableWriter::_create_partition_writer( - vectorized::Block* transformed_block, int position, const std::string* file_name, - int file_name_index) { + Block* transformed_block, int position, const std::string* file_name, int file_name_index) { auto& iceberg_table_sink = _t_sink.iceberg_table_sink; std::vector partition_values; const std::string& output_path = iceberg_table_sink.output_path; @@ -518,7 +515,7 @@ std::shared_ptr VIcebergTableWriter::_create_partition_wri } else if (transformed_block != nullptr) { // Case 2: Dynamic partition or Hybrid mode (partial static + partial dynamic) // _partition_to_path and _partition_values already handle hybrid mode internally - PartitionData partition_data = _get_partition_data(transformed_block, position); + IcebergPartitionData partition_data = _get_partition_data(transformed_block, position); std::string partition_path = _partition_to_path(partition_data); partition_values = _partition_values(partition_data); original_write_path = @@ -572,8 +569,8 @@ std::shared_ptr VIcebergTableWriter::_create_partition_wri return partition_write; } -PartitionData VIcebergTableWriter::_get_partition_data(vectorized::Block* transformed_block, - int position) { +IcebergPartitionData VIcebergTableWriter::_get_partition_data(Block* transformed_block, + int position) { DCHECK(!_iceberg_partition_columns.empty()); std::vector values; values.reserve(_iceberg_partition_columns.size()); @@ -582,7 +579,7 @@ PartitionData VIcebergTableWriter::_get_partition_data(vectorized::Block* transf if (_has_static_partition && _partition_column_is_static[column_idx]) { values.emplace_back(); } else { - const vectorized::ColumnWithTypeAndName& partition_column = + const ColumnWithTypeAndName& partition_column = transformed_block->get_by_position(column_idx); auto value = _get_iceberg_partition_value( iceberg_partition_column.partition_column_transform() @@ -593,7 +590,7 @@ PartitionData VIcebergTableWriter::_get_partition_data(vectorized::Block* transf } ++column_idx; } - return PartitionData(std::move(values)); + return IcebergPartitionData(std::move(values)); } std::any VIcebergTableWriter::_get_iceberg_partition_value( @@ -603,8 +600,7 @@ std::any VIcebergTableWriter::_get_iceberg_partition_value( ColumnPtr col_ptr = partition_column.column->convert_to_full_column_if_const(); CHECK(col_ptr); if (col_ptr->is_nullable()) { - const auto* nullable_column = - reinterpret_cast(col_ptr.get()); + const auto* nullable_column = reinterpret_cast(col_ptr.get()); const auto* __restrict null_map_data = nullable_column->get_null_map_data().data(); if (null_map_data[position]) { return {}; @@ -616,8 +612,7 @@ std::any VIcebergTableWriter::_get_iceberg_partition_value( auto [item, size] = col_ptr->get_data_at(position); switch (type_desc) { case TYPE_BOOLEAN: { - vectorized::Field field = - vectorized::check_and_get_column(*col_ptr)->operator[](position); + Field field = check_and_get_column(*col_ptr)->operator[](position); return field.get(); } case TYPE_TINYINT: { @@ -685,5 +680,4 @@ std::string VIcebergTableWriter::_compute_file_name() { return fmt::format("{}_{}", print_id(_state->query_id()), uuid_str); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/iceberg/viceberg_table_writer.h b/be/src/exec/sink/writer/iceberg/viceberg_table_writer.h similarity index 85% rename from be/src/vec/sink/writer/iceberg/viceberg_table_writer.h rename to be/src/exec/sink/writer/iceberg/viceberg_table_writer.h index 0ef79bf9d757ef..6ce6eadf30ac65 100644 --- a/be/src/vec/sink/writer/iceberg/viceberg_table_writer.h +++ b/be/src/exec/sink/writer/iceberg/viceberg_table_writer.h @@ -19,23 +19,21 @@ #include -#include "util/runtime_profile.h" -#include "vec/columns/column.h" -#include "vec/core/block.h" -#include "vec/exec/format/table/iceberg/partition_spec_parser.h" -#include "vec/exec/format/table/iceberg/schema_parser.h" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/sink/writer/async_result_writer.h" -#include "vec/sink/writer/iceberg/partition_data.h" -#include "vec/sink/writer/iceberg/partition_transformers.h" +#include "core/block/block.h" +#include "core/column/column.h" +#include "exec/sink/writer/async_result_writer.h" +#include "exec/sink/writer/iceberg/partition_data.h" +#include "exec/sink/writer/iceberg/partition_transformers.h" +#include "exprs/vexpr_fwd.h" +#include "format/table/iceberg/partition_spec_parser.h" +#include "format/table/iceberg/schema_parser.h" +#include "runtime/runtime_profile.h" namespace doris { class ObjectPool; class RuntimeState; -namespace vectorized { - class IColumn; class IPartitionWriterBase; class VIcebergSortWriter; @@ -44,8 +42,7 @@ struct ColumnWithTypeAndName; class VIcebergTableWriter final : public AsyncResultWriter { public: VIcebergTableWriter(const TDataSink& t_sink, const VExprContextSPtrs& output_exprs, - std::shared_ptr dep, - std::shared_ptr fin_dep); + std::shared_ptr dep, std::shared_ptr fin_dep); ~VIcebergTableWriter() = default; @@ -56,7 +53,7 @@ class VIcebergTableWriter final : public AsyncResultWriter { Status open(RuntimeState* state, RuntimeProfile* profile) override; - Status write(RuntimeState* state, vectorized::Block& block) override; + Status write(RuntimeState* state, Block& block) override; Status close(Status) override; @@ -112,10 +109,10 @@ class VIcebergTableWriter final : public AsyncResultWriter { std::string _build_static_partition_path(); std::shared_ptr _create_partition_writer( - vectorized::Block* transformed_block, int position, - const std::string* file_name = nullptr, int file_name_index = 0); + Block* transformed_block, int position, const std::string* file_name = nullptr, + int file_name_index = 0); - PartitionData _get_partition_data(vectorized::Block* block, int position); + IcebergPartitionData _get_partition_data(Block* block, int position); std::any _get_iceberg_partition_value(const PrimitiveType& type_desc, const ColumnWithTypeAndName& partition_column, @@ -123,8 +120,8 @@ class VIcebergTableWriter final : public AsyncResultWriter { std::string _compute_file_name(); - Status _filter_block(doris::vectorized::Block& block, const vectorized::IColumn::Filter* filter, - doris::vectorized::Block* output_block); + Status _filter_block(doris::Block& block, const IColumn::Filter* filter, + doris::Block* output_block); // Currently it is a copy, maybe it is better to use move semantics to eliminate it. TDataSink _t_sink; @@ -176,5 +173,4 @@ class VIcebergTableWriter final : public AsyncResultWriter { RuntimeProfile::Counter* _close_timer = nullptr; RuntimeProfile::Counter* _write_file_counter = nullptr; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/iceberg/vpartition_writer_base.h b/be/src/exec/sink/writer/iceberg/vpartition_writer_base.h similarity index 94% rename from be/src/vec/sink/writer/iceberg/vpartition_writer_base.h rename to be/src/exec/sink/writer/iceberg/vpartition_writer_base.h index 1afd75f40ddcf3..dc70f64679597a 100644 --- a/be/src/vec/sink/writer/iceberg/vpartition_writer_base.h +++ b/be/src/exec/sink/writer/iceberg/vpartition_writer_base.h @@ -27,8 +27,6 @@ class ObjectPool; class RuntimeState; class RuntimeProfile; -namespace vectorized { - // IPartitionWriterBase // ├── VIcebergPartitionWriter // └── VIcebergSortWriter @@ -50,7 +48,7 @@ class IPartitionWriterBase { virtual Status open(RuntimeState* state, RuntimeProfile* profile, const RowDescriptor* row_desc) = 0; - virtual Status write(vectorized::Block& block) = 0; + virtual Status write(Block& block) = 0; virtual Status close(const Status& status) = 0; @@ -60,5 +58,4 @@ class IPartitionWriterBase { virtual size_t written_len() const = 0; }; -} // namespace vectorized } // namespace doris \ No newline at end of file diff --git a/be/src/vec/sink/writer/maxcompute/vmc_partition_writer.cpp b/be/src/exec/sink/writer/maxcompute/vmc_partition_writer.cpp similarity index 93% rename from be/src/vec/sink/writer/maxcompute/vmc_partition_writer.cpp rename to be/src/exec/sink/writer/maxcompute/vmc_partition_writer.cpp index c9dfc31c8cc7ee..ef1e6f069da875 100644 --- a/be/src/vec/sink/writer/maxcompute/vmc_partition_writer.cpp +++ b/be/src/exec/sink/writer/maxcompute/vmc_partition_writer.cpp @@ -15,13 +15,12 @@ // specific language governing permissions and limitations // under the License. -#include "vmc_partition_writer.h" +#include "exec/sink/writer/maxcompute/vmc_partition_writer.h" +#include "format/transformer/vjni_format_transformer.h" #include "runtime/runtime_state.h" -#include "vec/runtime/vjni_format_transformer.h" namespace doris { -namespace vectorized { VMCPartitionWriter::VMCPartitionWriter(RuntimeState* state, const VExprContextSPtrs& output_vexpr_ctxs, @@ -39,7 +38,7 @@ Status VMCPartitionWriter::open() { return _jni_format_transformer->open(); } -Status VMCPartitionWriter::write(vectorized::Block& block) { +Status VMCPartitionWriter::write(Block& block) { RETURN_IF_ERROR(_jni_format_transformer->write(block)); _row_count += block.rows(); return Status::OK(); @@ -81,5 +80,4 @@ TMCCommitData VMCPartitionWriter::_build_mc_commit_data() { return commit_data; } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/maxcompute/vmc_partition_writer.h b/be/src/exec/sink/writer/maxcompute/vmc_partition_writer.h similarity index 93% rename from be/src/vec/sink/writer/maxcompute/vmc_partition_writer.h rename to be/src/exec/sink/writer/maxcompute/vmc_partition_writer.h index 85ee84211b3d65..fb1c6c737d80a6 100644 --- a/be/src/vec/sink/writer/maxcompute/vmc_partition_writer.h +++ b/be/src/exec/sink/writer/maxcompute/vmc_partition_writer.h @@ -23,7 +23,7 @@ #include #include "common/status.h" -#include "vec/exprs/vexpr_fwd.h" +#include "exprs/vexpr_fwd.h" namespace doris { @@ -31,8 +31,6 @@ class ObjectPool; class RuntimeState; class RuntimeProfile; -namespace vectorized { - class Block; class VJniFormatTransformer; @@ -43,7 +41,7 @@ class VMCPartitionWriter { std::map writer_params); Status open(); - Status write(vectorized::Block& block); + Status write(Block& block); Status close(const Status& status); private: @@ -59,5 +57,4 @@ class VMCPartitionWriter { size_t _row_count = 0; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/maxcompute/vmc_table_writer.cpp b/be/src/exec/sink/writer/maxcompute/vmc_table_writer.cpp similarity index 92% rename from be/src/vec/sink/writer/maxcompute/vmc_table_writer.cpp rename to be/src/exec/sink/writer/maxcompute/vmc_table_writer.cpp index ff183b488fdcd0..689d212783a484 100644 --- a/be/src/vec/sink/writer/maxcompute/vmc_table_writer.cpp +++ b/be/src/exec/sink/writer/maxcompute/vmc_table_writer.cpp @@ -15,23 +15,21 @@ // specific language governing permissions and limitations // under the License. -#include "vmc_table_writer.h" +#include "exec/sink/writer/maxcompute/vmc_table_writer.h" +#include "core/block/materialize_block.h" +#include "exec/sink/writer/maxcompute/vmc_partition_writer.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" +#include "format/transformer/vjni_format_transformer.h" #include "runtime/runtime_state.h" #include "util/uid_util.h" -#include "vec/core/materialize_block.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/runtime/vjni_format_transformer.h" -#include "vec/sink/writer/maxcompute/vmc_partition_writer.h" namespace doris { -namespace vectorized { #include "common/compile_check_begin.h" VMCTableWriter::VMCTableWriter(const TDataSink& t_sink, const VExprContextSPtrs& output_expr_ctxs, - std::shared_ptr dep, - std::shared_ptr fin_dep) + std::shared_ptr dep, std::shared_ptr fin_dep) : AsyncResultWriter(output_expr_ctxs, dep, fin_dep), _t_sink(t_sink), _mc_sink(_t_sink.max_compute_table_sink) { @@ -137,15 +135,15 @@ std::shared_ptr VMCTableWriter::_create_partition_writer( std::move(params)); } -Status VMCTableWriter::write(RuntimeState* state, vectorized::Block& block) { +Status VMCTableWriter::write(RuntimeState* state, Block& block) { SCOPED_RAW_TIMER(&_send_data_ns); if (block.rows() == 0) { return Status::OK(); } Block output_block; - RETURN_IF_ERROR(vectorized::VExprContext::get_output_block_after_execute_exprs( - _vec_output_expr_ctxs, block, &output_block, false)); + RETURN_IF_ERROR(VExprContext::get_output_block_after_execute_exprs(_vec_output_expr_ctxs, block, + &output_block, false)); materialize_block_inplace(output_block); _row_count += output_block.rows(); @@ -204,5 +202,4 @@ Status VMCTableWriter::close(Status status) { return result_status; } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/maxcompute/vmc_table_writer.h b/be/src/exec/sink/writer/maxcompute/vmc_table_writer.h similarity index 87% rename from be/src/vec/sink/writer/maxcompute/vmc_table_writer.h rename to be/src/exec/sink/writer/maxcompute/vmc_table_writer.h index 613667e7257eed..24075e47a062ec 100644 --- a/be/src/vec/sink/writer/maxcompute/vmc_table_writer.h +++ b/be/src/exec/sink/writer/maxcompute/vmc_table_writer.h @@ -23,26 +23,23 @@ #include #include -#include "util/runtime_profile.h" -#include "vec/columns/column.h" -#include "vec/core/block.h" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/sink/writer/async_result_writer.h" +#include "core/block/block.h" +#include "core/column/column.h" +#include "exec/sink/writer/async_result_writer.h" +#include "exprs/vexpr_fwd.h" +#include "runtime/runtime_profile.h" namespace doris { class ObjectPool; class RuntimeState; -namespace vectorized { - class VMCPartitionWriter; class VMCTableWriter final : public AsyncResultWriter { public: VMCTableWriter(const TDataSink& t_sink, const VExprContextSPtrs& output_exprs, - std::shared_ptr dep, - std::shared_ptr fin_dep); + std::shared_ptr dep, std::shared_ptr fin_dep); ~VMCTableWriter() = default; @@ -50,7 +47,7 @@ class VMCTableWriter final : public AsyncResultWriter { Status open(RuntimeState* state, RuntimeProfile* profile) override; - Status write(RuntimeState* state, vectorized::Block& block) override; + Status write(RuntimeState* state, Block& block) override; Status close(Status) override; @@ -96,5 +93,4 @@ class VMCTableWriter final : public AsyncResultWriter { RuntimeProfile::Counter* _partition_writers_count = nullptr; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/runtime/result_writer.h b/be/src/exec/sink/writer/result_writer.h similarity index 94% rename from be/src/runtime/result_writer.h rename to be/src/exec/sink/writer/result_writer.h index df1b7a808d9c8a..01b6d7c8b56d87 100644 --- a/be/src/runtime/result_writer.h +++ b/be/src/exec/sink/writer/result_writer.h @@ -25,9 +25,7 @@ namespace doris { -namespace vectorized { class Block; -} class RuntimeState; // abstract class of the result writer @@ -47,7 +45,7 @@ class ResultWriter { [[nodiscard]] bool output_object_data() const { return _output_object_data; } // Write is sync, it will do real IO work. - virtual Status write(RuntimeState* state, vectorized::Block& block) = 0; + virtual Status write(RuntimeState* state, Block& block) = 0; void set_output_object_data(bool output_object_data) { _output_object_data = output_object_data; diff --git a/be/src/vec/sink/varrow_flight_result_writer.cpp b/be/src/exec/sink/writer/varrow_flight_result_writer.cpp similarity index 93% rename from be/src/vec/sink/varrow_flight_result_writer.cpp rename to be/src/exec/sink/writer/varrow_flight_result_writer.cpp index 6c9c393ae4a8fa..fa20e42f0e791e 100644 --- a/be/src/vec/sink/varrow_flight_result_writer.cpp +++ b/be/src/exec/sink/writer/varrow_flight_result_writer.cpp @@ -15,19 +15,19 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/varrow_flight_result_writer.h" +#include "exec/sink/writer/varrow_flight_result_writer.h" #include #include #include +#include "core/block/block.h" +#include "exprs/vexpr_context.h" #include "runtime/result_block_buffer.h" #include "runtime/runtime_state.h" #include "runtime/thread_context.h" -#include "vec/core/block.h" -#include "vec/exprs/vexpr_context.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" void GetArrowResultBatchCtx::on_failure(const Status& status) { @@ -44,7 +44,7 @@ void GetArrowResultBatchCtx::on_close(int64_t packet_seq, int64_t /* returned_ro _done->Run(); } -Status GetArrowResultBatchCtx::on_data(const std::shared_ptr& block, +Status GetArrowResultBatchCtx::on_data(const std::shared_ptr& block, const int64_t packet_seq, ResultBlockBufferBase* buffer) { if (_result != nullptr) { auto* arrow_buffer = assert_cast(buffer); @@ -97,7 +97,7 @@ Status ArrowFlightResultBlockBuffer::get_schema(std::shared_ptr* print_id(_fragment_id), _status)); } -Status ArrowFlightResultBlockBuffer::get_arrow_batch(std::shared_ptr* result) { +Status ArrowFlightResultBlockBuffer::get_arrow_batch(std::shared_ptr* result) { std::unique_lock l(_lock); Defer defer {[&]() { _update_dependency(); }}; if (!_status.ok()) { @@ -178,10 +178,10 @@ Status VArrowFlightResultWriter::write(RuntimeState* state, Block& input_block) { SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(_sinker->mem_tracker()); - std::unique_ptr mutable_block = - vectorized::MutableBlock::create_unique(block.clone_empty()); + std::unique_ptr mutable_block = + MutableBlock::create_unique(block.clone_empty()); RETURN_IF_ERROR(mutable_block->merge_ignore_overflow(std::move(block))); - std::shared_ptr output_block = vectorized::Block::create_shared(); + std::shared_ptr output_block = Block::create_shared(); output_block->swap(mutable_block->to_block()); auto num_rows = output_block->rows(); @@ -212,4 +212,4 @@ Status VArrowFlightResultWriter::close(Status st) { return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/sink/varrow_flight_result_writer.h b/be/src/exec/sink/writer/varrow_flight_result_writer.h similarity index 90% rename from be/src/vec/sink/varrow_flight_result_writer.h rename to be/src/exec/sink/writer/varrow_flight_result_writer.h index d1f5e21404a07f..2d0420ed777cc2 100644 --- a/be/src/vec/sink/varrow_flight_result_writer.h +++ b/be/src/exec/sink/writer/varrow_flight_result_writer.h @@ -18,22 +18,21 @@ #pragma once #include "common/status.h" +#include "exec/sink/writer/result_writer.h" +#include "exprs/vexpr_fwd.h" #include "runtime/result_block_buffer.h" -#include "runtime/result_writer.h" -#include "util/runtime_profile.h" -#include "vec/exprs/vexpr_fwd.h" +#include "runtime/runtime_profile.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; class PFetchArrowDataResult; -namespace vectorized { class Block; class GetArrowResultBatchCtx { public: - using ResultType = vectorized::Block; + using ResultType = Block; ENABLE_FACTORY_CREATOR(GetArrowResultBatchCtx) GetArrowResultBatchCtx(PFetchArrowDataResult* result, google::protobuf::Closure* done) : _result(result), _done(done) {} @@ -44,8 +43,8 @@ class GetArrowResultBatchCtx { MOCK_FUNCTION void on_failure(const Status& status); MOCK_FUNCTION void on_close(int64_t packet_seq, int64_t /* returned_rows */); - MOCK_FUNCTION Status on_data(const std::shared_ptr& block, - const int64_t packet_seq, ResultBlockBufferBase* buffer); + MOCK_FUNCTION Status on_data(const std::shared_ptr& block, const int64_t packet_seq, + ResultBlockBufferBase* buffer); private: #ifndef BE_TEST @@ -59,7 +58,7 @@ class GetArrowResultBatchCtx { class ArrowFlightResultBlockBuffer final : public ResultBlockBuffer { public: - using ResultType = vectorized::Block; + using ResultType = Block; ArrowFlightResultBlockBuffer(TUniqueId id, RuntimeState* state, std::shared_ptr schema, int buffer_size) : ResultBlockBuffer(id, state, buffer_size), @@ -71,7 +70,7 @@ class ArrowFlightResultBlockBuffer final : public ResultBlockBuffer* result); + Status get_arrow_batch(std::shared_ptr* result); void get_timezone(cctz::time_zone& timezone_obj) { timezone_obj = _timezone_obj; } Status get_schema(std::shared_ptr* arrow_schema); @@ -119,7 +118,6 @@ class VArrowFlightResultWriter final : public ResultWriter { uint64_t _bytes_sent = 0; }; -} // namespace vectorized } // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/sink/writer/vfile_result_writer.cpp b/be/src/exec/sink/writer/vfile_result_writer.cpp similarity index 94% rename from be/src/vec/sink/writer/vfile_result_writer.cpp rename to be/src/exec/sink/writer/vfile_result_writer.cpp index edec869ab36d7a..d7e4149c551d7b 100644 --- a/be/src/vec/sink/writer/vfile_result_writer.cpp +++ b/be/src/exec/sink/writer/vfile_result_writer.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vfile_result_writer.h" +#include "exec/sink/writer/vfile_result_writer.h" #include #include @@ -30,6 +30,22 @@ #include "common/compiler_util.h" // IWYU pragma: keep #include "common/consts.h" #include "common/status.h" +#include "core/block/block.h" +#include "core/column/column_string.h" +#include "core/column/column_vector.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/value/decimalv2_value.h" +#include "core/value/large_int_value.h" +#include "exec/operator/result_sink_operator.h" +#include "exec/sink/writer/vmysql_result_writer.h" +#include "exprs/function/cast/cast_to_string.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" +#include "format/transformer/vcsv_transformer.h" +#include "format/transformer/vnative_transformer.h" +#include "format/transformer/vorc_transformer.h" +#include "format/transformer/vparquet_transformer.h" #include "io/file_factory.h" #include "io/fs/broker_file_system.h" #include "io/fs/file_system.h" @@ -38,12 +54,7 @@ #include "io/fs/local_file_system.h" #include "io/fs/s3_file_system.h" #include "io/hdfs_builder.h" -#include "pipeline/exec/result_sink_operator.h" -#include "runtime/decimalv2_value.h" -#include "runtime/define_primitive_type.h" #include "runtime/descriptors.h" -#include "runtime/large_int_value.h" -#include "runtime/primitive_type.h" #include "runtime/result_block_buffer.h" #include "runtime/runtime_state.h" #include "service/backend_options.h" @@ -51,38 +62,27 @@ #include "util/s3_uri.h" #include "util/s3_util.h" #include "util/uid_util.h" -#include "vec/columns/column_string.h" -#include "vec/columns/column_vector.h" -#include "vec/core/block.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/functions/cast/cast_to_string.h" -#include "vec/runtime/vcsv_transformer.h" -#include "vec/runtime/vnative_transformer.h" -#include "vec/runtime/vorc_transformer.h" -#include "vec/runtime/vparquet_transformer.h" -#include "vec/sink/vmysql_result_writer.h" - -namespace doris::vectorized { + +namespace doris { static double nons_to_second = 1000000000.00; VFileResultWriter::VFileResultWriter(const TDataSink& t_sink, const VExprContextSPtrs& output_exprs, - std::shared_ptr dep, - std::shared_ptr fin_dep) + std::shared_ptr dep, + std::shared_ptr fin_dep) : AsyncResultWriter(output_exprs, dep, fin_dep) {} VFileResultWriter::VFileResultWriter( - const pipeline::ResultFileOptions* file_opts, const TStorageBackendType::type storage_type, + const ResultFileOptions* file_opts, const TStorageBackendType::type storage_type, const TUniqueId fragment_instance_id, const VExprContextSPtrs& output_vexpr_ctxs, std::shared_ptr sinker, Block* output_block, bool output_object_data, - const RowDescriptor& output_row_descriptor, std::shared_ptr dep, - std::shared_ptr fin_dep) + const RowDescriptor& output_row_descriptor, std::shared_ptr dep, + std::shared_ptr fin_dep) : AsyncResultWriter(output_vexpr_ctxs, dep, fin_dep), _file_opts(file_opts), _storage_type(storage_type), _fragment_instance_id(fragment_instance_id), - _sinker(std::dynamic_pointer_cast(sinker)), + _sinker(std::dynamic_pointer_cast(sinker)), _output_block(output_block), _output_row_descriptor(output_row_descriptor) { _output_object_data = output_object_data; @@ -488,4 +488,4 @@ Status VFileResultWriter::close(Status exec_status) { return st; } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/sink/writer/vfile_result_writer.h b/be/src/exec/sink/writer/vfile_result_writer.h similarity index 88% rename from be/src/vec/sink/writer/vfile_result_writer.h rename to be/src/exec/sink/writer/vfile_result_writer.h index 4982b3f200bda0..601f1db90de5c5 100644 --- a/be/src/vec/sink/writer/vfile_result_writer.h +++ b/be/src/exec/sink/writer/vfile_result_writer.h @@ -28,45 +28,39 @@ #include #include "common/status.h" +#include "core/block/block.h" +#include "exec/sink/writer/async_result_writer.h" +#include "format/transformer/vfile_format_transformer.h" #include "io/fs/file_writer.h" #include "runtime/descriptors.h" #include "runtime/result_block_buffer.h" -#include "util/runtime_profile.h" -#include "vec/core/block.h" -#include "vec/runtime/vfile_format_transformer.h" -#include "vec/sink/writer/async_result_writer.h" +#include "runtime/runtime_profile.h" namespace doris { class ResultBlockBufferBase; class RuntimeState; -namespace vectorized { class GetResultBatchCtx; using MySQLResultBlockBuffer = ResultBlockBuffer; class VExprContext; -} // namespace vectorized -namespace pipeline { struct ResultFileOptions; -} } // namespace doris -namespace doris::vectorized { +namespace doris { // write result to file class VFileResultWriter final : public AsyncResultWriter { public: - VFileResultWriter(const pipeline::ResultFileOptions* file_option, + VFileResultWriter(const ResultFileOptions* file_option, const TStorageBackendType::type storage_type, const TUniqueId fragment_instance_id, const VExprContextSPtrs& _output_vexpr_ctxs, std::shared_ptr sinker, Block* output_block, bool output_object_data, const RowDescriptor& output_row_descriptor, - std::shared_ptr dep, - std::shared_ptr fin_dep); + std::shared_ptr dep, std::shared_ptr fin_dep); VFileResultWriter(const TDataSink& t_sink, const VExprContextSPtrs& output_exprs, - std::shared_ptr dep, - std::shared_ptr fin_dep); + std::shared_ptr dep, std::shared_ptr fin_dep); Status write(RuntimeState* state, Block& block) override; @@ -108,7 +102,7 @@ class VFileResultWriter final : public AsyncResultWriter { private: RuntimeState* _state; // not owned, set when init - const pipeline::ResultFileOptions* _file_opts = nullptr; + const ResultFileOptions* _file_opts = nullptr; TStorageBackendType::type _storage_type; TUniqueId _fragment_instance_id; @@ -153,4 +147,4 @@ class VFileResultWriter final : public AsyncResultWriter { std::string_view _header_type; std::string_view _header; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/sink/writer/vhive_partition_writer.cpp b/be/src/exec/sink/writer/vhive_partition_writer.cpp similarity index 96% rename from be/src/vec/sink/writer/vhive_partition_writer.cpp rename to be/src/exec/sink/writer/vhive_partition_writer.cpp index bbff86095b5920..686732b4712e06 100644 --- a/be/src/vec/sink/writer/vhive_partition_writer.cpp +++ b/be/src/exec/sink/writer/vhive_partition_writer.cpp @@ -15,21 +15,20 @@ // specific language governing permissions and limitations // under the License. -#include "vhive_partition_writer.h" +#include "exec/sink/writer/vhive_partition_writer.h" #include +#include "core/block/materialize_block.h" +#include "core/column/column_map.h" +#include "format/transformer/vcsv_transformer.h" +#include "format/transformer/vorc_transformer.h" +#include "format/transformer/vparquet_transformer.h" #include "io/file_factory.h" #include "io/fs/s3_file_writer.h" #include "runtime/runtime_state.h" -#include "vec/columns/column_map.h" -#include "vec/core/materialize_block.h" -#include "vec/runtime/vcsv_transformer.h" -#include "vec/runtime/vorc_transformer.h" -#include "vec/runtime/vparquet_transformer.h" namespace doris { -namespace vectorized { VHivePartitionWriter::VHivePartitionWriter(const TDataSink& t_sink, std::string partition_name, TUpdateMode::type update_mode, @@ -141,7 +140,7 @@ Status VHivePartitionWriter::close(const Status& status) { return result_status; } -Status VHivePartitionWriter::write(vectorized::Block& block) { +Status VHivePartitionWriter::write(Block& block) { RETURN_IF_ERROR(_file_format_transformer->write(block)); _row_count += block.rows(); return Status::OK(); @@ -237,5 +236,4 @@ std::string VHivePartitionWriter::_get_target_file_name() { _get_file_extension(_file_format_type, _hive_compress_type)); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/vhive_partition_writer.h b/be/src/exec/sink/writer/vhive_partition_writer.h similarity index 94% rename from be/src/vec/sink/writer/vhive_partition_writer.h rename to be/src/exec/sink/writer/vhive_partition_writer.h index 20ca6506704a0d..e958db505c178b 100644 --- a/be/src/vec/sink/writer/vhive_partition_writer.h +++ b/be/src/exec/sink/writer/vhive_partition_writer.h @@ -19,10 +19,10 @@ #include +#include "core/column/column.h" +#include "exprs/vexpr_fwd.h" +#include "format/transformer/vfile_format_transformer.h" #include "io/fs/file_writer.h" -#include "vec/columns/column.h" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/runtime/vfile_format_transformer.h" namespace doris { namespace io { @@ -34,8 +34,6 @@ class RuntimeState; class RuntimeProfile; class THiveColumn; -namespace vectorized { - class Block; class VFileFormatTransformer; @@ -63,7 +61,7 @@ class VHivePartitionWriter { Status open(RuntimeState* state, RuntimeProfile* profile); - Status write(vectorized::Block& block); + Status write(Block& block); Status close(const Status& status); @@ -112,5 +110,4 @@ class VHivePartitionWriter { RuntimeState* _state; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/vhive_table_writer.cpp b/be/src/exec/sink/writer/vhive_table_writer.cpp similarity index 94% rename from be/src/vec/sink/writer/vhive_table_writer.cpp rename to be/src/exec/sink/writer/vhive_table_writer.cpp index d99fe86535c420..453b00515e3b5c 100644 --- a/be/src/vec/sink/writer/vhive_table_writer.cpp +++ b/be/src/exec/sink/writer/vhive_table_writer.cpp @@ -15,26 +15,25 @@ // specific language governing permissions and limitations // under the License. -#include "vhive_table_writer.h" - +#include "exec/sink/writer/vhive_table_writer.h" + +#include "core/block/block.h" +#include "core/block/column_with_type_and_name.h" +#include "core/block/materialize_block.h" +#include "exec/sink/writer/vhive_partition_writer.h" +#include "exec/sink/writer/vhive_utils.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" -#include "util/runtime_profile.h" -#include "vec/core/block.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/core/materialize_block.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/sink/writer/vhive_partition_writer.h" -#include "vec/sink/writer/vhive_utils.h" namespace doris { -namespace vectorized { #include "common/compile_check_begin.h" VHiveTableWriter::VHiveTableWriter(const TDataSink& t_sink, const VExprContextSPtrs& output_expr_ctxs, - std::shared_ptr dep, - std::shared_ptr fin_dep) + std::shared_ptr dep, + std::shared_ptr fin_dep) : AsyncResultWriter(output_expr_ctxs, dep, fin_dep), _t_sink(t_sink) { DCHECK(_t_sink.__isset.hive_table_sink); } @@ -86,15 +85,15 @@ Status VHiveTableWriter::open(RuntimeState* state, RuntimeProfile* operator_prof return Status::OK(); } -Status VHiveTableWriter::write(RuntimeState* state, vectorized::Block& block) { +Status VHiveTableWriter::write(RuntimeState* state, Block& block) { SCOPED_RAW_TIMER(&_send_data_ns); if (block.rows() == 0) { return Status::OK(); } Block output_block; - RETURN_IF_ERROR(vectorized::VExprContext::get_output_block_after_execute_exprs( - _vec_output_expr_ctxs, block, &output_block, false)); + RETURN_IF_ERROR(VExprContext::get_output_block_after_execute_exprs(_vec_output_expr_ctxs, block, + &output_block, false)); materialize_block_inplace(output_block); std::unordered_map, IColumn::Filter> writer_positions; @@ -220,12 +219,11 @@ Status VHiveTableWriter::write(RuntimeState* state, vectorized::Block& block) { return Status::OK(); } -Status VHiveTableWriter::_filter_block(doris::vectorized::Block& block, - const vectorized::IColumn::Filter* filter, - doris::vectorized::Block* output_block) { +Status VHiveTableWriter::_filter_block(doris::Block& block, const IColumn::Filter* filter, + doris::Block* output_block) { const ColumnsWithTypeAndName& columns_with_type_and_name = block.get_columns_with_type_and_name(); - vectorized::ColumnsWithTypeAndName result_columns; + ColumnsWithTypeAndName result_columns; for (int i = 0; i < columns_with_type_and_name.size(); ++i) { const auto& col = columns_with_type_and_name[i]; result_columns.emplace_back(col.column->clone_resized(col.column->size()), col.type, @@ -277,7 +275,7 @@ Status VHiveTableWriter::close(Status status) { } std::shared_ptr VHiveTableWriter::_create_partition_writer( - vectorized::Block& block, int position, const std::string* file_name, int file_name_index) { + Block& block, int position, const std::string* file_name, int file_name_index) { auto& hive_table_sink = _t_sink.hive_table_sink; std::vector partition_values; std::string partition_name; @@ -396,13 +394,11 @@ std::shared_ptr VHiveTableWriter::_create_partition_writer hive_table_sink.hadoop_config); } -std::vector VHiveTableWriter::_create_partition_values(vectorized::Block& block, - int position) { +std::vector VHiveTableWriter::_create_partition_values(Block& block, int position) { std::vector partition_values; for (int i = 0; i < _partition_columns_input_index.size(); ++i) { int partition_column_idx = _partition_columns_input_index[i]; - vectorized::ColumnWithTypeAndName partition_column = - block.get_by_position(partition_column_idx); + ColumnWithTypeAndName partition_column = block.get_by_position(partition_column_idx); std::string value = _to_partition_value( _vec_output_expr_ctxs[partition_column_idx]->root()->data_type(), partition_column, position); @@ -452,8 +448,7 @@ std::string VHiveTableWriter::_to_partition_value(const DataTypePtr& type_desc, auto [item, size] = column->get_data_at(position); switch (type_desc->get_primitive_type()) { case TYPE_BOOLEAN: { - vectorized::Field field = - vectorized::check_and_get_column(*column)->operator[](position); + Field field = check_and_get_column(*column)->operator[](position); return std::to_string(field.get()); } case TYPE_TINYINT: { @@ -544,5 +539,4 @@ std::string VHiveTableWriter::_compute_file_name() { return fmt::format("{}_{}", print_id(_state->query_id()), uuid_str); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/vhive_table_writer.h b/be/src/exec/sink/writer/vhive_table_writer.h similarity index 78% rename from be/src/vec/sink/writer/vhive_table_writer.h rename to be/src/exec/sink/writer/vhive_table_writer.h index 62dfff9362879c..d860d8512d826d 100644 --- a/be/src/vec/sink/writer/vhive_table_writer.h +++ b/be/src/exec/sink/writer/vhive_table_writer.h @@ -19,11 +19,11 @@ #include -#include "util/runtime_profile.h" -#include "vec/columns/column.h" -#include "vec/data_types/data_type.h" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/sink/writer/async_result_writer.h" +#include "core/column/column.h" +#include "core/data_type/data_type.h" +#include "exec/sink/writer/async_result_writer.h" +#include "exprs/vexpr_fwd.h" +#include "runtime/runtime_profile.h" namespace doris { @@ -31,8 +31,6 @@ class ObjectPool; class RuntimeState; class RuntimeProfile; -namespace vectorized { - class Block; class VHivePartitionWriter; struct ColumnWithTypeAndName; @@ -40,8 +38,7 @@ struct ColumnWithTypeAndName; class VHiveTableWriter final : public AsyncResultWriter { public: VHiveTableWriter(const TDataSink& t_sink, const VExprContextSPtrs& output_exprs, - std::shared_ptr dep, - std::shared_ptr fin_dep); + std::shared_ptr dep, std::shared_ptr fin_dep); ~VHiveTableWriter() override = default; @@ -49,24 +46,24 @@ class VHiveTableWriter final : public AsyncResultWriter { Status open(RuntimeState* state, RuntimeProfile* profile) override; - Status write(RuntimeState* state, vectorized::Block& block) override; + Status write(RuntimeState* state, Block& block) override; Status close(Status) override; private: std::shared_ptr _create_partition_writer( - vectorized::Block& block, int position, const std::string* file_name = nullptr, + Block& block, int position, const std::string* file_name = nullptr, int file_name_index = 0); - std::vector _create_partition_values(vectorized::Block& block, int position); + std::vector _create_partition_values(Block& block, int position); std::string _to_partition_value(const DataTypePtr& type_desc, const ColumnWithTypeAndName& partition_column, int position); std::string _compute_file_name(); - Status _filter_block(doris::vectorized::Block& block, const vectorized::IColumn::Filter* filter, - doris::vectorized::Block* output_block); + Status _filter_block(doris::Block& block, const IColumn::Filter* filter, + doris::Block* output_block); // Currently it is a copy, maybe it is better to use move semantics to eliminate it. TDataSink _t_sink; @@ -95,5 +92,4 @@ class VHiveTableWriter final : public AsyncResultWriter { RuntimeProfile::Counter* _close_timer = nullptr; RuntimeProfile::Counter* _write_file_counter = nullptr; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/vhive_utils.cpp b/be/src/exec/sink/writer/vhive_utils.cpp similarity index 97% rename from be/src/vec/sink/writer/vhive_utils.cpp rename to be/src/exec/sink/writer/vhive_utils.cpp index 9a97b893775015..0ef05f9389d11c 100644 --- a/be/src/vec/sink/writer/vhive_utils.cpp +++ b/be/src/exec/sink/writer/vhive_utils.cpp @@ -15,14 +15,13 @@ // specific language governing permissions and limitations // under the License. -#include "vhive_utils.h" +#include "exec/sink/writer/vhive_utils.h" #include #include #include namespace doris { -namespace vectorized { const std::regex VHiveUtils::PATH_CHAR_TO_ESCAPE("[\\x00-\\x1F\"#%'*/:=?\\\\\\x7F\\{\\[\\]\\^]"); @@ -74,5 +73,4 @@ std::string VHiveUtils::escape_path_name(const std::string& path) { } return ss.str(); } -} // namespace vectorized } // namespace doris \ No newline at end of file diff --git a/be/src/vec/sink/writer/vhive_utils.h b/be/src/exec/sink/writer/vhive_utils.h similarity index 96% rename from be/src/vec/sink/writer/vhive_utils.h rename to be/src/exec/sink/writer/vhive_utils.h index 7b0c87d05fe6a6..a9c87ceb8aa0cb 100644 --- a/be/src/vec/sink/writer/vhive_utils.h +++ b/be/src/exec/sink/writer/vhive_utils.h @@ -27,7 +27,6 @@ #include namespace doris { -namespace vectorized { class VHiveUtils { private: @@ -42,5 +41,4 @@ class VHiveUtils { static std::string escape_path_name(const std::string& path); }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/vjdbc_table_writer.cpp b/be/src/exec/sink/writer/vjdbc_table_writer.cpp similarity index 87% rename from be/src/vec/sink/writer/vjdbc_table_writer.cpp rename to be/src/exec/sink/writer/vjdbc_table_writer.cpp index 8c24f4746adf83..acb197ea1a3b3c 100644 --- a/be/src/vec/sink/writer/vjdbc_table_writer.cpp +++ b/be/src/exec/sink/writer/vjdbc_table_writer.cpp @@ -15,20 +15,19 @@ // specific language governing permissions and limitations // under the License. -#include "vjdbc_table_writer.h" +#include "exec/sink/writer/vjdbc_table_writer.h" #include #include #include -#include "util/binary_cast.hpp" -#include "vec/core/block.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" +#include "core/binary_cast.hpp" +#include "core/block/block.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" namespace doris { -namespace vectorized { JdbcConnectorParam VJdbcTableWriter::create_connect_param(const doris::TDataSink& t_sink) { const TJdbcTableSink& t_jdbc_sink = t_sink.jdbc_table_sink; @@ -58,12 +57,12 @@ JdbcConnectorParam VJdbcTableWriter::create_connect_param(const doris::TDataSink VJdbcTableWriter::VJdbcTableWriter(const TDataSink& t_sink, const VExprContextSPtrs& output_expr_ctxs, - std::shared_ptr dep, - std::shared_ptr fin_dep) + std::shared_ptr dep, + std::shared_ptr fin_dep) : AsyncResultWriter(output_expr_ctxs, dep, fin_dep), JdbcConnector(create_connect_param(t_sink)) {} -Status VJdbcTableWriter::write(RuntimeState* state, vectorized::Block& block) { +Status VJdbcTableWriter::write(RuntimeState* state, Block& block) { Block output_block; RETURN_IF_ERROR(_projection_block(block, &output_block)); auto num_rows = output_block.rows(); @@ -80,5 +79,4 @@ Status VJdbcTableWriter::write(RuntimeState* state, vectorized::Block& block) { return Status::OK(); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/vjdbc_table_writer.h b/be/src/exec/sink/writer/vjdbc_table_writer.h similarity index 82% rename from be/src/vec/sink/writer/vjdbc_table_writer.h rename to be/src/exec/sink/writer/vjdbc_table_writer.h index 4b4c760c7b2fdd..c3a54eb623d188 100644 --- a/be/src/vec/sink/writer/vjdbc_table_writer.h +++ b/be/src/exec/sink/writer/vjdbc_table_writer.h @@ -24,11 +24,10 @@ #include #include "common/status.h" -#include "vec/exec/vjdbc_connector.h" -#include "vec/sink/writer/async_result_writer.h" +#include "exec/connector/vjdbc_connector.h" +#include "exec/sink/writer/async_result_writer.h" namespace doris { -namespace vectorized { class Block; @@ -37,8 +36,7 @@ class VJdbcTableWriter final : public AsyncResultWriter, public JdbcConnector { static JdbcConnectorParam create_connect_param(const TDataSink&); VJdbcTableWriter(const TDataSink& t_sink, const VExprContextSPtrs& output_exprs, - std::shared_ptr dep, - std::shared_ptr fin_dep); + std::shared_ptr dep, std::shared_ptr fin_dep); // connect to jdbc server Status open(RuntimeState* state, RuntimeProfile* operator_profile) override { @@ -46,7 +44,7 @@ class VJdbcTableWriter final : public AsyncResultWriter, public JdbcConnector { return init_to_write(operator_profile); } - Status write(RuntimeState* state, vectorized::Block& block) override; + Status write(RuntimeState* state, Block& block) override; Status finish(RuntimeState* state) override { return JdbcConnector::finish_trans(); } @@ -55,5 +53,4 @@ class VJdbcTableWriter final : public AsyncResultWriter, public JdbcConnector { private: JdbcConnectorParam _param; }; -} // namespace vectorized } // namespace doris \ No newline at end of file diff --git a/be/src/vec/sink/vmysql_result_writer.cpp b/be/src/exec/sink/writer/vmysql_result_writer.cpp similarity index 94% rename from be/src/vec/sink/vmysql_result_writer.cpp rename to be/src/exec/sink/writer/vmysql_result_writer.cpp index c9bec0e863bdee..4101f18db3c457 100644 --- a/be/src/vec/sink/vmysql_result_writer.cpp +++ b/be/src/exec/sink/writer/vmysql_result_writer.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/vmysql_result_writer.h" +#include "exec/sink/writer/vmysql_result_writer.h" #include #include @@ -33,27 +33,26 @@ #include "common/cast_set.h" #include "common/compiler_util.h" // IWYU pragma: keep #include "common/config.h" -#include "runtime/define_primitive_type.h" +#include "core/block/block.h" +#include "core/block/column_with_type_and_name.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type/data_type_decimal.h" +#include "core/data_type/data_type_map.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/data_type_struct.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type_serde/data_type_serde.h" +#include "core/types.h" +#include "exprs/aggregate/aggregate_function.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" #include "runtime/result_block_buffer.h" #include "runtime/runtime_state.h" -#include "runtime/types.h" #include "util/mysql_global.h" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/core/block.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type_array.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/data_types/data_type_map.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/data_types/data_type_struct.h" -#include "vec/data_types/serde/data_type_serde.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" void GetResultBatchCtx::on_failure(const Status& status) { @@ -330,4 +329,4 @@ Status VMysqlResultWriter::close(Status) { return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/sink/vmysql_result_writer.h b/be/src/exec/sink/writer/vmysql_result_writer.h similarity index 93% rename from be/src/vec/sink/vmysql_result_writer.h rename to be/src/exec/sink/writer/vmysql_result_writer.h index cf3834e3dbe839..a9416351a837ba 100644 --- a/be/src/vec/sink/vmysql_result_writer.h +++ b/be/src/exec/sink/writer/vmysql_result_writer.h @@ -23,19 +23,18 @@ #include #include "common/status.h" -#include "runtime/define_primitive_type.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "exec/sink/writer/result_writer.h" +#include "exprs/vexpr_fwd.h" #include "runtime/result_block_buffer.h" -#include "runtime/result_writer.h" +#include "runtime/runtime_profile.h" #include "util/mysql_row_buffer.h" -#include "util/runtime_profile.h" -#include "vec/data_types/data_type.h" -#include "vec/exprs/vexpr_fwd.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace vectorized { class Block; class GetResultBatchCtx { @@ -104,7 +103,6 @@ class VMysqlResultWriter final : public ResultWriter { const bool _is_binary_format; }; -} // namespace vectorized } // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/sink/writer/vtablet_writer.cpp b/be/src/exec/sink/writer/vtablet_writer.cpp similarity index 98% rename from be/src/vec/sink/writer/vtablet_writer.cpp rename to be/src/exec/sink/writer/vtablet_writer.cpp index c8cb3496d2c40b..934446e18c3781 100644 --- a/be/src/vec/sink/writer/vtablet_writer.cpp +++ b/be/src/exec/sink/writer/vtablet_writer.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vtablet_writer.h" +#include "exec/sink/writer/vtablet_writer.h" #include #include @@ -46,11 +46,11 @@ #include "cloud/config.h" #include "common/config.h" +#include "core/data_type/data_type.h" #include "cpp/sync_point.h" -#include "util/runtime_profile.h" -#include "vec/data_types/data_type.h" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/sink/vrow_distribution.h" +#include "exec/sink/vrow_distribution.h" +#include "exprs/vexpr_fwd.h" +#include "runtime/runtime_profile.h" #ifdef DEBUG #include @@ -58,10 +58,17 @@ #include "common/compiler_util.h" // IWYU pragma: keep #include "common/logging.h" +#include "common/metrics/doris_metrics.h" #include "common/object_pool.h" #include "common/signal_handler.h" #include "common/status.h" -#include "exec/tablet_info.h" +#include "core/block/block.h" +#include "core/column/column.h" +#include "core/column/column_const.h" +#include "core/data_type/data_type_nullable.h" +#include "exec/sink/vtablet_block_convertor.h" +#include "exec/sink/vtablet_finder.h" +#include "exprs/vexpr.h" #include "runtime/descriptors.h" #include "runtime/exec_env.h" #include "runtime/memory/memory_reclamation.h" @@ -69,10 +76,10 @@ #include "runtime/runtime_state.h" #include "runtime/thread_context.h" #include "service/backend_options.h" +#include "storage/tablet_info.h" #include "util/brpc_closure.h" #include "util/debug_points.h" #include "util/defer_op.h" -#include "util/doris_metrics.h" #include "util/mem_info.h" #include "util/network_util.h" #include "util/proto_util.h" @@ -81,18 +88,10 @@ #include "util/thrift_util.h" #include "util/time.h" #include "util/uid_util.h" -#include "vec/columns/column.h" -#include "vec/columns/column_const.h" -#include "vec/core/block.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/exprs/vexpr.h" -#include "vec/sink/vtablet_block_convertor.h" -#include "vec/sink/vtablet_finder.h" namespace doris { class TExpr; -namespace vectorized { #include "common/compile_check_begin.h" bvar::Adder g_sink_write_bytes; @@ -732,7 +731,7 @@ Status VNodeChannel::open_wait() { return status; } -Status VNodeChannel::add_block(vectorized::Block* block, const Payload* payload) { +Status VNodeChannel::add_block(Block* block, const Payload* payload) { SCOPED_CONSUME_MEM_TRACKER(_node_channel_tracker.get()); if (payload->second.empty()) { return Status::OK(); @@ -779,7 +778,7 @@ Status VNodeChannel::add_block(vectorized::Block* block, const Payload* payload) } if (UNLIKELY(!_cur_mutable_block)) { - _cur_mutable_block = vectorized::MutableBlock::create_unique(block->clone_empty()); + _cur_mutable_block = MutableBlock::create_unique(block->clone_empty()); } SCOPED_RAW_TIMER(&_stat.append_node_channel_ns); @@ -812,7 +811,7 @@ Status VNodeChannel::add_block(vectorized::Block* block, const Payload* payload) << " jobid:" << std::to_string(_state->load_job_id()) << " loadinfo:" << _load_info; } - _cur_mutable_block = vectorized::MutableBlock::create_unique(block->clone_empty()); + _cur_mutable_block = MutableBlock::create_unique(block->clone_empty()); _cur_add_block_request->clear_tablet_ids(); } @@ -1324,7 +1323,7 @@ void VNodeChannel::mark_close(bool hang_wait) { std::lock_guard l(_pending_batches_lock); if (!_cur_mutable_block) [[unlikely]] { // never had a block arrived. add a dummy block - _cur_mutable_block = vectorized::MutableBlock::create_unique(); + _cur_mutable_block = MutableBlock::create_unique(); } auto tmp_add_block_request = std::make_shared(*_cur_add_block_request); @@ -1342,8 +1341,7 @@ void VNodeChannel::mark_close(bool hang_wait) { } VTabletWriter::VTabletWriter(const TDataSink& t_sink, const VExprContextSPtrs& output_exprs, - std::shared_ptr dep, - std::shared_ptr fin_dep) + std::shared_ptr dep, std::shared_ptr fin_dep) : AsyncResultWriter(output_exprs, dep, fin_dep), _t_sink(t_sink) { _transfer_large_data_by_brpc = config::transfer_large_data_by_brpc; } @@ -1488,7 +1486,7 @@ Status VTabletWriter::_init_row_distribution() { .schema = _schema, .caller = this, .write_single_replica = _write_single_replica, - .create_partition_callback = &vectorized::on_partitions_created}); + .create_partition_callback = &::doris::on_partitions_created}); return _row_distribution.open(_output_row_desc); } @@ -2028,8 +2026,7 @@ void VTabletWriter::_generate_one_index_channel_payload( if (payload_it == channel_payload.end()) { auto [tmp_it, _] = channel_payload.emplace( locate_node.get(), - Payload {std::make_unique(), - std::vector()}); + Payload {std::make_unique(), std::vector()}); payload_it = tmp_it; payload_it->second.first->reserve(row_cnt); payload_it->second.second.reserve(row_cnt); @@ -2048,7 +2045,7 @@ void VTabletWriter::_generate_index_channels_payloads( } } -Status VTabletWriter::write(RuntimeState* state, doris::vectorized::Block& input_block) { +Status VTabletWriter::write(RuntimeState* state, doris::Block& input_block) { SCOPED_CONSUME_MEM_TRACKER(_mem_tracker.get()); Status status = Status::OK(); @@ -2069,7 +2066,7 @@ Status VTabletWriter::write(RuntimeState* state, doris::vectorized::Block& input SCOPED_TIMER(_operator_profile->total_time_counter()); SCOPED_RAW_TIMER(&_send_data_ns); - std::shared_ptr block; + std::shared_ptr block; _number_input_rows += rows; // update incrementally so that FE can get the progress. // the real 'num_rows_load_total' will be set when sink being closed. @@ -2110,5 +2107,4 @@ Status VTabletWriter::write(RuntimeState* state, doris::vectorized::Block& input return Status::OK(); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/vtablet_writer.h b/be/src/exec/sink/writer/vtablet_writer.h similarity index 96% rename from be/src/vec/sink/writer/vtablet_writer.h rename to be/src/exec/sink/writer/vtablet_writer.h index 6249febf8ade3a..d9e3869e68e588 100644 --- a/be/src/vec/sink/writer/vtablet_writer.h +++ b/be/src/exec/sink/writer/vtablet_writer.h @@ -53,21 +53,21 @@ #include "common/config.h" #include "common/status.h" -#include "exec/tablet_info.h" +#include "core/block/block.h" +#include "core/column/column.h" +#include "core/data_type/data_type.h" +#include "exec/sink/vrow_distribution.h" +#include "exec/sink/vtablet_block_convertor.h" +#include "exec/sink/vtablet_finder.h" +#include "exec/sink/writer/async_result_writer.h" +#include "exprs/vexpr_fwd.h" #include "runtime/exec_env.h" #include "runtime/memory/mem_tracker.h" +#include "runtime/runtime_profile.h" #include "runtime/thread_context.h" +#include "storage/tablet_info.h" #include "util/brpc_closure.h" -#include "util/runtime_profile.h" #include "util/stopwatch.hpp" -#include "vec/columns/column.h" -#include "vec/core/block.h" -#include "vec/data_types/data_type.h" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/sink/vrow_distribution.h" -#include "vec/sink/vtablet_block_convertor.h" -#include "vec/sink/vtablet_finder.h" -#include "vec/sink/writer/async_result_writer.h" namespace doris { class ObjectPool; @@ -79,8 +79,6 @@ class Thread; class ThreadPoolToken; class TupleDescriptor; -namespace vectorized { - // The counter of add_batch rpc of a single node struct AddBatchCounter { // total execution time of a add_batch rpc @@ -223,7 +221,7 @@ struct WriterStats { }; // pair -using Payload = std::pair, std::vector>; +using Payload = std::pair, std::vector>; // every NodeChannel keeps a data transmission channel with one BE. for multiple times open, it has a dozen of requests and corresponding closures. class VNodeChannel { @@ -259,7 +257,7 @@ class VNodeChannel { // this function will called multi times. NON_REENTRANT Status open_wait(); - Status add_block(vectorized::Block* block, const Payload* payload); + Status add_block(Block* block, const Payload* payload); // @return: 1 if running, 0 if finished. // @caller: VOlapTabletSink::_send_batch_process. it's a continual asynchronous process. @@ -431,11 +429,11 @@ class VNodeChannel { std::vector> _tablets_filtered_rows; // build a _cur_mutable_block and push into _pending_blocks. when not building, this block is empty. - std::unique_ptr _cur_mutable_block; + std::unique_ptr _cur_mutable_block; std::shared_ptr _cur_add_block_request; - using AddBlockReq = std::pair, - std::shared_ptr>; + using AddBlockReq = + std::pair, std::shared_ptr>; std::queue _pending_blocks; // send block to slave BE rely on this. dont reconstruct it. std::shared_ptr> _send_block_callback = nullptr; @@ -451,7 +449,7 @@ class VNodeChannel { // an IndexChannel is related to specific table and its rollup and mv class IndexChannel { public: - IndexChannel(VTabletWriter* parent, int64_t index_id, vectorized::VExprContextSPtr where_clause) + IndexChannel(VTabletWriter* parent, int64_t index_id, VExprContextSPtr where_clause) : _parent(parent), _index_id(index_id), _where_clause(std::move(where_clause)) { _index_channel_tracker = std::make_unique("IndexChannel:indexID=" + std::to_string(_index_id)); @@ -565,7 +563,7 @@ class IndexChannel { void set_start_time(const int64_t& start_time) { _start_time = start_time; } - vectorized::VExprContextSPtr get_where_clause() { return _where_clause; } + VExprContextSPtr get_where_clause() { return _where_clause; } private: friend class VNodeChannel; @@ -583,7 +581,7 @@ class IndexChannel { VTabletWriter* _parent = nullptr; int64_t _index_id; - vectorized::VExprContextSPtr _where_clause; + VExprContextSPtr _where_clause; // from backend channel to tablet_id // ATTN: must be placed before `_node_channels` and `_channels_by_tablet`. @@ -617,17 +615,15 @@ class IndexChannel { int64_t _start_time = 0; }; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { // // write result to file class VTabletWriter final : public AsyncResultWriter { public: VTabletWriter(const TDataSink& t_sink, const VExprContextSPtrs& output_exprs, - std::shared_ptr dep, - std::shared_ptr fin_dep); + std::shared_ptr dep, std::shared_ptr fin_dep); Status write(RuntimeState* state, Block& block) override; @@ -780,4 +776,4 @@ class VTabletWriter final : public AsyncResultWriter { // these backends' success should not be counted for majority write std::unordered_map> _tablet_version_gap_backends; }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/sink/writer/vtablet_writer_v2.cpp b/be/src/exec/sink/writer/vtablet_writer_v2.cpp similarity index 98% rename from be/src/vec/sink/writer/vtablet_writer_v2.cpp rename to be/src/exec/sink/writer/vtablet_writer_v2.cpp index 794cd99a30efbf..ceb9adf859adcc 100644 --- a/be/src/vec/sink/writer/vtablet_writer_v2.cpp +++ b/be/src/exec/sink/writer/vtablet_writer_v2.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/writer/vtablet_writer_v2.h" +#include "exec/sink/writer/vtablet_writer_v2.h" #include #include @@ -32,36 +32,36 @@ #include "common/compiler_util.h" // IWYU pragma: keep #include "common/logging.h" +#include "common/metrics/doris_metrics.h" #include "common/object_pool.h" #include "common/signal_handler.h" #include "common/status.h" -#include "exec/tablet_info.h" -#include "olap/delta_writer_v2.h" +#include "core/block/block.h" +#include "exec/sink/delta_writer_v2_pool.h" +#include "load/delta_writer/delta_writer_v2.h" #include "runtime/descriptors.h" #include "runtime/exec_env.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" #include "runtime/thread_context.h" +#include "storage/tablet_info.h" #include "util/debug_points.h" #include "util/defer_op.h" -#include "util/doris_metrics.h" -#include "util/runtime_profile.h" #include "util/uid_util.h" -#include "vec/core/block.h" -#include "vec/sink/delta_writer_v2_pool.h" // NOLINTNEXTLINE(unused-includes) -#include "vec/sink/load_stream_map_pool.h" -#include "vec/sink/load_stream_stub.h" // IWYU pragma: keep -#include "vec/sink/vtablet_block_convertor.h" -#include "vec/sink/vtablet_finder.h" +#include "exec/sink/load_stream_map_pool.h" +#include "exec/sink/load_stream_stub.h" // IWYU pragma: keep +#include "exec/sink/vtablet_block_convertor.h" +#include "exec/sink/vtablet_finder.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" extern bvar::Adder g_sink_load_back_pressure_version_time_ms; VTabletWriterV2::VTabletWriterV2(const TDataSink& t_sink, const VExprContextSPtrs& output_exprs, - std::shared_ptr dep, - std::shared_ptr fin_dep) + std::shared_ptr dep, + std::shared_ptr fin_dep) : AsyncResultWriter(output_exprs, dep, fin_dep), _t_sink(t_sink) { DCHECK(t_sink.__isset.olap_table_sink); } @@ -136,7 +136,7 @@ Status VTabletWriterV2::_init_row_distribution() { .vec_output_expr_ctxs = &_vec_output_expr_ctxs, .schema = _schema, .caller = (void*)this, - .create_partition_callback = &vectorized::on_partitions_created}); + .create_partition_callback = &::doris::on_partitions_created}); return _row_distribution.open(_output_row_desc); } @@ -512,7 +512,7 @@ Status VTabletWriterV2::write(RuntimeState* state, Block& input_block) { // This is just for passing compilation. _row_distribution_watch.start(); - std::shared_ptr block; + std::shared_ptr block; RETURN_IF_ERROR(_row_distribution.generate_rows_distribution( input_block, block, _row_part_tablet_ids, _number_input_rows)); RowsForTablet rows_for_tablet; @@ -536,7 +536,7 @@ Status VTabletWriterV2::write(RuntimeState* state, Block& input_block) { return Status::OK(); } -Status VTabletWriterV2::_write_memtable(std::shared_ptr block, int64_t tablet_id, +Status VTabletWriterV2::_write_memtable(std::shared_ptr block, int64_t tablet_id, const Rows& rows) { auto st = Status::OK(); auto delta_writer = _delta_writer_for_tablet->get_or_create(tablet_id, [&]() { @@ -1069,4 +1069,4 @@ Status VTabletWriterV2::_create_commit_info(std::vector& tabl return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/sink/writer/vtablet_writer_v2.h b/be/src/exec/sink/writer/vtablet_writer_v2.h similarity index 92% rename from be/src/vec/sink/writer/vtablet_writer_v2.h rename to be/src/exec/sink/writer/vtablet_writer_v2.h index 550501ad92e596..914c17d1cdc23f 100644 --- a/be/src/vec/sink/writer/vtablet_writer_v2.h +++ b/be/src/exec/sink/writer/vtablet_writer_v2.h @@ -48,22 +48,21 @@ #include "common/config.h" #include "common/status.h" -#include "exec/tablet_info.h" +#include "core/allocator.h" +#include "core/block/block.h" +#include "core/column/column.h" +#include "core/data_type/data_type.h" +#include "exec/common/hash_table/phmap_fwd_decl.h" +#include "exec/sink/vrow_distribution.h" +#include "exec/sink/writer/async_result_writer.h" +#include "exprs/vexpr_fwd.h" #include "runtime/exec_env.h" #include "runtime/memory/mem_tracker.h" +#include "runtime/runtime_profile.h" #include "runtime/thread_context.h" -#include "runtime/types.h" +#include "storage/tablet_info.h" #include "util/countdown_latch.h" -#include "util/runtime_profile.h" #include "util/stopwatch.hpp" -#include "vec/columns/column.h" -#include "vec/common/allocator.h" -#include "vec/common/hash_table/phmap_fwd_decl.h" -#include "vec/core/block.h" -#include "vec/data_types/data_type.h" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/sink/vrow_distribution.h" -#include "vec/sink/writer/async_result_writer.h" namespace doris { class DeltaWriterV2; @@ -78,8 +77,6 @@ class TExpr; class TabletSchema; class TupleDescriptor; -namespace vectorized { - class OlapTableBlockConvertor; class OlapTabletFinder; class VTabletWriterV2; @@ -101,8 +98,7 @@ class VTabletWriterV2 final : public AsyncResultWriter { public: // Construct from thrift struct which is generated by FE. VTabletWriterV2(const TDataSink& t_sink, const VExprContextSPtrs& output_exprs, - std::shared_ptr dep, - std::shared_ptr fin_dep); + std::shared_ptr dep, std::shared_ptr fin_dep); ~VTabletWriterV2() override; @@ -140,8 +136,7 @@ class VTabletWriterV2 final : public AsyncResultWriter { void _generate_rows_for_tablet(std::vector& row_part_tablet_ids, RowsForTablet& rows_for_tablet); - Status _write_memtable(std::shared_ptr block, int64_t tablet_id, - const Rows& rows); + Status _write_memtable(std::shared_ptr block, int64_t tablet_id, const Rows& rows); Status _select_streams(int64_t tablet_id, int64_t partition_id, int64_t index_id, std::vector>& streams); @@ -264,5 +259,4 @@ class VTabletWriterV2 final : public AsyncResultWriter { std::atomic _load_back_pressure_version_block_ms {0}; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/vtvf_table_writer.cpp b/be/src/exec/sink/writer/vtvf_table_writer.cpp similarity index 93% rename from be/src/vec/sink/writer/vtvf_table_writer.cpp rename to be/src/exec/sink/writer/vtvf_table_writer.cpp index 63dc3850c97623..c4111c7c2d3117 100644 --- a/be/src/vec/sink/writer/vtvf_table_writer.cpp +++ b/be/src/exec/sink/writer/vtvf_table_writer.cpp @@ -15,22 +15,22 @@ // specific language governing permissions and limitations // under the License. -#include "vec/sink/writer/vtvf_table_writer.h" +#include "exec/sink/writer/vtvf_table_writer.h" #include #include "common/status.h" +#include "core/block/block.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" #include "io/file_factory.h" #include "runtime/runtime_state.h" -#include "vec/core/block.h" -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" -namespace doris::vectorized { +namespace doris { VTVFTableWriter::VTVFTableWriter(const TDataSink& t_sink, const VExprContextSPtrs& output_exprs, - std::shared_ptr dep, - std::shared_ptr fin_dep) + std::shared_ptr dep, + std::shared_ptr fin_dep) : AsyncResultWriter(output_exprs, dep, fin_dep) { _tvf_sink = t_sink.tvf_table_sink; } @@ -58,7 +58,7 @@ Status VTVFTableWriter::open(RuntimeState* state, RuntimeProfile* profile) { return _create_next_file_writer(); } -Status VTVFTableWriter::write(RuntimeState* state, vectorized::Block& block) { +Status VTVFTableWriter::write(RuntimeState* state, Block& block) { COUNTER_UPDATE(_written_rows_counter, block.rows()); state->update_num_rows_load_total(block.rows()); @@ -169,4 +169,4 @@ Status VTVFTableWriter::_get_next_file_name(std::string* file_name) { return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/sink/writer/vtvf_table_writer.h b/be/src/exec/sink/writer/vtvf_table_writer.h similarity index 83% rename from be/src/vec/sink/writer/vtvf_table_writer.h rename to be/src/exec/sink/writer/vtvf_table_writer.h index 5c69b4354aed55..54fabeecd5fc03 100644 --- a/be/src/vec/sink/writer/vtvf_table_writer.h +++ b/be/src/exec/sink/writer/vtvf_table_writer.h @@ -23,18 +23,17 @@ #include #include "common/status.h" +#include "exec/sink/writer/async_result_writer.h" +#include "exprs/vexpr_fwd.h" +#include "format/transformer/vfile_format_transformer.h" +#include "format/transformer/vfile_format_transformer_factory.h" #include "io/fs/file_writer.h" -#include "util/runtime_profile.h" -#include "vec/exprs/vexpr_fwd.h" -#include "vec/runtime/vfile_format_transformer.h" -#include "vec/runtime/vfile_format_transformer_factory.h" -#include "vec/sink/writer/async_result_writer.h" +#include "runtime/runtime_profile.h" namespace doris { class RuntimeState; class RuntimeProfile; -namespace vectorized { class Block; /** @@ -47,14 +46,13 @@ class Block; class VTVFTableWriter final : public AsyncResultWriter { public: VTVFTableWriter(const TDataSink& t_sink, const VExprContextSPtrs& output_exprs, - std::shared_ptr dep, - std::shared_ptr fin_dep); + std::shared_ptr dep, std::shared_ptr fin_dep); ~VTVFTableWriter() override = default; Status open(RuntimeState* state, RuntimeProfile* profile) override; - Status write(RuntimeState* state, vectorized::Block& block) override; + Status write(RuntimeState* state, Block& block) override; Status close(Status status) override; @@ -83,5 +81,4 @@ class VTVFTableWriter final : public AsyncResultWriter { RuntimeProfile::Counter* _writer_close_timer = nullptr; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/vwal_writer.cpp b/be/src/exec/sink/writer/vwal_writer.cpp similarity index 96% rename from be/src/vec/sink/writer/vwal_writer.cpp rename to be/src/exec/sink/writer/vwal_writer.cpp index 35436da82f1113..3f3b78b211b3de 100644 --- a/be/src/vec/sink/writer/vwal_writer.cpp +++ b/be/src/exec/sink/writer/vwal_writer.cpp @@ -15,18 +15,17 @@ // specific language governing permissions and limitations // under the License. -#include "vwal_writer.h" +#include "exec/sink/writer/vwal_writer.h" +#include #include #include -#include "gen_cpp/FrontendService.h" #include "io/fs/encrypted_fs_factory.h" #include "util/debug_points.h" namespace doris { -namespace vectorized { VWalWriter::VWalWriter(int64_t db_id, int64_t tb_id, int64_t wal_id, const std::string& import_label, WalManager* wal_manager, @@ -68,7 +67,7 @@ Status VWalWriter::init() { return Status::OK(); } -Status VWalWriter::write_wal(vectorized::Block* block) { +Status VWalWriter::write_wal(Block* block) { DBUG_EXECUTE_IF("VWalWriter.write_wal.fail", { return Status::InternalError("Failed to write wal!"); }); PBlock pblock; @@ -103,5 +102,4 @@ Status VWalWriter::_create_wal_writer(int64_t wal_id, const io::FileSystemSPtr& RETURN_IF_ERROR(wal_writer->init(fs)); return Status::OK(); } -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/sink/writer/vwal_writer.h b/be/src/exec/sink/writer/vwal_writer.h similarity index 89% rename from be/src/vec/sink/writer/vwal_writer.h rename to be/src/exec/sink/writer/vwal_writer.h index 19bd2761118d4d..60a0ba36fc71dc 100644 --- a/be/src/vec/sink/writer/vwal_writer.h +++ b/be/src/exec/sink/writer/vwal_writer.h @@ -20,12 +20,11 @@ #include #include "common/status.h" -#include "olap/wal/wal_manager.h" -#include "olap/wal/wal_writer.h" -#include "vec/core/block.h" +#include "core/block/block.h" +#include "load/group_commit/wal/wal_manager.h" +#include "load/group_commit/wal/wal_writer.h" namespace doris { -namespace vectorized { class VWalWriter { public: @@ -34,7 +33,7 @@ class VWalWriter { int be_exe_version); ~VWalWriter(); Status init(); - Status write_wal(vectorized::Block* block); + Status write_wal(Block* block); Status close(); private: @@ -51,5 +50,4 @@ class VWalWriter { int _be_exe_version = 0; std::shared_ptr _wal_writer; }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/common/sort/heap_sorter.cpp b/be/src/exec/sort/heap_sorter.cpp similarity index 93% rename from be/src/vec/common/sort/heap_sorter.cpp rename to be/src/exec/sort/heap_sorter.cpp index 70307628071e93..ee66be94876c43 100644 --- a/be/src/vec/common/sort/heap_sorter.cpp +++ b/be/src/exec/sort/heap_sorter.cpp @@ -15,9 +15,15 @@ // specific language governing permissions and limitations // under the License. -#include "vec/common/sort/heap_sorter.h" +#include "exec/sort/heap_sorter.h" -namespace doris::vectorized { +#include + +#include "exec/sort/sort_block.h" +#include "runtime/runtime_profile.h" +#include "runtime/runtime_state.h" + +namespace doris { #include "common/compile_check_begin.h" HeapSorter::HeapSorter(VSortExecExprs& vsort_exec_exprs, int64_t limit, int64_t offset, @@ -86,4 +92,4 @@ size_t HeapSorter::data_size() const { } #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/sort/heap_sorter.h b/be/src/exec/sort/heap_sorter.h similarity index 94% rename from be/src/vec/common/sort/heap_sorter.h rename to be/src/exec/sort/heap_sorter.h index 35108cbafc23ef..a79546a55bd91b 100644 --- a/be/src/vec/common/sort/heap_sorter.h +++ b/be/src/exec/sort/heap_sorter.h @@ -17,9 +17,9 @@ #pragma once -#include "vec/common/sort/sorter.h" +#include "exec/sort/sorter.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class HeapSorter final : public Sorter { @@ -54,4 +54,4 @@ class HeapSorter final : public Sorter { }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/sort/partition_sorter.cpp b/be/src/exec/sort/partition_sorter.cpp similarity index 97% rename from be/src/vec/common/sort/partition_sorter.cpp rename to be/src/exec/sort/partition_sorter.cpp index 305a803c9e039d..0f429b33b42f73 100644 --- a/be/src/vec/common/sort/partition_sorter.cpp +++ b/be/src/exec/sort/partition_sorter.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/common/sort/partition_sorter.h" +#include "exec/sort/partition_sorter.h" #include @@ -23,21 +23,19 @@ #include #include "common/object_pool.h" -#include "vec/core/block.h" -#include "vec/core/sort_cursor.h" -#include "vec/utils/util.hpp" +#include "core/block/block.h" +#include "exec/common/util.hpp" +#include "exec/sort/sort_cursor.h" namespace doris { class RowDescriptor; class RuntimeProfile; class RuntimeState; -namespace vectorized { class VSortExecExprs; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { PartitionSorter::PartitionSorter(VSortExecExprs& vsort_exec_exprs, int64_t limit, int64_t offset, ObjectPool* pool, std::vector& is_asc_order, @@ -207,4 +205,4 @@ Status PartitionSorter::_read_row_rank(Block* output_block, bool* eos, int batch return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/sort/partition_sorter.h b/be/src/exec/sort/partition_sorter.h similarity index 96% rename from be/src/vec/common/sort/partition_sorter.h rename to be/src/exec/sort/partition_sorter.h index e7d3f37941fbe2..ce04025fa409c2 100644 --- a/be/src/vec/common/sort/partition_sorter.h +++ b/be/src/exec/sort/partition_sorter.h @@ -26,7 +26,7 @@ #include #include "common/status.h" -#include "vec/common/sort/sorter.h" +#include "exec/sort/sorter.h" namespace doris { #include "common/compile_check_begin.h" @@ -35,13 +35,11 @@ class RowDescriptor; class RuntimeProfile; class RuntimeState; -namespace vectorized { class Block; class VSortExecExprs; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { struct SortCursorCmp { public: @@ -126,4 +124,4 @@ class PartitionSorter final : public Sorter { }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/core/sort_block.cpp b/be/src/exec/sort/sort_block.cpp similarity index 95% rename from be/src/vec/core/sort_block.cpp rename to be/src/exec/sort/sort_block.cpp index 75aa9d85a12fd2..f0d474cda2d84e 100644 --- a/be/src/vec/core/sort_block.cpp +++ b/be/src/exec/sort/sort_block.cpp @@ -18,11 +18,11 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/Interpreters/sortBlock.cpp // and modified by Doris -#include "vec/core/sort_block.h" +#include "exec/sort/sort_block.h" -#include "vec/core/column_with_type_and_name.h" +#include "core/block/column_with_type_and_name.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" ColumnsWithSortDescriptions get_columns_with_sort_description(const Block& block, const SortDescription& description) { @@ -92,4 +92,4 @@ void sort_block(Block& src_block, Block& dest_block, const SortDescription& desc } } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/core/sort_block.h b/be/src/exec/sort/sort_block.h similarity index 97% rename from be/src/vec/core/sort_block.h rename to be/src/exec/sort/sort_block.h index a13bd111934259..418c9007881663 100644 --- a/be/src/vec/core/sort_block.h +++ b/be/src/exec/sort/sort_block.h @@ -31,28 +31,28 @@ #include "common/compare.h" #include "common/compiler_util.h" // IWYU pragma: keep +#include "core/block/block.h" +#include "core/column/column.h" +#include "core/column/column_array.h" +#include "core/column/column_map.h" +#include "core/column/column_nullable.h" +#include "core/column/column_string.h" +#include "core/column/column_struct.h" +#include "core/column/column_varbinary.h" +#include "core/memcmp_small.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "exec/sort/sort_description.h" #include "util/simd/bits.h" -#include "vec/columns/column.h" -#include "vec/columns/column_array.h" -#include "vec/columns/column_map.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_string.h" -#include "vec/columns/column_struct.h" -#include "vec/columns/column_varbinary.h" -#include "vec/common/memcmp_small.h" -#include "vec/common/string_ref.h" -#include "vec/core/block.h" -#include "vec/core/sort_description.h" -#include "vec/core/types.h" - -namespace doris::vectorized { + +namespace doris { template class ColumnDecimal; template class ColumnVector; -} // namespace doris::vectorized +} // namespace doris -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" /// Sort one block by `description`. If limit != 0, then the partial sort of the first `limit` rows is produced. void sort_block(Block& src_block, Block& dest_block, const SortDescription& description, @@ -523,4 +523,4 @@ class ColumnSorter { const int _direction; }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/core/sort_cursor.h b/be/src/exec/sort/sort_cursor.h similarity index 98% rename from be/src/vec/core/sort_cursor.h rename to be/src/exec/sort/sort_cursor.h index 9f87e7e1b951b5..2a0d85d0fd342a 100644 --- a/be/src/vec/core/sort_cursor.h +++ b/be/src/exec/sort/sort_cursor.h @@ -22,13 +22,13 @@ #include -#include "vec/columns/column.h" -#include "vec/core/block.h" -#include "vec/core/field.h" -#include "vec/core/sort_description.h" -#include "vec/exprs/vexpr_context.h" +#include "core/block/block.h" +#include "core/column/column.h" +#include "core/field.h" +#include "exec/sort/sort_description.h" +#include "exprs/vexpr_context.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" /** Cursor allows to compare rows in different blocks (and parts). * Cursor moves inside single block. @@ -431,4 +431,4 @@ class SortingQueueBatch { }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/core/sort_description.h b/be/src/exec/sort/sort_description.h similarity index 96% rename from be/src/vec/core/sort_description.h rename to be/src/exec/sort/sort_description.h index 4d1543d690419f..a680ee24923873 100644 --- a/be/src/vec/core/sort_description.h +++ b/be/src/exec/sort/sort_description.h @@ -22,7 +22,7 @@ #include "vector" -namespace doris::vectorized { +namespace doris { /// Description of the sorting rule by one column. struct SortColumnDescription { @@ -41,4 +41,4 @@ struct SortColumnDescription { /// Description of the sorting rule for several columns. using SortDescription = std::vector; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/sort/sorter.cpp b/be/src/exec/sort/sorter.cpp similarity index 93% rename from be/src/vec/common/sort/sorter.cpp rename to be/src/exec/sort/sorter.cpp index 608e96f009a81c..c8bc671b3622c9 100644 --- a/be/src/vec/common/sort/sorter.cpp +++ b/be/src/exec/sort/sorter.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/common/sort/sorter.h" +#include "exec/sort/sorter.h" #include @@ -27,24 +27,24 @@ #include #include "common/object_pool.h" +#include "core/block/block.h" +#include "core/block/column_with_type_and_name.h" +#include "core/column/column.h" +#include "core/column/column_nullable.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_nullable.h" +#include "exec/common/util.hpp" +#include "exec/sort/sort_block.h" +#include "exprs/vexpr_context.h" #include "runtime/exec_env.h" +#include "runtime/runtime_profile.h" #include "runtime/thread_context.h" -#include "util/runtime_profile.h" -#include "vec/columns/column.h" -#include "vec/columns/column_nullable.h" -#include "vec/core/block.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/core/sort_block.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/exprs/vexpr_context.h" -#include "vec/utils/util.hpp" namespace doris { class RowDescriptor; } // namespace doris -namespace doris::vectorized { +namespace doris { // When doing spillable sorting, each sorted block is spilled into a single file. // @@ -87,16 +87,14 @@ Status MergeSorterState::build_merge_tree(const SortDescription& sort_descriptio return Status::OK(); } -Status MergeSorterState::merge_sort_read(doris::vectorized::Block* block, int batch_size, - bool* eos) { +Status MergeSorterState::merge_sort_read(doris::Block* block, int batch_size, bool* eos) { DCHECK(_sorted_blocks.empty()); DCHECK(unsorted_block()->empty()); _merge_sort_read_impl(batch_size, block, eos); return Status::OK(); } -void MergeSorterState::_merge_sort_read_impl(int batch_size, doris::vectorized::Block* block, - bool* eos) { +void MergeSorterState::_merge_sort_read_impl(int batch_size, doris::Block* block, bool* eos) { size_t num_columns = unsorted_block()->columns(); MutableBlock m_block = VectorizedUtils::build_mutable_mem_reuse_block(block, *unsorted_block()); @@ -132,8 +130,8 @@ void MergeSorterState::_merge_sort_read_impl(int batch_size, doris::vectorized:: *eos = merged_rows == 0; } -Status Sorter::merge_sort_read_for_spill(RuntimeState* state, doris::vectorized::Block* block, - int batch_size, bool* eos) { +Status Sorter::merge_sort_read_for_spill(RuntimeState* state, doris::Block* block, int batch_size, + bool* eos) { return get_next(state, block, eos); } @@ -272,7 +270,7 @@ Status FullSorter::get_next(RuntimeState* state, Block* block, bool* eos) { return _state->merge_sort_read(block, state->batch_size(), eos); } -Status FullSorter::merge_sort_read_for_spill(RuntimeState* state, doris::vectorized::Block* block, +Status FullSorter::merge_sort_read_for_spill(RuntimeState* state, doris::Block* block, int batch_size, bool* eos) { return _state->merge_sort_read(block, batch_size, eos); } @@ -318,4 +316,4 @@ void FullSorter::reset() { _state->reset(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/sort/sorter.h b/be/src/exec/sort/sorter.h similarity index 91% rename from be/src/vec/common/sort/sorter.h rename to be/src/exec/sort/sorter.h index a9e4814fccd00b..42ef13792eb464 100644 --- a/be/src/vec/common/sort/sorter.h +++ b/be/src/exec/sort/sorter.h @@ -27,15 +27,15 @@ #include #include "common/status.h" +#include "core/block/block.h" +#include "core/field.h" +#include "exec/common/util.hpp" +#include "exec/sort/sort_cursor.h" +#include "exec/sort/sort_description.h" +#include "exec/sort/vsort_exec_exprs.h" +#include "exec/sort/vsorted_run_merger.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" -#include "util/runtime_profile.h" -#include "vec/common/sort/vsort_exec_exprs.h" -#include "vec/core/block.h" -#include "vec/core/field.h" -#include "vec/core/sort_cursor.h" -#include "vec/core/sort_description.h" -#include "vec/runtime/vsorted_run_merger.h" -#include "vec/utils/util.hpp" namespace doris { #include "common/compile_check_begin.h" @@ -43,7 +43,7 @@ class ObjectPool; class RowDescriptor; } // namespace doris -namespace doris::vectorized { +namespace doris { using MergeSorterQueue = SortingQueueBatch; @@ -65,7 +65,7 @@ class MergeSorterState { Status build_merge_tree(const SortDescription& sort_description); - Status merge_sort_read(doris::vectorized::Block* block, int batch_size, bool* eos); + Status merge_sort_read(doris::Block* block, int batch_size, bool* eos); size_t data_size() const { size_t size = _unsorted_block->bytes(); @@ -85,7 +85,7 @@ class MergeSorterState { void ignore_offset() { _offset = 0; } private: - void _merge_sort_read_impl(int batch_size, doris::vectorized::Block* block, bool* eos); + void _merge_sort_read_impl(int batch_size, doris::Block* block, bool* eos); std::unique_ptr _unsorted_block; MergeSorterQueue _queue; @@ -142,7 +142,7 @@ class Sorter { const SortDescription& get_sort_description() const { return _sort_description; } virtual Field get_top_value() { return Field {PrimitiveType::TYPE_NULL}; } - virtual Status merge_sort_read_for_spill(RuntimeState* state, doris::vectorized::Block* block, + virtual Status merge_sort_read_for_spill(RuntimeState* state, doris::Block* block, int batch_size, bool* eos); virtual void reset() {} @@ -191,8 +191,8 @@ class FullSorter final : public Sorter { size_t get_reserve_mem_size(RuntimeState* state, bool eos) const override; - Status merge_sort_read_for_spill(RuntimeState* state, doris::vectorized::Block* block, - int batch_size, bool* eos) override; + Status merge_sort_read_for_spill(RuntimeState* state, doris::Block* block, int batch_size, + bool* eos) override; void reset() override; void set_max_buffered_block_bytes(size_t max_buffered_block_bytes) { @@ -224,4 +224,4 @@ class FullSorter final : public Sorter { }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/sort/topn_sorter.cpp b/be/src/exec/sort/topn_sorter.cpp similarity index 93% rename from be/src/vec/common/sort/topn_sorter.cpp rename to be/src/exec/sort/topn_sorter.cpp index daacd064118489..b1c4b124d203d9 100644 --- a/be/src/vec/common/sort/topn_sorter.cpp +++ b/be/src/exec/sort/topn_sorter.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/common/sort/topn_sorter.h" +#include "exec/sort/topn_sorter.h" #include @@ -23,21 +23,19 @@ #include #include "common/object_pool.h" -#include "vec/core/block.h" -#include "vec/core/sort_cursor.h" -#include "vec/utils/util.hpp" +#include "core/block/block.h" +#include "exec/common/util.hpp" +#include "exec/sort/sort_cursor.h" namespace doris { class RowDescriptor; class RuntimeProfile; class RuntimeState; -namespace vectorized { class VSortExecExprs; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { TopNSorter::TopNSorter(VSortExecExprs& vsort_exec_exprs, int64_t limit, int64_t offset, ObjectPool* pool, std::vector& is_asc_order, @@ -97,4 +95,4 @@ size_t TopNSorter::data_size() const { return _state->data_size(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/sort/topn_sorter.h b/be/src/exec/sort/topn_sorter.h similarity index 92% rename from be/src/vec/common/sort/topn_sorter.h rename to be/src/exec/sort/topn_sorter.h index 80e280cd8020e9..2fb707764c34e6 100644 --- a/be/src/vec/common/sort/topn_sorter.h +++ b/be/src/exec/sort/topn_sorter.h @@ -23,7 +23,7 @@ #include #include "common/status.h" -#include "vec/common/sort/sorter.h" +#include "exec/sort/sorter.h" namespace doris { #include "common/compile_check_begin.h" @@ -32,13 +32,11 @@ class RowDescriptor; class RuntimeProfile; class RuntimeState; -namespace vectorized { class Block; class VSortExecExprs; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { class TopNSorter final : public Sorter { ENABLE_FACTORY_CREATOR(TopNSorter); @@ -68,4 +66,4 @@ class TopNSorter final : public Sorter { }; #include "common/compile_check_end.h" -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/sort/vsort_exec_exprs.cpp b/be/src/exec/sort/vsort_exec_exprs.cpp similarity index 94% rename from be/src/vec/common/sort/vsort_exec_exprs.cpp rename to be/src/exec/sort/vsort_exec_exprs.cpp index c5a8329d14bb33..33fe1910f7253f 100644 --- a/be/src/vec/common/sort/vsort_exec_exprs.cpp +++ b/be/src/exec/sort/vsort_exec_exprs.cpp @@ -15,14 +15,14 @@ // specific language governing permissions and limitations // under the License. -#include "vec/common/sort/vsort_exec_exprs.h" +#include "exec/sort/vsort_exec_exprs.h" #include #include #include -#include "vec/exprs/vexpr.h" -#include "vec/exprs/vexpr_context.h" +#include "exprs/vexpr.h" +#include "exprs/vexpr_context.h" namespace doris { class ObjectPool; @@ -30,7 +30,7 @@ class RowDescriptor; class RuntimeState; } // namespace doris -namespace doris::vectorized { +namespace doris { Status VSortExecExprs::init(const TSortInfo& sort_info, ObjectPool* pool) { return init(sort_info.ordering_exprs, @@ -84,4 +84,4 @@ Status VSortExecExprs::clone(RuntimeState* state, VSortExecExprs& new_exprs) { return Status::OK(); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/common/sort/vsort_exec_exprs.h b/be/src/exec/sort/vsort_exec_exprs.h similarity index 97% rename from be/src/vec/common/sort/vsort_exec_exprs.h rename to be/src/exec/sort/vsort_exec_exprs.h index a21d8c8cb5032d..b60b88da0ae4b5 100644 --- a/be/src/vec/common/sort/vsort_exec_exprs.h +++ b/be/src/exec/sort/vsort_exec_exprs.h @@ -20,7 +20,7 @@ #include #include "common/status.h" -#include "vec/exprs/vexpr_fwd.h" +#include "exprs/vexpr_fwd.h" namespace doris { @@ -36,7 +36,6 @@ class TSortInfo; // TopN and Sort materialize input rows into a single tuple before sorting. // If _materialize_tuple is true, SortExecExprs also stores the slot expressions used to // materialize the sort tuples. -namespace vectorized { class VSortExecExprs { public: @@ -84,5 +83,4 @@ class VSortExecExprs { const std::vector* sort_tuple_slot_exprs, ObjectPool* pool); }; -} // namespace vectorized } // namespace doris diff --git a/be/src/vec/runtime/vsorted_run_merger.cpp b/be/src/exec/sort/vsorted_run_merger.cpp similarity index 96% rename from be/src/vec/runtime/vsorted_run_merger.cpp rename to be/src/exec/sort/vsorted_run_merger.cpp index 8483e78f25b751..865b860d4ec316 100644 --- a/be/src/vec/runtime/vsorted_run_merger.cpp +++ b/be/src/exec/sort/vsorted_run_merger.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/runtime/vsorted_run_merger.h" +#include "exec/sort/vsorted_run_merger.h" #include #include @@ -23,13 +23,13 @@ #include "common/exception.h" #include "common/logging.h" #include "common/status.h" -#include "util/runtime_profile.h" +#include "core/block/column_with_type_and_name.h" +#include "core/column/column.h" +#include "exec/common/util.hpp" +#include "runtime/runtime_profile.h" #include "util/stopwatch.hpp" -#include "vec/columns/column.h" -#include "vec/core/column_with_type_and_name.h" -#include "vec/utils/util.hpp" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" VSortedRunMerger::VSortedRunMerger(const VExprContextSPtrs& ordering_expr, @@ -222,4 +222,4 @@ bool VSortedRunMerger::_need_more_data(MergeSortCursor& current) { } } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/runtime/vsorted_run_merger.h b/be/src/exec/sort/vsorted_run_merger.h similarity index 94% rename from be/src/vec/runtime/vsorted_run_merger.h rename to be/src/exec/sort/vsorted_run_merger.h index d44a5b59dbd3f2..471333e862e5c3 100644 --- a/be/src/vec/runtime/vsorted_run_merger.h +++ b/be/src/exec/sort/vsorted_run_merger.h @@ -24,13 +24,13 @@ #include #include "common/status.h" -#include "util/runtime_profile.h" -#include "vec/core/block.h" -#include "vec/core/sort_cursor.h" -#include "vec/core/sort_description.h" -#include "vec/exprs/vexpr_fwd.h" +#include "core/block/block.h" +#include "exec/sort/sort_cursor.h" +#include "exec/sort/sort_description.h" +#include "exprs/vexpr_fwd.h" +#include "runtime/runtime_profile.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" // VSortedRunMerger is used to merge multiple sorted runs of blocks. A run is a sorted @@ -96,6 +96,6 @@ class VSortedRunMerger { bool _need_more_data(MergeSortCursor& current); }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/spill/spill_reader.cpp b/be/src/exec/spill/spill_reader.cpp similarity index 97% rename from be/src/vec/spill/spill_reader.cpp rename to be/src/exec/spill/spill_reader.cpp index bb74d20ec33436..4604d93cdf13e3 100644 --- a/be/src/vec/spill/spill_reader.cpp +++ b/be/src/exec/spill/spill_reader.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/spill/spill_reader.h" +#include "exec/spill/spill_reader.h" #include @@ -23,20 +23,19 @@ #include "common/cast_set.h" #include "common/exception.h" +#include "core/block/block.h" +#include "exec/spill/spill_stream_manager.h" #include "io/file_factory.h" #include "io/fs/file_reader.h" #include "io/fs/local_file_system.h" #include "runtime/exec_env.h" #include "util/slice.h" -#include "vec/core/block.h" -#include "vec/spill/spill_stream_manager.h" namespace doris { #include "common/compile_check_begin.h" namespace io { class FileSystem; } // namespace io -namespace vectorized { Status SpillReader::open() { if (file_reader_) { return Status::OK(); @@ -166,5 +165,4 @@ Status SpillReader::close() { return Status::OK(); } -} // namespace vectorized } // namespace doris \ No newline at end of file diff --git a/be/src/vec/spill/spill_reader.h b/be/src/exec/spill/spill_reader.h similarity index 95% rename from be/src/vec/spill/spill_reader.h rename to be/src/exec/spill/spill_reader.h index 1999b8a9d8899a..d787cf1735408b 100644 --- a/be/src/vec/spill/spill_reader.h +++ b/be/src/exec/spill/spill_reader.h @@ -24,13 +24,13 @@ #include #include "common/status.h" +#include "core/pod_array.h" +#include "core/pod_array_fwd.h" #include "io/fs/file_reader_writer_fwd.h" +#include "runtime/runtime_profile.h" #include "runtime/workload_management/resource_context.h" -#include "util/runtime_profile.h" -#include "vec/common/pod_array.h" -#include "vec/common/pod_array_fwd.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class Block; class SpillReader { @@ -95,5 +95,5 @@ class SpillReader { using SpillReaderUPtr = std::unique_ptr; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/spill/spill_stream.cpp b/be/src/exec/spill/spill_stream.cpp similarity index 95% rename from be/src/vec/spill/spill_stream.cpp rename to be/src/exec/spill/spill_stream.cpp index 9ab21c44ef1a33..07a7d85b116b22 100644 --- a/be/src/vec/spill/spill_stream.cpp +++ b/be/src/exec/spill/spill_stream.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/spill/spill_stream.h" +#include "exec/spill/spill_stream.h" #include @@ -23,19 +23,19 @@ #include #include +#include "core/block/block.h" +#include "exec/spill/spill_reader.h" +#include "exec/spill/spill_stream_manager.h" +#include "exec/spill/spill_writer.h" #include "io/fs/local_file_system.h" #include "runtime/exec_env.h" #include "runtime/query_context.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" #include "runtime/thread_context.h" #include "util/debug_points.h" -#include "util/runtime_profile.h" -#include "vec/core/block.h" -#include "vec/spill/spill_reader.h" -#include "vec/spill/spill_stream_manager.h" -#include "vec/spill/spill_writer.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" SpillStream::SpillStream(RuntimeState* state, int64_t stream_id, SpillDataDir* data_dir, std::string spill_dir, size_t batch_rows, size_t batch_bytes, @@ -170,4 +170,4 @@ Status SpillStream::read_next_block_sync(Block* block, bool* eos) { return reader_->read(block, eos); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/spill/spill_stream.h b/be/src/exec/spill/spill_stream.h similarity index 96% rename from be/src/vec/spill/spill_stream.h rename to be/src/exec/spill/spill_stream.h index 5d30d92ee3cc33..14420d2a6c9c14 100644 --- a/be/src/vec/spill/spill_stream.h +++ b/be/src/exec/spill/spill_stream.h @@ -20,16 +20,14 @@ #include #include -#include "vec/spill/spill_reader.h" -#include "vec/spill/spill_writer.h" +#include "exec/spill/spill_reader.h" +#include "exec/spill/spill_writer.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeProfile; class ThreadPool; -namespace vectorized { - class Block; class SpillDataDir; @@ -106,6 +104,5 @@ class SpillStream { RuntimeProfile::Counter* _current_file_size = nullptr; }; using SpillStreamSPtr = std::shared_ptr; -} // namespace vectorized } // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/spill/spill_stream_manager.cpp b/be/src/exec/spill/spill_stream_manager.cpp similarity index 97% rename from be/src/vec/spill/spill_stream_manager.cpp rename to be/src/exec/spill/spill_stream_manager.cpp index bdf804df76ea08..38d42daa6bd4c5 100644 --- a/be/src/vec/spill/spill_stream_manager.cpp +++ b/be/src/exec/spill/spill_stream_manager.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "vec/spill/spill_stream_manager.h" +#include "exec/spill/spill_stream_manager.h" #include #include @@ -28,27 +28,26 @@ #include #include "common/logging.h" +#include "common/metrics/doris_metrics.h" +#include "exec/spill/spill_stream.h" #include "io/fs/file_system.h" #include "io/fs/local_file_system.h" -#include "olap/olap_define.h" +#include "runtime/runtime_profile.h" #include "runtime/runtime_state.h" -#include "util/doris_metrics.h" +#include "storage/olap_define.h" #include "util/parse_util.h" #include "util/pretty_printer.h" -#include "util/runtime_profile.h" #include "util/time.h" #include "util/uid_util.h" -#include "vec/spill/spill_stream.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" SpillStreamManager::~SpillStreamManager() { DorisMetrics::instance()->metric_registry()->deregister_entity(_entity); } SpillStreamManager::SpillStreamManager( - std::unordered_map>&& - spill_store_map) + std::unordered_map>&& spill_store_map) : _spill_store_map(std::move(spill_store_map)), _stop_background_threads_latch(1) {} Status SpillStreamManager::init() { @@ -397,4 +396,4 @@ std::string SpillDataDir::debug_string() { PrettyPrinter::print_bytes(_spill_data_bytes), PrettyPrinter::print_bytes(_available_bytes)); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/spill/spill_stream_manager.h b/be/src/exec/spill/spill_stream_manager.h similarity index 95% rename from be/src/vec/spill/spill_stream_manager.h rename to be/src/exec/spill/spill_stream_manager.h index ae8a64b3e3a3a1..4ecd93a700abd9 100644 --- a/be/src/vec/spill/spill_stream_manager.h +++ b/be/src/exec/spill/spill_stream_manager.h @@ -23,10 +23,10 @@ #include #include -#include "olap/options.h" -#include "util/metrics.h" +#include "common/metrics/metrics.h" +#include "exec/spill/spill_stream.h" +#include "storage/options.h" #include "util/threadpool.h" -#include "vec/spill/spill_stream.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeProfile; @@ -39,8 +39,6 @@ using UIntGauge = AtomicGauge; class MetricEntity; struct MetricPrototype; -namespace vectorized { - class SpillStreamManager; class SpillDataDir { public: @@ -115,8 +113,8 @@ class SpillDataDir { class SpillStreamManager { public: ~SpillStreamManager(); - SpillStreamManager(std::unordered_map>&& - spill_store_map); + SpillStreamManager( + std::unordered_map>&& spill_store_map); Status init(); @@ -163,6 +161,5 @@ class SpillStreamManager { IntAtomicCounter* _spill_write_bytes_counter {nullptr}; IntAtomicCounter* _spill_read_bytes_counter {nullptr}; }; -} // namespace vectorized } // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/spill/spill_writer.cpp b/be/src/exec/spill/spill_writer.cpp similarity index 97% rename from be/src/vec/spill/spill_writer.cpp rename to be/src/exec/spill/spill_writer.cpp index a43162f43ceeff..ce5bfa14215ef5 100644 --- a/be/src/vec/spill/spill_writer.cpp +++ b/be/src/exec/spill/spill_writer.cpp @@ -15,18 +15,18 @@ // specific language governing permissions and limitations // under the License. -#include "vec/spill/spill_writer.h" +#include "exec/spill/spill_writer.h" #include "agent/be_exec_version_manager.h" #include "common/status.h" +#include "exec/spill/spill_stream_manager.h" #include "io/fs/local_file_system.h" #include "io/fs/local_file_writer.h" #include "runtime/exec_env.h" #include "runtime/runtime_state.h" #include "runtime/thread_context.h" -#include "vec/spill/spill_stream_manager.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" Status SpillWriter::open() { if (file_writer_) { @@ -175,4 +175,4 @@ Status SpillWriter::_write_internal(const Block& block, size_t& written_bytes) { return status; } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/spill/spill_writer.h b/be/src/exec/spill/spill_writer.h similarity index 97% rename from be/src/vec/spill/spill_writer.h rename to be/src/exec/spill/spill_writer.h index 6d10dcdb813396..c78fcaea98be54 100644 --- a/be/src/vec/spill/spill_writer.h +++ b/be/src/exec/spill/spill_writer.h @@ -21,15 +21,14 @@ #include #include +#include "core/block/block.h" #include "io/fs/file_writer.h" +#include "runtime/runtime_profile.h" #include "runtime/workload_management/resource_context.h" -#include "util/runtime_profile.h" -#include "vec/core/block.h" namespace doris { #include "common/compile_check_begin.h" class RuntimeState; -namespace vectorized { class SpillDataDir; class SpillWriter { public: @@ -99,7 +98,6 @@ class SpillWriter { std::shared_ptr _resource_ctx = nullptr; }; using SpillWriterUPtr = std::unique_ptr; -} // namespace vectorized } // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/exec/table_connector.cpp b/be/src/exec/table_connector.cpp index eaabf910b98587..cecd594a93307d 100644 --- a/be/src/exec/table_connector.cpp +++ b/be/src/exec/table_connector.cpp @@ -28,19 +28,19 @@ #include #include -#include "runtime/decimalv2_value.h" -#include "runtime/define_primitive_type.h" -#include "util/binary_cast.hpp" -#include "vec/columns/column.h" -#include "vec/columns/column_array.h" -#include "vec/columns/column_nullable.h" -#include "vec/common/assert_cast.h" -#include "vec/core/block.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_array.h" -#include "vec/data_types/data_type_date_or_datetime_v2.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/runtime/vdatetime_value.h" +#include "core/assert_cast.h" +#include "core/binary_cast.hpp" +#include "core/block/block.h" +#include "core/column/column.h" +#include "core/column/column_array.h" +#include "core/column/column_nullable.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type/data_type_date_or_datetime_v2.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/define_primitive_type.h" +#include "core/value/decimalv2_value.h" +#include "core/value/vdatetime_value.h" namespace doris { #include "common/compile_check_begin.h" diff --git a/be/src/exec/table_connector.h b/be/src/exec/table_connector.h index 45ceebb22b04eb..09dab7b88f5f15 100644 --- a/be/src/exec/table_connector.h +++ b/be/src/exec/table_connector.h @@ -25,19 +25,16 @@ #include #include "common/status.h" -#include "runtime/types.h" -#include "util/runtime_profile.h" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/data_types/data_type.h" -#include "vec/exprs/vexpr_fwd.h" +#include "core/data_type/data_type.h" +#include "exprs/aggregate/aggregate_function.h" +#include "exprs/vexpr_fwd.h" +#include "runtime/runtime_profile.h" namespace doris { class RuntimeState; class TupleDescriptor; -namespace vectorized { class Block; -} // namespace vectorized // Table Connector for scan data from JDBC class TableConnector { @@ -57,13 +54,11 @@ class TableConnector { virtual Status close(Status) = 0; - virtual Status exec_stmt_write(vectorized::Block* block, - const vectorized::VExprContextSPtrs& _output_vexpr_ctxs, + virtual Status exec_stmt_write(Block* block, const VExprContextSPtrs& _output_vexpr_ctxs, uint32_t* num_rows_sent) = 0; //write data into table vectorized - virtual Status append(vectorized::Block* block, - const vectorized::VExprContextSPtrs& _output_vexpr_ctxs, + virtual Status append(Block* block, const VExprContextSPtrs& _output_vexpr_ctxs, uint32_t start_send_row, uint32_t* num_rows_sent, TOdbcTableType::type table_type = TOdbcTableType::MYSQL) = 0; diff --git a/be/src/exprs/CMakeLists.txt b/be/src/exprs/CMakeLists.txt index 6442c84a06cf1a..d8995ccd8ad737 100644 --- a/be/src/exprs/CMakeLists.txt +++ b/be/src/exprs/CMakeLists.txt @@ -22,6 +22,39 @@ set(LIBRARY_OUTPUT_PATH "${BUILD_DIR}/src/exprs") set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/src/exprs") file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS *.cpp *.cc) + +# Add generated flex/bison sources for geo WKT parsing +set(SRC_FILES ${SRC_FILES} + ${GENSRC_DIR}/geo/wkt_lex.l.cpp + ${GENSRC_DIR}/geo/wkt_yacc.y.cpp +) + add_library(Exprs STATIC ${SRC_FILES}) +# function_array_distance uses faiss headers (platform_macros.h, distances.h), +# which are exported by ann_index via PUBLIC linkage with faiss. +target_link_libraries(Exprs PRIVATE ann_index) + +pch_reuse(Exprs) + +# Flex/Bison generation rules for geo WKT parsing +add_custom_command( + OUTPUT ${GENSRC_DIR}/geo/wkt_lex.l.cpp ${GENSRC_DIR}/geo/wkt_lex.l.h + COMMAND mkdir -p ${GENSRC_DIR}/geo + COMMAND flex --header-file=${GENSRC_DIR}/geo/wkt_lex.l.h --outfile=${GENSRC_DIR}/geo/wkt_lex.l.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/function/geo/wkt_lex.l + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/function/geo/wkt_lex.l) +set_source_files_properties(${GENSRC_DIR}/geo/wkt_lex.l.cpp PROPERTIES GENERATED TRUE) + +add_custom_command( + OUTPUT ${GENSRC_DIR}/geo/wkt_yacc.y.cpp ${GENSRC_DIR}/geo/wkt_yacc.y.hpp + COMMAND mkdir -p ${GENSRC_DIR}/geo + COMMAND bison --output=${GENSRC_DIR}/geo/wkt_yacc.y.cpp ${CMAKE_CURRENT_SOURCE_DIR}/function/geo/wkt_yacc.y + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/function/geo/wkt_yacc.y) +set_source_files_properties(${GENSRC_DIR}/geo/wkt_yacc.y.cpp PROPERTIES GENERATED TRUE) -pch_reuse(Exprs) \ No newline at end of file +include(CheckCXXCompilerFlag) +set(WARNING_OPTION "-Wno-unused-but-set-variable") +check_cxx_compiler_flag(${WARNING_OPTION} HAS_WARNING_OPTION) +if (HAS_WARNING_OPTION) + target_compile_options(Exprs PRIVATE ${WARNING_OPTION} "-Wno-unused-macros") +endif() \ No newline at end of file diff --git a/be/src/vec/aggregate_functions/aggregate_function.h b/be/src/exprs/aggregate/aggregate_function.h similarity index 98% rename from be/src/vec/aggregate_functions/aggregate_function.h rename to be/src/exprs/aggregate/aggregate_function.h index a0181210ac287d..475439cd39ce1d 100644 --- a/be/src/vec/aggregate_functions/aggregate_function.h +++ b/be/src/exprs/aggregate/aggregate_function.h @@ -25,18 +25,18 @@ #include "common/exception.h" #include "common/status.h" +#include "core/assert_cast.h" +#include "core/column/column_complex.h" +#include "core/column/column_fixed_length_object.h" +#include "core/column/column_string.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/data_type_string.h" +#include "core/string_buffer.hpp" +#include "core/types.h" +#include "exec/common/hash_table/phmap_fwd_decl.h" #include "util/defer_op.h" -#include "vec/columns/column_complex.h" -#include "vec/columns/column_fixed_length_object.h" -#include "vec/columns/column_string.h" -#include "vec/common/assert_cast.h" -#include "vec/common/hash_table/phmap_fwd_decl.h" -#include "vec/common/string_buffer.hpp" -#include "vec/core/types.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/data_types/data_type_string.h" - -namespace doris::vectorized { + +namespace doris { #include "common/compile_check_begin.h" class Arena; @@ -669,6 +669,6 @@ struct UnaryExpression {}; // Can only have one parameter struct MultiExpression {}; // Must have multiple parameters (more than 1) struct VarargsExpression {}; // Uncertain number of parameters -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/aggregate_functions/aggregate_function_ai_agg.cpp b/be/src/exprs/aggregate/aggregate_function_ai_agg.cpp similarity index 86% rename from be/src/vec/aggregate_functions/aggregate_function_ai_agg.cpp rename to be/src/exprs/aggregate/aggregate_function_ai_agg.cpp index b9e6e93ccf232f..44cbff4301be49 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_ai_agg.cpp +++ b/be/src/exprs/aggregate/aggregate_function_ai_agg.cpp @@ -15,12 +15,12 @@ // specific language governing permissions and limitations // under the License. -#include "vec/aggregate_functions/aggregate_function_ai_agg.h" +#include "exprs/aggregate/aggregate_function_ai_agg.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/aggregate_functions/helpers.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/aggregate/helpers.h" -namespace doris::vectorized { +namespace doris { QueryContext* AggregateFunctionAIAggData::_ctx = nullptr; void register_aggregate_function_ai_agg(AggregateFunctionSimpleFactory& factory) { @@ -32,4 +32,4 @@ void register_aggregate_function_ai_agg(AggregateFunctionSimpleFactory& factory) argument_types, result_is_nullable, attr); }); } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/aggregate_functions/aggregate_function_ai_agg.h b/be/src/exprs/aggregate/aggregate_function_ai_agg.h similarity index 97% rename from be/src/vec/aggregate_functions/aggregate_function_ai_agg.h rename to be/src/exprs/aggregate/aggregate_function_ai_agg.h index d27ceb41312c88..44fe74850c8205 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_ai_agg.h +++ b/be/src/exprs/aggregate/aggregate_function_ai_agg.h @@ -22,15 +22,15 @@ #include #include "common/status.h" -#include "http/http_client.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "exprs/aggregate/aggregate_function.h" +#include "exprs/function/ai/ai_adapter.h" #include "runtime/query_context.h" #include "runtime/runtime_state.h" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" -#include "vec/functions/ai/ai_adapter.h" +#include "service/http/http_client.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class AggregateFunctionAIAggData { @@ -307,4 +307,4 @@ class AggregateFunctionAIAgg final }; #include "common/compile_check_end.h" -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp b/be/src/exprs/aggregate/aggregate_function_approx_count_distinct.cpp similarity index 88% rename from be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp rename to be/src/exprs/aggregate/aggregate_function_approx_count_distinct.cpp index 81fb8462db14b3..314476b2e6ee7d 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp +++ b/be/src/exprs/aggregate/aggregate_function_approx_count_distinct.cpp @@ -15,13 +15,13 @@ // specific language governing permissions and limitations // under the License. -#include "vec/aggregate_functions/aggregate_function_approx_count_distinct.h" +#include "exprs/aggregate/aggregate_function_approx_count_distinct.h" -#include "runtime/define_primitive_type.h" -#include "vec/aggregate_functions/helpers.h" -#include "vec/data_types/data_type.h" +#include "core/data_type/data_type.h" +#include "core/data_type/define_primitive_type.h" +#include "exprs/aggregate/helpers.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" AggregateFunctionPtr create_aggregate_function_approx_count_distinct( @@ -43,4 +43,4 @@ void register_aggregate_function_approx_count_distinct(AggregateFunctionSimpleFa factory.register_alias("approx_count_distinct", "ndv"); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.h b/be/src/exprs/aggregate/aggregate_function_approx_count_distinct.h similarity index 91% rename from be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.h rename to be/src/exprs/aggregate/aggregate_function_approx_count_distinct.h index 6d3df4dd144724..6bf92387fdd4a7 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.h +++ b/be/src/exprs/aggregate/aggregate_function_approx_count_distinct.h @@ -23,28 +23,26 @@ #include #include -#include "olap/hll.h" +#include "core/assert_cast.h" +#include "core/column/column_decimal.h" +#include "core/data_type/data_type_number.h" +#include "core/string_ref.h" +#include "core/types.h" +#include "core/value/hll.h" +#include "exprs/aggregate/aggregate_function.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" #include "util/hash_util.hpp" #include "util/slice.h" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/columns/column_decimal.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type_number.h" namespace doris { #include "common/compile_check_begin.h" -namespace vectorized { class Arena; class BufferReadable; class BufferWritable; class IColumn; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { struct AggregateFunctionApproxCountDistinctData { HyperLogLog hll_data; @@ -136,6 +134,6 @@ class AggregateFunctionApproxCountDistinct final } }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/aggregate_functions/aggregate_function_array_agg.cpp b/be/src/exprs/aggregate/aggregate_function_array_agg.cpp similarity index 95% rename from be/src/vec/aggregate_functions/aggregate_function_array_agg.cpp rename to be/src/exprs/aggregate/aggregate_function_array_agg.cpp index a1b79dad5dd828..b47ac0174381ef 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_array_agg.cpp +++ b/be/src/exprs/aggregate/aggregate_function_array_agg.cpp @@ -15,13 +15,14 @@ // specific language governing permissions and limitations // under the License. -#include "vec/aggregate_functions/aggregate_function_array_agg.h" +#include "exprs/aggregate/aggregate_function_array_agg.h" -#include "vec/aggregate_functions/aggregate_function_collect.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/aggregate_functions/helpers.h" +#include "core/call_on_type_index.h" +#include "exprs/aggregate/aggregate_function_collect.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/aggregate/helpers.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" template @@ -112,4 +113,4 @@ AggregateFunctionPtr create_aggregate_function_array_agg(const std::string& name void register_aggregate_function_array_agg(AggregateFunctionSimpleFactory& factory) { factory.register_function_both("array_agg", create_aggregate_function_array_agg); } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/aggregate_functions/aggregate_function_array_agg.h b/be/src/exprs/aggregate/aggregate_function_array_agg.h similarity index 96% rename from be/src/vec/aggregate_functions/aggregate_function_array_agg.h rename to be/src/exprs/aggregate/aggregate_function_array_agg.h index 439c18d5ac6f1c..a998dd8fdbd553 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_array_agg.h +++ b/be/src/exprs/aggregate/aggregate_function_array_agg.h @@ -17,22 +17,22 @@ #pragma once -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/columns/column.h" -#include "vec/columns/column_array.h" -#include "vec/columns/column_decimal.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_string.h" -#include "vec/common/assert_cast.h" -#include "vec/common/string_buffer.hpp" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_array.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/io/io_helper.h" - -namespace doris::vectorized { +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_array.h" +#include "core/column/column_decimal.h" +#include "core/column/column_nullable.h" +#include "core/column/column_string.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type/data_type_nullable.h" +#include "core/string_buffer.hpp" +#include "core/string_ref.h" +#include "core/types.h" +#include "exprs/aggregate/aggregate_function.h" +#include "util/io_helper.h" + +namespace doris { #include "common/compile_check_begin.h" class Arena; @@ -405,6 +405,6 @@ class AggregateFunctionArrayAgg DataTypePtr return_type; }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/aggregate_functions/aggregate_function_avg.cpp b/be/src/exprs/aggregate/aggregate_function_avg.cpp similarity index 91% rename from be/src/vec/aggregate_functions/aggregate_function_avg.cpp rename to be/src/exprs/aggregate/aggregate_function_avg.cpp index ff8e6b9b58fba9..acf2cd8d8301e8 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_avg.cpp +++ b/be/src/exprs/aggregate/aggregate_function_avg.cpp @@ -18,14 +18,14 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/AggregateFunctions/AggregateFunctionAvg.cpp // and modified by Doris -#include "vec/aggregate_functions/aggregate_function_avg.h" +#include "exprs/aggregate/aggregate_function_avg.h" -#include "runtime/define_primitive_type.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/aggregate_functions/helpers.h" -#include "vec/core/field.h" +#include "core/data_type/define_primitive_type.h" +#include "core/field.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/aggregate/helpers.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" constexpr PrimitiveType result_type(PrimitiveType T) { @@ -81,4 +81,4 @@ void register_aggregate_function_avg(AggregateFunctionSimpleFactory& factory) { }; factory.register_function_both("avg", creator); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/aggregate_functions/aggregate_function_avg.h b/be/src/exprs/aggregate/aggregate_function_avg.h similarity index 96% rename from be/src/vec/aggregate_functions/aggregate_function_avg.h rename to be/src/exprs/aggregate/aggregate_function_avg.h index 98ee71b0c5db2e..ee6d8015e15717 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_avg.h +++ b/be/src/exprs/aggregate/aggregate_function_avg.h @@ -29,18 +29,18 @@ #include #include -#include "runtime/decimalv2_value.h" -#include "runtime/primitive_type.h" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/columns/column.h" -#include "vec/columns/column_fixed_length_object.h" -#include "vec/common/assert_cast.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/data_types/data_type_fixed_length_object.h" - -namespace doris::vectorized { +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_fixed_length_object.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_decimal.h" +#include "core/data_type/data_type_fixed_length_object.h" +#include "core/data_type/primitive_type.h" +#include "core/types.h" +#include "core/value/decimalv2_value.h" +#include "exprs/aggregate/aggregate_function.h" + +namespace doris { #include "common/compile_check_begin.h" class Arena; class BufferReadable; @@ -361,6 +361,6 @@ class AggregateFunctionAvg final ResultType multiplier; }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/aggregate_functions/aggregate_function_avg_weighted.cpp b/be/src/exprs/aggregate/aggregate_function_avg_weighted.cpp similarity index 78% rename from be/src/vec/aggregate_functions/aggregate_function_avg_weighted.cpp rename to be/src/exprs/aggregate/aggregate_function_avg_weighted.cpp index 4e0eb917f49282..4f403e7a7aa438 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_avg_weighted.cpp +++ b/be/src/exprs/aggregate/aggregate_function_avg_weighted.cpp @@ -15,16 +15,16 @@ // specific language governing permissions and limitations // under the License. -#include "vec/aggregate_functions/aggregate_function_avg_weighted.h" +#include "exprs/aggregate/aggregate_function_avg_weighted.h" -#include "runtime/define_primitive_type.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/aggregate_functions/helpers.h" +#include "core/data_type/define_primitive_type.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/aggregate/helpers.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" void register_aggregate_function_avg_weighted(AggregateFunctionSimpleFactory& factory) { factory.register_function_both( "avg_weighted", creator_without_type::creator>); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/aggregate_functions/aggregate_function_avg_weighted.h b/be/src/exprs/aggregate/aggregate_function_avg_weighted.h similarity index 92% rename from be/src/vec/aggregate_functions/aggregate_function_avg_weighted.h rename to be/src/exprs/aggregate/aggregate_function_avg_weighted.h index 73fed5d572fe39..23a36541a9824a 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_avg_weighted.h +++ b/be/src/exprs/aggregate/aggregate_function_avg_weighted.h @@ -26,16 +26,16 @@ #include #include "common/status.h" -#include "runtime/decimalv2_value.h" -#include "util/binary_cast.hpp" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type_number.h" -#include "vec/io/io_helper.h" - -namespace doris::vectorized { +#include "core/assert_cast.h" +#include "core/binary_cast.hpp" +#include "core/column/column_vector.h" +#include "core/data_type/data_type_number.h" +#include "core/types.h" +#include "core/value/decimalv2_value.h" +#include "exprs/aggregate/aggregate_function.h" +#include "util/io_helper.h" + +namespace doris { #include "common/compile_check_begin.h" class Arena; class BufferReadable; @@ -133,6 +133,6 @@ class AggregateFunctionAvgWeight final } }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/aggregate_functions/aggregate_function_binary.h b/be/src/exprs/aggregate/aggregate_function_binary.h similarity index 89% rename from be/src/vec/aggregate_functions/aggregate_function_binary.h rename to be/src/exprs/aggregate/aggregate_function_binary.h index efa8d222d7b431..96a8d9c3ad3b8f 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_binary.h +++ b/be/src/exprs/aggregate/aggregate_function_binary.h @@ -21,16 +21,16 @@ #include -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/columns/column_decimal.h" -#include "vec/columns/column_vector.h" -#include "vec/common/string_buffer.hpp" -#include "vec/core/types.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/data_types/data_type_number.h" - -namespace doris::vectorized { +#include "core/column/column_decimal.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type_decimal.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/data_type_number.h" +#include "core/string_buffer.hpp" +#include "core/types.h" +#include "exprs/aggregate/aggregate_function.h" + +namespace doris { #include "common/compile_check_begin.h" template typename Moments> @@ -96,6 +96,6 @@ struct AggregateFunctionBinary } }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/aggregate_functions/aggregate_function_bit.cpp b/be/src/exprs/aggregate/aggregate_function_bit.cpp similarity index 85% rename from be/src/vec/aggregate_functions/aggregate_function_bit.cpp rename to be/src/exprs/aggregate/aggregate_function_bit.cpp index 02ef6ca980c7da..16712a3d7a7e2c 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_bit.cpp +++ b/be/src/exprs/aggregate/aggregate_function_bit.cpp @@ -18,13 +18,13 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/AggregateFunctions/AggregateFunctionBitwise.cpp // and modified by Doris -#include "vec/aggregate_functions/aggregate_function_bit.h" +#include "exprs/aggregate/aggregate_function_bit.h" -#include "runtime/define_primitive_type.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/aggregate_functions/helpers.h" +#include "core/data_type/define_primitive_type.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/aggregate/helpers.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" void register_aggregate_function_bit(AggregateFunctionSimpleFactory& factory) { @@ -41,4 +41,4 @@ void register_aggregate_function_bit(AggregateFunctionSimpleFactory& factory) { creator::creator); } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/aggregate_functions/aggregate_function_bit.h b/be/src/exprs/aggregate/aggregate_function_bit.h similarity index 95% rename from be/src/vec/aggregate_functions/aggregate_function_bit.h rename to be/src/exprs/aggregate/aggregate_function_bit.h index c06ed7464b4518..754cb392778eaf 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_bit.h +++ b/be/src/exprs/aggregate/aggregate_function_bit.h @@ -24,13 +24,13 @@ #include -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/common/assert_cast.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type_number.h" // IWYU pragma: keep -#include "vec/io/io_helper.h" +#include "core/assert_cast.h" +#include "core/data_type/data_type_number.h" // IWYU pragma: keep +#include "core/types.h" +#include "exprs/aggregate/aggregate_function.h" +#include "util/io_helper.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" class Arena; class BufferReadable; @@ -150,5 +150,5 @@ class AggregateFunctionBitwise final } }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/aggregate_functions/aggregate_function_bitmap.cpp b/be/src/exprs/aggregate/aggregate_function_bitmap.cpp similarity index 92% rename from be/src/vec/aggregate_functions/aggregate_function_bitmap.cpp rename to be/src/exprs/aggregate/aggregate_function_bitmap.cpp index 0932216b908009..675d360ca0c10d 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_bitmap.cpp +++ b/be/src/exprs/aggregate/aggregate_function_bitmap.cpp @@ -15,14 +15,14 @@ // specific language governing permissions and limitations // under the License. -#include "vec/aggregate_functions/aggregate_function_bitmap.h" +#include "exprs/aggregate/aggregate_function_bitmap.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/aggregate_functions/helpers.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_nullable.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_nullable.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/aggregate/helpers.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" template class AggregateFunctionTemplate> @@ -85,4 +85,4 @@ void register_aggregate_function_bitmap(AggregateFunctionSimpleFactory& factory) create_aggregate_function_bitmap_union_count); factory.register_function_both("bitmap_union_int", create_aggregate_function_bitmap_union_int); } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/aggregate_functions/aggregate_function_bitmap.h b/be/src/exprs/aggregate/aggregate_function_bitmap.h similarity index 97% rename from be/src/vec/aggregate_functions/aggregate_function_bitmap.h rename to be/src/exprs/aggregate/aggregate_function_bitmap.h index 18a1d0480c5e75..fa2fa12584195c 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_bitmap.h +++ b/be/src/exprs/aggregate/aggregate_function_bitmap.h @@ -27,17 +27,17 @@ #include "agent/be_exec_version_manager.h" #include "common/compiler_util.h" // IWYU pragma: keep -#include "util/bitmap_value.h" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/columns/column_complex.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type_bitmap.h" -#include "vec/data_types/data_type_number.h" - -namespace doris::vectorized { +#include "core/assert_cast.h" +#include "core/column/column_complex.h" +#include "core/column/column_nullable.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type_bitmap.h" +#include "core/data_type/data_type_number.h" +#include "core/types.h" +#include "core/value/bitmap_value.h" +#include "exprs/aggregate/aggregate_function.h" + +namespace doris { #include "common/compile_check_begin.h" class Arena; @@ -456,5 +456,5 @@ AggregateFunctionPtr create_aggregate_function_bitmap_union(const std::string& n const DataTypes& argument_types, const bool result_is_nullable); -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/aggregate_functions/aggregate_function_bitmap_agg.cpp b/be/src/exprs/aggregate/aggregate_function_bitmap_agg.cpp similarity index 89% rename from be/src/vec/aggregate_functions/aggregate_function_bitmap_agg.cpp rename to be/src/exprs/aggregate/aggregate_function_bitmap_agg.cpp index 7771b5bf4d798f..067cb3aee220c7 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_bitmap_agg.cpp +++ b/be/src/exprs/aggregate/aggregate_function_bitmap_agg.cpp @@ -15,14 +15,14 @@ // specific language governing permissions and limitations // under the License. -#include "vec/aggregate_functions/aggregate_function_bitmap_agg.h" +#include "exprs/aggregate/aggregate_function_bitmap_agg.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/aggregate_functions/helpers.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_nullable.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_nullable.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/aggregate/helpers.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" template @@ -60,4 +60,4 @@ AggregateFunctionPtr create_aggregate_function_bitmap_agg(const std::string& nam void register_aggregate_function_bitmap_agg(AggregateFunctionSimpleFactory& factory) { factory.register_function_both("bitmap_agg", create_aggregate_function_bitmap_agg); } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/aggregate_functions/aggregate_function_bitmap_agg.h b/be/src/exprs/aggregate/aggregate_function_bitmap_agg.h similarity index 96% rename from be/src/vec/aggregate_functions/aggregate_function_bitmap_agg.h rename to be/src/exprs/aggregate/aggregate_function_bitmap_agg.h index b0cf1c6aa8d577..785d5d6669a6b3 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_bitmap_agg.h +++ b/be/src/exprs/aggregate/aggregate_function_bitmap_agg.h @@ -25,22 +25,20 @@ #include #include -#include "util/bitmap_value.h" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/common/assert_cast.h" -#include "vec/data_types/data_type_bitmap.h" +#include "core/assert_cast.h" +#include "core/data_type/data_type_bitmap.h" +#include "core/value/bitmap_value.h" +#include "exprs/aggregate/aggregate_function.h" namespace doris { #include "common/compile_check_begin.h" -namespace vectorized { class Arena; class BufferReadable; class BufferWritable; class IColumn; -} // namespace vectorized } // namespace doris -namespace doris::vectorized { +namespace doris { template struct AggregateFunctionBitmapAggData { @@ -207,5 +205,5 @@ class AggregateFunctionBitmapAgg final } }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/aggregate_functions/aggregate_function_bool_union.cpp b/be/src/exprs/aggregate/aggregate_function_bool_union.cpp similarity index 85% rename from be/src/vec/aggregate_functions/aggregate_function_bool_union.cpp rename to be/src/exprs/aggregate/aggregate_function_bool_union.cpp index a05fb0b1902422..02d95b46510fe5 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_bool_union.cpp +++ b/be/src/exprs/aggregate/aggregate_function_bool_union.cpp @@ -15,15 +15,15 @@ // specific language governing permissions and limitations // under the License. -#include "vec/aggregate_functions/aggregate_function_bool_union.h" +#include "exprs/aggregate/aggregate_function_bool_union.h" #include -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/aggregate_functions/helpers.h" -#include "vec/data_types/data_type.h" +#include "core/data_type/data_type.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/aggregate/helpers.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" void register_aggregate_function_bool_union(AggregateFunctionSimpleFactory& factory) { @@ -40,5 +40,5 @@ void register_aggregate_function_bool_union(AggregateFunctionSimpleFactory& fact factory.register_alias("bool_and", "booland_agg"); factory.register_alias("bool_xor", "boolxor_agg"); } -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" \ No newline at end of file diff --git a/be/src/vec/aggregate_functions/aggregate_function_bool_union.h b/be/src/exprs/aggregate/aggregate_function_bool_union.h similarity index 86% rename from be/src/vec/aggregate_functions/aggregate_function_bool_union.h rename to be/src/exprs/aggregate/aggregate_function_bool_union.h index d0710cc071e3ff..68a2dcc53a8a0c 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_bool_union.h +++ b/be/src/exprs/aggregate/aggregate_function_bool_union.h @@ -17,19 +17,19 @@ #pragma once -#include "runtime/define_primitive_type.h" -#include "runtime/primitive_type.h" -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/aggregate_functions/aggregate_function_bit.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/data_types/data_type_number.h" - -namespace doris::vectorized { +#include "core/assert_cast.h" +#include "core/column/column_nullable.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/data_type_number.h" +#include "core/data_type/define_primitive_type.h" +#include "core/data_type/primitive_type.h" +#include "core/types.h" +#include "exprs/aggregate/aggregate_function.h" +#include "exprs/aggregate/aggregate_function_bit.h" + +namespace doris { #include "common/compile_check_begin.h" struct AggregateFunctionBoolXorData { @@ -106,6 +106,6 @@ class AggregateFuntionBoolUnion final assert_cast(to).insert_value(this->data(place).get()); } }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" \ No newline at end of file diff --git a/be/src/vec/aggregate_functions/aggregate_function_collect.cpp b/be/src/exprs/aggregate/aggregate_function_collect.cpp similarity index 96% rename from be/src/vec/aggregate_functions/aggregate_function_collect.cpp rename to be/src/exprs/aggregate/aggregate_function_collect.cpp index 4df9c470c8db3f..7fb9e0f6e543bb 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_collect.cpp +++ b/be/src/exprs/aggregate/aggregate_function_collect.cpp @@ -15,15 +15,16 @@ // specific language governing permissions and limitations // under the License. -#include "vec/aggregate_functions/aggregate_function_collect.h" +#include "exprs/aggregate/aggregate_function_collect.h" #include "common/exception.h" #include "common/status.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/aggregate_functions/factory_helpers.h" -#include "vec/aggregate_functions/helpers.h" +#include "core/call_on_type_index.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/aggregate/factory_helpers.h" +#include "exprs/aggregate/helpers.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" template @@ -149,4 +150,4 @@ void register_aggregate_function_collect_list(AggregateFunctionSimpleFactory& fa factory.register_alias("collect_list", "group_array"); factory.register_alias("collect_set", "group_uniq_array"); } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/aggregate_functions/aggregate_function_collect.h b/be/src/exprs/aggregate/aggregate_function_collect.h similarity index 95% rename from be/src/vec/aggregate_functions/aggregate_function_collect.h rename to be/src/exprs/aggregate/aggregate_function_collect.h index b7c2474f91e887..b9a90211afad6f 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_collect.h +++ b/be/src/exprs/aggregate/aggregate_function_collect.h @@ -27,24 +27,24 @@ #include #include -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/columns/column.h" -#include "vec/columns/column_array.h" -#include "vec/columns/column_decimal.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_string.h" -#include "vec/common/assert_cast.h" -#include "vec/common/pod_array_fwd.h" -#include "vec/common/string_buffer.hpp" -#include "vec/common/string_ref.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_array.h" -#include "vec/data_types/data_type_nullable.h" -#include "vec/io/io_helper.h" -#include "vec/io/var_int.h" - -namespace doris::vectorized { +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_array.h" +#include "core/column/column_decimal.h" +#include "core/column/column_nullable.h" +#include "core/column/column_string.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_array.h" +#include "core/data_type/data_type_nullable.h" +#include "core/pod_array_fwd.h" +#include "core/string_buffer.hpp" +#include "core/string_ref.h" +#include "core/types.h" +#include "exprs/aggregate/aggregate_function.h" +#include "util/io_helper.h" +#include "util/var_int.h" + +namespace doris { #include "common/compile_check_begin.h" template struct AggregateFunctionCollectSetData { @@ -474,6 +474,6 @@ class AggregateFunctionCollect DataTypePtr return_type; }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/aggregate_functions/aggregate_function_combinator.h b/be/src/exprs/aggregate/aggregate_function_combinator.h similarity index 94% rename from be/src/vec/aggregate_functions/aggregate_function_combinator.h rename to be/src/exprs/aggregate/aggregate_function_combinator.h index a58378b6214c5c..68c54523ce8a52 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_combinator.h +++ b/be/src/exprs/aggregate/aggregate_function_combinator.h @@ -22,10 +22,10 @@ #include -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/data_types/data_type.h" +#include "core/data_type/data_type.h" +#include "exprs/aggregate/aggregate_function.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" /** Aggregate function combinator allows to take one aggregate function @@ -69,6 +69,6 @@ class IAggregateFunctionCombinator { virtual ~IAggregateFunctionCombinator() = default; }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/aggregate_functions/aggregate_function_corr.cpp b/be/src/exprs/aggregate/aggregate_function_corr.cpp similarity index 88% rename from be/src/vec/aggregate_functions/aggregate_function_corr.cpp rename to be/src/exprs/aggregate/aggregate_function_corr.cpp index 7ce9bb5e5de5f7..487a151c4be5fc 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_corr.cpp +++ b/be/src/exprs/aggregate/aggregate_function_corr.cpp @@ -15,15 +15,15 @@ // specific language governing permissions and limitations // under the License. -#include "aggregate_function_corr.h" +#include "exprs/aggregate/aggregate_function_corr.h" -#include "runtime/define_primitive_type.h" -#include "vec/aggregate_functions/aggregate_function_binary.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/aggregate_functions/factory_helpers.h" -#include "vec/aggregate_functions/helpers.h" +#include "core/data_type/define_primitive_type.h" +#include "exprs/aggregate/aggregate_function_binary.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/aggregate/factory_helpers.h" +#include "exprs/aggregate/helpers.h" -namespace doris::vectorized { +namespace doris { template using CorrMomentStat = StatFunc; @@ -63,4 +63,4 @@ void register_aggregate_functions_corr_welford(AggregateFunctionSimpleFactory& f factory.register_function_both("corr_welford", create_aggregate_corr_welford_function); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/aggregate_functions/aggregate_function_corr.h b/be/src/exprs/aggregate/aggregate_function_corr.h similarity index 97% rename from be/src/vec/aggregate_functions/aggregate_function_corr.h rename to be/src/exprs/aggregate/aggregate_function_corr.h index c4b0c4e42a2395..d63f9c64aaf162 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_corr.h +++ b/be/src/exprs/aggregate/aggregate_function_corr.h @@ -15,10 +15,10 @@ // specific language governing permissions and limitations // under the License. -#include "vec/core/types.h" -#include "vec/io/io_helper.h" +#include "core/types.h" +#include "util/io_helper.h" -namespace doris::vectorized { +namespace doris { template struct CorrMoment { @@ -166,4 +166,4 @@ struct CorrMomentWelford { count = 0; } }; -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/aggregate_functions/aggregate_function_count.cpp b/be/src/exprs/aggregate/aggregate_function_count.cpp similarity index 89% rename from be/src/vec/aggregate_functions/aggregate_function_count.cpp rename to be/src/exprs/aggregate/aggregate_function_count.cpp index 2fcfecbde9a21f..350bf4fa7d2ce6 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_count.cpp +++ b/be/src/exprs/aggregate/aggregate_function_count.cpp @@ -18,14 +18,14 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/AggregateFunctions/AggregateFunctionCount.cpp // and modified by Doris -#include "vec/aggregate_functions/aggregate_function_count.h" +#include "exprs/aggregate/aggregate_function_count.h" #include -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/aggregate_functions/factory_helpers.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/aggregate/factory_helpers.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" AggregateFunctionPtr create_aggregate_function_count(const std::string& name, @@ -51,4 +51,4 @@ void register_aggregate_function_count(AggregateFunctionSimpleFactory& factory) factory.register_function("count", create_aggregate_function_count_not_null_unary, true); } -} // namespace doris::vectorized +} // namespace doris diff --git a/be/src/vec/aggregate_functions/aggregate_function_count.h b/be/src/exprs/aggregate/aggregate_function_count.h similarity index 95% rename from be/src/vec/aggregate_functions/aggregate_function_count.h rename to be/src/exprs/aggregate/aggregate_function_count.h index 08f753da91e093..35317a6240ac77 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_count.h +++ b/be/src/exprs/aggregate/aggregate_function_count.h @@ -27,18 +27,18 @@ #include #include -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/columns/column.h" -#include "vec/columns/column_fixed_length_object.h" -#include "vec/columns/column_nullable.h" -#include "vec/columns/column_vector.h" -#include "vec/common/assert_cast.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" -#include "vec/data_types/data_type_fixed_length_object.h" -#include "vec/data_types/data_type_number.h" - -namespace doris::vectorized { +#include "core/assert_cast.h" +#include "core/column/column.h" +#include "core/column/column_fixed_length_object.h" +#include "core/column/column_nullable.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type.h" +#include "core/data_type/data_type_fixed_length_object.h" +#include "core/data_type/data_type_number.h" +#include "core/types.h" +#include "exprs/aggregate/aggregate_function.h" + +namespace doris { #include "common/compile_check_begin.h" class Arena; class BufferReadable; @@ -123,7 +123,7 @@ class AggregateFunctionCount final auto& col = assert_cast(column); auto* data = reinterpret_cast(col.get_data().data()); for (size_t i = begin; i <= end; ++i) { - doris::vectorized::AggregateFunctionCount::data(place).count += data[i].count; + doris::AggregateFunctionCount::data(place).count += data[i].count; } } @@ -265,8 +265,7 @@ class AggregateFunctionCountNotNullUnary final auto& col = assert_cast(column); auto* data = reinterpret_cast(col.get_data().data()); for (size_t i = begin; i <= end; ++i) { - doris::vectorized::AggregateFunctionCountNotNullUnary::data(place).count += - data[i].count; + doris::AggregateFunctionCountNotNullUnary::data(place).count += data[i].count; } } @@ -334,6 +333,6 @@ class AggregateFunctionCountNotNullUnary final } }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/aggregate_functions/aggregate_function_count_by_enum.cpp b/be/src/exprs/aggregate/aggregate_function_count_by_enum.cpp similarity index 87% rename from be/src/vec/aggregate_functions/aggregate_function_count_by_enum.cpp rename to be/src/exprs/aggregate/aggregate_function_count_by_enum.cpp index d05cf751d0db64..9952ed08296b6b 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_count_by_enum.cpp +++ b/be/src/exprs/aggregate/aggregate_function_count_by_enum.cpp @@ -18,14 +18,14 @@ // https://github.com/ClickHouse/ClickHouse/blob/master/src/AggregateFunctions/AggregateFunctionCount.cpp // and modified by Doris -#include "vec/aggregate_functions/aggregate_function_count_by_enum.h" +#include "exprs/aggregate/aggregate_function_count_by_enum.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/aggregate_functions/factory_helpers.h" -#include "vec/aggregate_functions/helpers.h" -#include "vec/core/types.h" +#include "core/types.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/aggregate/factory_helpers.h" +#include "exprs/aggregate/helpers.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" AggregateFunctionPtr create_aggregate_function_count_by_enum(const std::string& name, @@ -55,4 +55,4 @@ void register_aggregate_function_count_by_enum(AggregateFunctionSimpleFactory& f factory.register_function("count_by_enum", create_aggregate_function_count_by_enum, false); } -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris \ No newline at end of file diff --git a/be/src/vec/aggregate_functions/aggregate_function_count_by_enum.h b/be/src/exprs/aggregate/aggregate_function_count_by_enum.h similarity index 97% rename from be/src/vec/aggregate_functions/aggregate_function_count_by_enum.h rename to be/src/exprs/aggregate/aggregate_function_count_by_enum.h index 5f36ab56c4e4fe..40bccd7e5fc1c0 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_count_by_enum.h +++ b/be/src/exprs/aggregate/aggregate_function_count_by_enum.h @@ -23,11 +23,11 @@ #include -#include "vec/aggregate_functions/aggregate_function.h" -#include "vec/columns/column_nullable.h" -#include "vec/common/assert_cast.h" +#include "core/assert_cast.h" +#include "core/column/column_nullable.h" +#include "exprs/aggregate/aggregate_function.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" struct CountByEnumData { @@ -237,5 +237,5 @@ class AggregateFunctionCountByEnum final size_t arg_count; }; -} // namespace doris::vectorized +} // namespace doris #include "common/compile_check_end.h" diff --git a/be/src/vec/aggregate_functions/aggregate_function_covar.cpp b/be/src/exprs/aggregate/aggregate_function_covar.cpp similarity index 92% rename from be/src/vec/aggregate_functions/aggregate_function_covar.cpp rename to be/src/exprs/aggregate/aggregate_function_covar.cpp index a108589cf70b96..2952b44369bf10 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_covar.cpp +++ b/be/src/exprs/aggregate/aggregate_function_covar.cpp @@ -15,13 +15,13 @@ // specific language governing permissions and limitations // under the License. -#include "vec/aggregate_functions/aggregate_function_covar.h" +#include "exprs/aggregate/aggregate_function_covar.h" -#include "vec/aggregate_functions/aggregate_function_simple_factory.h" -#include "vec/aggregate_functions/helpers.h" -#include "vec/data_types/data_type.h" +#include "core/data_type/data_type.h" +#include "exprs/aggregate/aggregate_function_simple_factory.h" +#include "exprs/aggregate/helpers.h" -namespace doris::vectorized { +namespace doris { #include "common/compile_check_begin.h" template