diff --git a/be/src/agent/agent_server.cpp b/be/src/agent/agent_server.cpp index 962eff6868..34cdfe5731 100644 --- a/be/src/agent/agent_server.cpp +++ b/be/src/agent/agent_server.cpp @@ -17,6 +17,8 @@ #include "agent/agent_server.h" +#include + #include #include diff --git a/be/src/exec/analytic_eval_node.h b/be/src/exec/analytic_eval_node.h index 39f198d5b0..c09de063a4 100644 --- a/be/src/exec/analytic_eval_node.h +++ b/be/src/exec/analytic_eval_node.h @@ -20,13 +20,14 @@ #pragma once +#include + #include "exec/exec_node.h" #include "exprs/expr.h" #include "runtime/buffered_block_mgr2.h" #include "runtime/buffered_tuple_stream2.h" #include "runtime/buffered_tuple_stream2.inline.h" #include "runtime/tuple.h" -#include "thrift/protocol/TDebugProtocol.h" namespace doris { diff --git a/be/src/exec/arrow/parquet_reader.cpp b/be/src/exec/arrow/parquet_reader.cpp index 5c57efc4be..330d983c36 100644 --- a/be/src/exec/arrow/parquet_reader.cpp +++ b/be/src/exec/arrow/parquet_reader.cpp @@ -28,15 +28,10 @@ #include "common/logging.h" #include "common/status.h" #include "exec/file_reader.h" -#include "gen_cpp/PaloBrokerService_types.h" -#include "gen_cpp/TPaloBrokerService.h" -#include "runtime/broker_mgr.h" -#include "runtime/client_cache.h" #include "runtime/descriptors.h" -#include "runtime/exec_env.h" #include "runtime/mem_pool.h" +#include "runtime/string_value.h" #include "runtime/tuple.h" -#include "util/thrift_util.h" namespace doris { diff --git a/be/src/exec/es/es_scroll_parser.cpp b/be/src/exec/es/es_scroll_parser.cpp index dbb00939b8..36475d9cab 100644 --- a/be/src/exec/es/es_scroll_parser.cpp +++ b/be/src/exec/es/es_scroll_parser.cpp @@ -22,7 +22,6 @@ #include #include -#include "common/logging.h" #include "common/status.h" #include "rapidjson/document.h" #include "rapidjson/rapidjson.h" @@ -30,6 +29,7 @@ #include "rapidjson/writer.h" #include "runtime/mem_pool.h" #include "runtime/mem_tracker.h" +#include "runtime/string_value.h" #include "util/string_parser.hpp" #include "vec/runtime/vdatetime_value.h" diff --git a/be/src/exec/odbc_connector.cpp b/be/src/exec/odbc_connector.cpp index fe5f05310f..19defd6c37 100644 --- a/be/src/exec/odbc_connector.cpp +++ b/be/src/exec/odbc_connector.cpp @@ -22,9 +22,9 @@ #include #include "common/config.h" -#include "common/logging.h" #include "exprs/expr.h" #include "runtime/primitive_type.h" +#include "util/mysql_global.h" #include "util/types.h" #define ODBC_DISPOSE(h, ht, x, op) \ diff --git a/be/src/exec/olap_common.cpp b/be/src/exec/olap_common.cpp index aa15d7d12c..6b0ac960fa 100644 --- a/be/src/exec/olap_common.cpp +++ b/be/src/exec/olap_common.cpp @@ -25,6 +25,7 @@ #include #include "exec/olap_utils.h" +#include "runtime/large_int_value.h" namespace doris { diff --git a/be/src/exec/olap_scan_node.cpp b/be/src/exec/olap_scan_node.cpp index 0a4bb028a3..e365cfcae0 100644 --- a/be/src/exec/olap_scan_node.cpp +++ b/be/src/exec/olap_scan_node.cpp @@ -30,13 +30,13 @@ #include "exprs/runtime_filter.h" #include "gen_cpp/PlanNodes_types.h" #include "runtime/exec_env.h" +#include "runtime/large_int_value.h" #include "runtime/row_batch.h" #include "runtime/runtime_filter_mgr.h" #include "runtime/runtime_state.h" #include "runtime/string_value.h" #include "runtime/tuple_row.h" #include "util/priority_thread_pool.hpp" -#include "util/priority_work_stealing_thread_pool.hpp" #include "util/runtime_profile.h" namespace doris { diff --git a/be/src/exec/parquet_writer.cpp b/be/src/exec/parquet_writer.cpp index bf8be94097..befdb1cc54 100644 --- a/be/src/exec/parquet_writer.cpp +++ b/be/src/exec/parquet_writer.cpp @@ -21,16 +21,8 @@ #include #include -#include "common/logging.h" #include "exec/file_writer.h" -#include "gen_cpp/PaloBrokerService_types.h" -#include "gen_cpp/TPaloBrokerService.h" -#include "runtime/broker_mgr.h" -#include "runtime/client_cache.h" -#include "runtime/descriptors.h" -#include "runtime/exec_env.h" -#include "runtime/mem_pool.h" -#include "util/thrift_util.h" +#include "util/mysql_global.h" #include "util/types.h" namespace doris { diff --git a/be/src/exec/tablet_info.cpp b/be/src/exec/tablet_info.cpp index c8f3b5ef16..542363b6e1 100644 --- a/be/src/exec/tablet_info.cpp +++ b/be/src/exec/tablet_info.cpp @@ -17,9 +17,8 @@ #include "exec/tablet_info.h" +#include "runtime/large_int_value.h" #include "runtime/mem_pool.h" -#include "runtime/row_batch.h" -#include "runtime/tuple_row.h" #include "util/random.h" #include "util/string_parser.hpp" #include "util/time.h" diff --git a/be/src/exec/text_converter.hpp b/be/src/exec/text_converter.hpp index 0de56b83b3..14667c35c0 100644 --- a/be/src/exec/text_converter.hpp +++ b/be/src/exec/text_converter.hpp @@ -21,18 +21,17 @@ #include -#include "olap/utils.h" #include "runtime/datetime_value.h" #include "runtime/decimalv2_value.h" #include "runtime/descriptors.h" #include "runtime/mem_pool.h" -#include "runtime/runtime_state.h" #include "runtime/string_value.h" #include "runtime/tuple.h" #include "text_converter.h" #include "util/binary_cast.hpp" #include "util/string_parser.hpp" #include "util/types.h" +#include "vec/columns/column_complex.h" #include "vec/runtime/vdatetime_value.h" namespace doris { diff --git a/be/src/exprs/agg_fn_evaluator.cpp b/be/src/exprs/agg_fn_evaluator.cpp index 88bf4037aa..63ebbd3cd0 100644 --- a/be/src/exprs/agg_fn_evaluator.cpp +++ b/be/src/exprs/agg_fn_evaluator.cpp @@ -29,6 +29,8 @@ #include "exprs/agg_fn_evaluator.h" +#include + #include #include "common/logging.h" @@ -38,7 +40,6 @@ #include "runtime/mem_tracker.h" #include "runtime/raw_value.h" #include "runtime/user_function_cache.h" -#include "thrift/protocol/TDebugProtocol.h" #include "udf/udf_internal.h" #include "util/debug_util.h" diff --git a/be/src/exprs/anyval_util.cpp b/be/src/exprs/anyval_util.cpp index 778af4a51c..f22d857360 100644 --- a/be/src/exprs/anyval_util.cpp +++ b/be/src/exprs/anyval_util.cpp @@ -20,6 +20,7 @@ #include "exprs/anyval_util.h" +#include "common/object_pool.h" #include "runtime/mem_pool.h" #include "runtime/mem_tracker.h" diff --git a/be/src/exprs/cast_functions.cpp b/be/src/exprs/cast_functions.cpp index 5042307621..3584775ed5 100644 --- a/be/src/exprs/cast_functions.cpp +++ b/be/src/exprs/cast_functions.cpp @@ -27,8 +27,7 @@ #include "exprs/anyval_util.h" #include "gutil/strings/numbers.h" #include "runtime/datetime_value.h" -#include "runtime/string_value.h" -#include "string_functions.h" +#include "runtime/large_int_value.h" #include "util/array_parser.h" #include "util/mysql_global.h" #include "util/string_parser.hpp" diff --git a/be/src/exprs/expr.cpp b/be/src/exprs/expr.cpp index cda5bdec88..4325e5cecb 100644 --- a/be/src/exprs/expr.cpp +++ b/be/src/exprs/expr.cpp @@ -38,20 +38,16 @@ #include "exprs/expr_context.h" #include "exprs/in_predicate.h" #include "exprs/info_func.h" -#include "exprs/is_null_predicate.h" #include "exprs/literal.h" #include "exprs/null_literal.h" #include "exprs/rpc_fn_call.h" #include "exprs/scalar_fn_call.h" #include "exprs/slot_ref.h" #include "exprs/tuple_is_null_predicate.h" -#include "gen_cpp/Data_types.h" #include "gen_cpp/Exprs_types.h" -#include "gen_cpp/PaloService_types.h" -#include "runtime/raw_value.h" +#include "runtime/primitive_type.h" #include "runtime/runtime_state.h" #include "runtime/user_function_cache.h" -#include "util/debug_util.h" using std::vector; namespace doris { diff --git a/be/src/exprs/hll_function.cpp b/be/src/exprs/hll_function.cpp index f363bd878a..6fb45ec0ec 100644 --- a/be/src/exprs/hll_function.cpp +++ b/be/src/exprs/hll_function.cpp @@ -18,6 +18,7 @@ #include "exprs/hll_function.h" #include "exprs/anyval_util.h" +#include "olap/hll.h" #include "util/hash_util.hpp" #include "util/slice.h" diff --git a/be/src/exprs/literal.cpp b/be/src/exprs/literal.cpp index 64401b7fe2..94b9a97f0c 100644 --- a/be/src/exprs/literal.cpp +++ b/be/src/exprs/literal.cpp @@ -24,6 +24,7 @@ #include "gen_cpp/Exprs_types.h" #include "runtime/collection_value.h" +#include "runtime/large_int_value.h" #include "runtime/runtime_state.h" #include "util/string_parser.hpp" diff --git a/be/src/exprs/math_functions.cpp b/be/src/exprs/math_functions.cpp index fa8951d058..cfda429db1 100644 --- a/be/src/exprs/math_functions.cpp +++ b/be/src/exprs/math_functions.cpp @@ -30,6 +30,7 @@ #include "common/compiler_util.h" #include "exprs/anyval_util.h" #include "runtime/decimalv2_value.h" +#include "runtime/large_int_value.h" #include "util/simd/vstring_function.h" #include "util/string_parser.hpp" diff --git a/be/src/exprs/runtime_filter.cpp b/be/src/exprs/runtime_filter.cpp index f32b1aa1b7..0fc0bbd14f 100644 --- a/be/src/exprs/runtime_filter.cpp +++ b/be/src/exprs/runtime_filter.cpp @@ -21,7 +21,6 @@ #include "common/object_pool.h" #include "common/status.h" -#include "exec/hash_join_node.h" #include "exprs/binary_predicate.h" #include "exprs/bloomfilter_predicate.h" #include "exprs/create_predicate_function.h" @@ -31,15 +30,11 @@ #include "exprs/in_predicate.h" #include "exprs/literal.h" #include "exprs/minmax_predicate.h" -#include "exprs/predicate.h" #include "gen_cpp/internal_service.pb.h" -#include "gen_cpp/types.pb.h" +#include "runtime/large_int_value.h" #include "runtime/primitive_type.h" #include "runtime/runtime_filter_mgr.h" #include "runtime/runtime_state.h" -#include "runtime/type_limit.h" -#include "udf/udf.h" -#include "util/defer_op.h" #include "util/runtime_profile.h" #include "util/string_parser.hpp" diff --git a/be/src/olap/hll.h b/be/src/olap/hll.h index 02368d6f67..81c17be252 100644 --- a/be/src/olap/hll.h +++ b/be/src/olap/hll.h @@ -35,17 +35,17 @@ namespace doris { struct Slice; -const static int HLL_COLUMN_PRECISION = 14; -const static int HLL_ZERO_COUNT_BITS = (64 - HLL_COLUMN_PRECISION); -const static int HLL_EXPLICIT_INT64_NUM = 160; -const static int HLL_SPARSE_THRESHOLD = 4096; -const static int HLL_REGISTERS_COUNT = 16 * 1024; +inline const int HLL_COLUMN_PRECISION = 14; +inline const int HLL_ZERO_COUNT_BITS = (64 - HLL_COLUMN_PRECISION); +inline const int HLL_EXPLICIT_INT64_NUM = 160; +inline const int HLL_SPARSE_THRESHOLD = 4096; +inline const int HLL_REGISTERS_COUNT = 16 * 1024; // maximum size in byte of serialized HLL: type(1) + registers (2^14) -const static int HLL_COLUMN_DEFAULT_LEN = HLL_REGISTERS_COUNT + 1; +inline const int HLL_COLUMN_DEFAULT_LEN = HLL_REGISTERS_COUNT + 1; // 1 for type; 1 for hash values count; 8 for hash value -const static int HLL_SINGLE_VALUE_SIZE = 10; -const static int HLL_EMPTY_SIZE = 1; +inline const int HLL_SINGLE_VALUE_SIZE = 10; +inline const int HLL_EMPTY_SIZE = 1; // Hyperloglog distinct estimate algorithm. // See these papers for more details. diff --git a/be/src/olap/in_list_predicate.h b/be/src/olap/in_list_predicate.h index 20231f724a..cf2f4b2cdc 100644 --- a/be/src/olap/in_list_predicate.h +++ b/be/src/olap/in_list_predicate.h @@ -24,8 +24,8 @@ #include "decimal12.h" #include "olap/column_predicate.h" +#include "runtime/string_value.h" #include "uint24.h" -#include "util/murmur_hash3.h" namespace std { // for string value @@ -105,4 +105,4 @@ class VectorizedRowBatch; IN_LIST_PRED_CLASS_DEFINE(InListPredicate, IN_LIST) IN_LIST_PRED_CLASS_DEFINE(NotInListPredicate, NOT_IN_LIST) -} //namespace doris \ No newline at end of file +} //namespace doris diff --git a/be/src/olap/rowset/column_reader.h b/be/src/olap/rowset/column_reader.h index a14bf8e472..b1533f373f 100644 --- a/be/src/olap/rowset/column_reader.h +++ b/be/src/olap/rowset/column_reader.h @@ -18,15 +18,12 @@ #ifndef DORIS_BE_SRC_OLAP_ROWSET_COLUMN_READER_H #define DORIS_BE_SRC_OLAP_ROWSET_COLUMN_READER_H -#include "olap/byte_buffer.h" -#include "olap/field.h" #include "olap/file_stream.h" #include "olap/olap_common.h" -#include "olap/olap_define.h" -#include "olap/row_cursor.h" #include "olap/rowset/run_length_byte_reader.h" #include "olap/rowset/run_length_integer_reader.h" #include "olap/stream_name.h" +#include "runtime/large_int_value.h" #include "runtime/vectorized_row_batch.h" #include "util/date_func.h" diff --git a/be/src/olap/snapshot_manager.cpp b/be/src/olap/snapshot_manager.cpp index a283700bc3..b2d8a33d75 100644 --- a/be/src/olap/snapshot_manager.cpp +++ b/be/src/olap/snapshot_manager.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -32,7 +33,6 @@ #include "olap/rowset/alpha_rowset_meta.h" #include "olap/rowset/rowset.h" #include "olap/rowset/rowset_factory.h" -#include "olap/rowset/rowset_id_generator.h" #include "olap/rowset/rowset_writer.h" #include "olap/storage_engine.h" #include "runtime/thread_context.h" diff --git a/be/src/olap/task/engine_batch_load_task.cpp b/be/src/olap/task/engine_batch_load_task.cpp index eddd8c8b9b..9c507d362d 100644 --- a/be/src/olap/task/engine_batch_load_task.cpp +++ b/be/src/olap/task/engine_batch_load_task.cpp @@ -18,6 +18,7 @@ #include "olap/task/engine_batch_load_task.h" #include +#include #include #include @@ -26,7 +27,6 @@ #include #include -#include "agent/cgroups_mgr.h" #include "boost/lexical_cast.hpp" #include "gen_cpp/AgentService_types.h" #include "http/http_client.h" diff --git a/be/src/olap/types.h b/be/src/olap/types.h index 9c31c44405..666a5895b7 100644 --- a/be/src/olap/types.h +++ b/be/src/olap/types.h @@ -29,7 +29,9 @@ #include "olap/olap_common.h" #include "olap/olap_define.h" #include "runtime/collection_value.h" +#include "runtime/mem_pool.h" #include "util/mem_util.hpp" +#include "util/mysql_global.h" #include "util/slice.h" #include "util/string_parser.hpp" #include "util/types.h" diff --git a/be/src/runtime/buffered_tuple_stream2.cc b/be/src/runtime/buffered_tuple_stream2.cc index 22cf3ec20b..1528f8de66 100644 --- a/be/src/runtime/buffered_tuple_stream2.cc +++ b/be/src/runtime/buffered_tuple_stream2.cc @@ -22,9 +22,9 @@ #include "runtime/descriptors.h" #include "runtime/row_batch.h" +#include "runtime/string_value.h" #include "runtime/tuple_row.h" #include "util/bit_util.h" -#include "util/debug_util.h" #include "util/pretty_printer.h" using std::stringstream; diff --git a/be/src/runtime/collection_value.cpp b/be/src/runtime/collection_value.cpp index 138b33c0c9..9ea8fc3d43 100644 --- a/be/src/runtime/collection_value.cpp +++ b/be/src/runtime/collection_value.cpp @@ -17,8 +17,13 @@ #include "runtime/collection_value.h" +#include + +#include "common/object_pool.h" #include "common/utils.h" +#include "runtime/mem_pool.h" #include "runtime/raw_value.h" +#include "runtime/string_value.h" #include "runtime/types.h" #include "util/mem_util.hpp" diff --git a/be/src/runtime/collection_value.h b/be/src/runtime/collection_value.h index c3c71f2c49..ccf623171f 100644 --- a/be/src/runtime/collection_value.h +++ b/be/src/runtime/collection_value.h @@ -19,22 +19,27 @@ #include -#include "common/object_pool.h" -#include "common/status.h" -#include "runtime/mem_pool.h" #include "runtime/primitive_type.h" -#include "udf/udf.h" + +namespace doris_udf { +class FunctionContext; +struct AnyVal; +} // namespace doris_udf namespace doris { +using doris_udf::FunctionContext; using doris_udf::AnyVal; using MemFootprint = std::pair; using GenMemFootprintFunc = std::function; -struct TypeDescriptor; struct ArrayIteratorFunctionsBase; class ArrayIterator; +class Status; +class ObjectPool; +class MemPool; +struct TypeDescriptor; template struct ArrayIteratorFunctions; diff --git a/be/src/runtime/decimalv2_value.h b/be/src/runtime/decimalv2_value.h index 8254054326..f8191eeee6 100644 --- a/be/src/runtime/decimalv2_value.h +++ b/be/src/runtime/decimalv2_value.h @@ -26,10 +26,8 @@ #include #include -#include "common/logging.h" #include "udf/udf.h" #include "util/hash_util.hpp" -#include "util/mysql_global.h" namespace doris { diff --git a/be/src/runtime/export_sink.cpp b/be/src/runtime/export_sink.cpp index 637a24d1a6..8b60d0f5f9 100644 --- a/be/src/runtime/export_sink.cpp +++ b/be/src/runtime/export_sink.cpp @@ -28,9 +28,11 @@ #include "exprs/expr.h" #include "exprs/expr_context.h" #include "gutil/strings/numbers.h" +#include "runtime/large_int_value.h" #include "runtime/row_batch.h" #include "runtime/runtime_state.h" #include "runtime/tuple_row.h" +#include "util/mysql_global.h" #include "util/runtime_profile.h" #include "util/types.h" #include "util/uid_util.h" diff --git a/be/src/runtime/file_result_writer.cpp b/be/src/runtime/file_result_writer.cpp index 2997a269e6..f2351476a3 100644 --- a/be/src/runtime/file_result_writer.cpp +++ b/be/src/runtime/file_result_writer.cpp @@ -25,7 +25,10 @@ #include "exec/s3_writer.h" #include "exprs/expr_context.h" #include "gen_cpp/PaloInternalService_types.h" +#include "gutil/strings/numbers.h" +#include "gutil/strings/substitute.h" #include "runtime/buffer_control_block.h" +#include "runtime/large_int_value.h" #include "runtime/primitive_type.h" #include "runtime/raw_value.h" #include "runtime/row_batch.h" @@ -33,8 +36,8 @@ #include "runtime/string_value.h" #include "runtime/tuple_row.h" #include "service/backend_options.h" -#include "util/date_func.h" #include "util/file_utils.h" +#include "util/mysql_global.h" #include "util/mysql_row_buffer.h" #include "util/types.h" #include "util/uid_util.h" diff --git a/be/src/runtime/fold_constant_executor.cpp b/be/src/runtime/fold_constant_executor.cpp index a10a0c5f8c..b9dffe0acb 100644 --- a/be/src/runtime/fold_constant_executor.cpp +++ b/be/src/runtime/fold_constant_executor.cpp @@ -26,10 +26,12 @@ #include "gen_cpp/PaloInternalService_types.h" #include "gen_cpp/internal_service.pb.h" #include "runtime/exec_env.h" +#include "runtime/large_int_value.h" #include "runtime/mem_tracker.h" #include "runtime/runtime_state.h" #include "runtime/thread_context.h" #include "runtime/tuple_row.h" +#include "vec/data_types/data_type_number.h" #include "vec/exprs/vexpr.h" #include "vec/exprs/vexpr_context.h" diff --git a/be/src/runtime/large_int_value.h b/be/src/runtime/large_int_value.h index d7344aa917..cd9fb0de53 100644 --- a/be/src/runtime/large_int_value.h +++ b/be/src/runtime/large_int_value.h @@ -26,13 +26,10 @@ #include #include -#include "udf/udf.h" -#include "util/hash_util.hpp" - namespace doris { -const __int128 MAX_INT128 = ~((__int128)0x01 << 127); -const __int128 MIN_INT128 = ((__int128)0x01 << 127); +inline const __int128 MAX_INT128 = ~((__int128)0x01 << 127); +inline const __int128 MIN_INT128 = ((__int128)0x01 << 127); class LargeIntValue { public: diff --git a/be/src/runtime/primitive_type.cpp b/be/src/runtime/primitive_type.cpp index 1fb4d96b78..4060e4ab63 100644 --- a/be/src/runtime/primitive_type.cpp +++ b/be/src/runtime/primitive_type.cpp @@ -21,8 +21,212 @@ #include "gen_cpp/Types_types.h" #include "runtime/collection_value.h" +#include "runtime/string_value.h" namespace doris { + +PrimitiveType convert_type_to_primitive(FunctionContext::Type type) { + switch (type) { + case FunctionContext::Type::INVALID_TYPE: + return PrimitiveType::INVALID_TYPE; + case FunctionContext::Type::TYPE_DOUBLE: + return PrimitiveType::TYPE_DOUBLE; + case FunctionContext::Type::TYPE_NULL: + return PrimitiveType::TYPE_NULL; + case FunctionContext::Type::TYPE_CHAR: + return PrimitiveType::TYPE_CHAR; + case FunctionContext::Type::TYPE_VARCHAR: + return PrimitiveType::TYPE_VARCHAR; + case FunctionContext::Type::TYPE_STRING: + return PrimitiveType::TYPE_STRING; + case FunctionContext::Type::TYPE_DATETIME: + return PrimitiveType::TYPE_DATETIME; + case FunctionContext::Type::TYPE_DECIMALV2: + return PrimitiveType::TYPE_DECIMALV2; + case FunctionContext::Type::TYPE_BOOLEAN: + return PrimitiveType::TYPE_BOOLEAN; + case FunctionContext::Type::TYPE_ARRAY: + return PrimitiveType::TYPE_ARRAY; + case FunctionContext::Type::TYPE_OBJECT: + return PrimitiveType::TYPE_OBJECT; + case FunctionContext::Type::TYPE_HLL: + return PrimitiveType::TYPE_HLL; + case FunctionContext::Type::TYPE_QUANTILE_STATE: + return PrimitiveType::TYPE_QUANTILE_STATE; + case FunctionContext::Type::TYPE_TINYINT: + return PrimitiveType::TYPE_TINYINT; + case FunctionContext::Type::TYPE_SMALLINT: + return PrimitiveType::TYPE_SMALLINT; + case FunctionContext::Type::TYPE_INT: + return PrimitiveType::TYPE_INT; + case FunctionContext::Type::TYPE_BIGINT: + return PrimitiveType::TYPE_BIGINT; + case FunctionContext::Type::TYPE_LARGEINT: + return PrimitiveType::TYPE_LARGEINT; + case FunctionContext::Type::TYPE_DATE: + return PrimitiveType::TYPE_DATE; + default: + DCHECK(false); + } + + return PrimitiveType::INVALID_TYPE; +} + +bool is_enumeration_type(PrimitiveType type) { + switch (type) { + case TYPE_FLOAT: + case TYPE_DOUBLE: + case TYPE_NULL: + case TYPE_CHAR: + case TYPE_VARCHAR: + case TYPE_STRING: + case TYPE_DATETIME: + case TYPE_DECIMALV2: + case TYPE_BOOLEAN: + case TYPE_ARRAY: + case TYPE_HLL: + return false; + case TYPE_TINYINT: + case TYPE_SMALLINT: + case TYPE_INT: + case TYPE_BIGINT: + case TYPE_LARGEINT: + case TYPE_DATE: + return true; + + case INVALID_TYPE: + default: + DCHECK(false); + } + + return false; +} + +bool is_date_type(PrimitiveType type) { + return type == TYPE_DATETIME || type == TYPE_DATE; +} + +bool is_string_type(PrimitiveType type) { + return type == TYPE_CHAR || type == TYPE_VARCHAR || type == TYPE_STRING; +} + +bool has_variable_type(PrimitiveType type) { + return type == TYPE_CHAR || type == TYPE_VARCHAR || type == TYPE_OBJECT || + type == TYPE_QUANTILE_STATE || type == TYPE_STRING; +} + +// Returns the byte size of 'type' Returns 0 for variable length types. +int get_byte_size(PrimitiveType type) { + switch (type) { + case TYPE_VARCHAR: + case TYPE_STRING: + case TYPE_OBJECT: + case TYPE_HLL: + case TYPE_QUANTILE_STATE: + case TYPE_ARRAY: + case TYPE_MAP: + return 0; + + case TYPE_NULL: + case TYPE_BOOLEAN: + case TYPE_TINYINT: + return 1; + + case TYPE_SMALLINT: + return 2; + + case TYPE_INT: + case TYPE_FLOAT: + return 4; + + case TYPE_BIGINT: + case TYPE_DOUBLE: + case TYPE_TIME: + return 8; + + case TYPE_DATETIME: + case TYPE_DATE: + case TYPE_LARGEINT: + case TYPE_DECIMALV2: + return 16; + + case INVALID_TYPE: + default: + DCHECK(false); + } + + return 0; +} + +int get_real_byte_size(PrimitiveType type) { + switch (type) { + case TYPE_OBJECT: + case TYPE_QUANTILE_STATE: + case TYPE_HLL: + case TYPE_VARCHAR: + case TYPE_STRING: + case TYPE_ARRAY: + return 0; + + case TYPE_NULL: + case TYPE_BOOLEAN: + case TYPE_TINYINT: + return 1; + + case TYPE_SMALLINT: + return 2; + + case TYPE_INT: + case TYPE_FLOAT: + return 4; + + case TYPE_BIGINT: + case TYPE_TIME: + case TYPE_DOUBLE: + return 8; + + case TYPE_DATETIME: + case TYPE_DATE: + case TYPE_DECIMALV2: + return 16; + + case TYPE_LARGEINT: + return 16; + + case INVALID_TYPE: + default: + DCHECK(false); + } + + return 0; +} + +bool is_type_compatible(PrimitiveType lhs, PrimitiveType rhs) { + if (lhs == TYPE_VARCHAR) { + return rhs == TYPE_CHAR || rhs == TYPE_VARCHAR || rhs == TYPE_HLL || rhs == TYPE_OBJECT || + rhs == TYPE_QUANTILE_STATE || rhs == TYPE_STRING; + } + + if (lhs == TYPE_OBJECT) { + return rhs == TYPE_VARCHAR || rhs == TYPE_OBJECT || rhs == TYPE_STRING; + } + + if (lhs == TYPE_CHAR || lhs == TYPE_HLL) { + return rhs == TYPE_CHAR || rhs == TYPE_VARCHAR || rhs == TYPE_HLL || rhs == TYPE_STRING; + } + + if (lhs == TYPE_STRING) { + return rhs == TYPE_CHAR || rhs == TYPE_VARCHAR || rhs == TYPE_HLL || rhs == TYPE_OBJECT || + rhs == TYPE_STRING; + } + + if (lhs == TYPE_QUANTILE_STATE) { + return rhs == TYPE_VARCHAR || rhs == TYPE_QUANTILE_STATE || rhs == TYPE_STRING; + } + + return lhs == rhs; +} + //to_tcolumn_type_thrift only test TColumnType to_tcolumn_type_thrift(TPrimitiveType::type ttype) { TColumnType t; @@ -355,12 +559,12 @@ TTypeDesc gen_type_desc(const TPrimitiveType::type val, const std::string& name) int get_slot_size(PrimitiveType type) { switch (type) { - case TYPE_OBJECT: - case TYPE_HLL: - case TYPE_QUANTILE_STATE: case TYPE_CHAR: case TYPE_VARCHAR: case TYPE_STRING: + case TYPE_OBJECT: + case TYPE_HLL: + case TYPE_QUANTILE_STATE: return sizeof(StringValue); case TYPE_ARRAY: return sizeof(CollectionValue); @@ -379,6 +583,7 @@ int get_slot_size(PrimitiveType type) { case TYPE_BIGINT: case TYPE_DOUBLE: + case TYPE_TIME: return 8; case TYPE_LARGEINT: @@ -387,7 +592,7 @@ int get_slot_size(PrimitiveType type) { case TYPE_DATE: case TYPE_DATETIME: // This is the size of the slot, the actual size of the data is 12. - return 16; + return sizeof(DateTimeValue); case TYPE_DECIMALV2: return 16; diff --git a/be/src/runtime/primitive_type.h b/be/src/runtime/primitive_type.h index 1c3fd47de8..013df3c6fb 100644 --- a/be/src/runtime/primitive_type.h +++ b/be/src/runtime/primitive_type.h @@ -19,23 +19,20 @@ #include -#include "common/logging.h" -#include "gen_cpp/Opcodes_types.h" -#include "gen_cpp/Types_types.h" -#include "runtime/datetime_value.h" -#include "runtime/decimalv2_value.h" -#include "runtime/large_int_value.h" -#include "runtime/string_value.h" -#include "udf/udf.h" #include "vec/columns/column_decimal.h" -#include "vec/columns/column_string.h" #include "vec/columns/columns_number.h" -#include "vec/common/string_ref.h" #include "vec/core/types.h" -#include "vec/runtime/vdatetime_value.h" namespace doris { +namespace vectorized { +class ColumnString; +} + +class DateTimeValue; +class DecimalV2Value; +struct StringValue; + enum PrimitiveType { INVALID_TYPE = 0, TYPE_NULL, /* 1 */ @@ -67,208 +64,20 @@ enum PrimitiveType { TYPE_QUANTILE_STATE /* 24 */ }; -inline PrimitiveType convert_type_to_primitive(FunctionContext::Type type) { - switch (type) { - case FunctionContext::Type::INVALID_TYPE: - return PrimitiveType::INVALID_TYPE; - case FunctionContext::Type::TYPE_DOUBLE: - return PrimitiveType::TYPE_DOUBLE; - case FunctionContext::Type::TYPE_NULL: - return PrimitiveType::TYPE_NULL; - case FunctionContext::Type::TYPE_CHAR: - return PrimitiveType::TYPE_CHAR; - case FunctionContext::Type::TYPE_VARCHAR: - return PrimitiveType::TYPE_VARCHAR; - case FunctionContext::Type::TYPE_STRING: - return PrimitiveType::TYPE_STRING; - case FunctionContext::Type::TYPE_DATETIME: - return PrimitiveType::TYPE_DATETIME; - case FunctionContext::Type::TYPE_DECIMALV2: - return PrimitiveType::TYPE_DECIMALV2; - case FunctionContext::Type::TYPE_BOOLEAN: - return PrimitiveType::TYPE_BOOLEAN; - case FunctionContext::Type::TYPE_ARRAY: - return PrimitiveType::TYPE_ARRAY; - case FunctionContext::Type::TYPE_OBJECT: - return PrimitiveType::TYPE_OBJECT; - case FunctionContext::Type::TYPE_HLL: - return PrimitiveType::TYPE_HLL; - case FunctionContext::Type::TYPE_QUANTILE_STATE: - return PrimitiveType::TYPE_QUANTILE_STATE; - case FunctionContext::Type::TYPE_TINYINT: - return PrimitiveType::TYPE_TINYINT; - case FunctionContext::Type::TYPE_SMALLINT: - return PrimitiveType::TYPE_SMALLINT; - case FunctionContext::Type::TYPE_INT: - return PrimitiveType::TYPE_INT; - case FunctionContext::Type::TYPE_BIGINT: - return PrimitiveType::TYPE_BIGINT; - case FunctionContext::Type::TYPE_LARGEINT: - return PrimitiveType::TYPE_LARGEINT; - case FunctionContext::Type::TYPE_DATE: - return PrimitiveType::TYPE_DATE; - default: - DCHECK(false); - } +PrimitiveType convert_type_to_primitive(FunctionContext::Type type); - return PrimitiveType::INVALID_TYPE; -} - -inline bool is_enumeration_type(PrimitiveType type) { - switch (type) { - case TYPE_FLOAT: - case TYPE_DOUBLE: - case TYPE_NULL: - case TYPE_CHAR: - case TYPE_VARCHAR: - case TYPE_STRING: - case TYPE_DATETIME: - case TYPE_DECIMALV2: - case TYPE_BOOLEAN: - case TYPE_ARRAY: - case TYPE_HLL: - return false; - case TYPE_TINYINT: - case TYPE_SMALLINT: - case TYPE_INT: - case TYPE_BIGINT: - case TYPE_LARGEINT: - case TYPE_DATE: - return true; - - case INVALID_TYPE: - default: - DCHECK(false); - } - - return false; -} - -inline bool is_date_type(PrimitiveType type) { - return type == TYPE_DATETIME || type == TYPE_DATE; -} - -inline bool is_string_type(PrimitiveType type) { - return type == TYPE_CHAR || type == TYPE_VARCHAR || type == TYPE_STRING; -} - -inline bool has_variable_type(PrimitiveType type) { - return type == TYPE_CHAR || type == TYPE_VARCHAR || type == TYPE_OBJECT || - type == TYPE_QUANTILE_STATE || type == TYPE_STRING; -} +bool is_enumeration_type(PrimitiveType type); +bool is_date_type(PrimitiveType type); +bool is_string_type(PrimitiveType type); +bool has_variable_type(PrimitiveType type); // Returns the byte size of 'type' Returns 0 for variable length types. -inline int get_byte_size(PrimitiveType type) { - switch (type) { - case TYPE_OBJECT: - case TYPE_QUANTILE_STATE: - case TYPE_HLL: - case TYPE_VARCHAR: - case TYPE_STRING: - case TYPE_ARRAY: - return 0; - - case TYPE_NULL: - case TYPE_BOOLEAN: - case TYPE_TINYINT: - return 1; - - case TYPE_SMALLINT: - return 2; - - case TYPE_INT: - case TYPE_FLOAT: - return 4; - - case TYPE_BIGINT: - case TYPE_TIME: - case TYPE_DOUBLE: - return 8; - - case TYPE_DATETIME: - case TYPE_DATE: - case TYPE_LARGEINT: - case TYPE_DECIMALV2: - return 16; - - case INVALID_TYPE: - default: - DCHECK(false); - } - - return 0; -} - -inline int get_real_byte_size(PrimitiveType type) { - switch (type) { - case TYPE_OBJECT: - case TYPE_QUANTILE_STATE: - case TYPE_HLL: - case TYPE_VARCHAR: - case TYPE_STRING: - case TYPE_ARRAY: - return 0; - - case TYPE_NULL: - case TYPE_BOOLEAN: - case TYPE_TINYINT: - return 1; - - case TYPE_SMALLINT: - return 2; - - case TYPE_INT: - case TYPE_FLOAT: - return 4; - - case TYPE_BIGINT: - case TYPE_TIME: - case TYPE_DOUBLE: - return 8; - - case TYPE_DATETIME: - case TYPE_DATE: - case TYPE_DECIMALV2: - return 16; - - case TYPE_LARGEINT: - return 16; - - case INVALID_TYPE: - default: - DCHECK(false); - } - - return 0; -} +int get_byte_size(PrimitiveType type); +int get_real_byte_size(PrimitiveType type); // Returns the byte size of type when in a tuple int get_slot_size(PrimitiveType type); -inline bool is_type_compatible(PrimitiveType lhs, PrimitiveType rhs) { - if (lhs == TYPE_VARCHAR) { - return rhs == TYPE_CHAR || rhs == TYPE_VARCHAR || rhs == TYPE_HLL || rhs == TYPE_OBJECT || - rhs == TYPE_QUANTILE_STATE || rhs == TYPE_STRING; - } - - if (lhs == TYPE_OBJECT) { - return rhs == TYPE_VARCHAR || rhs == TYPE_OBJECT || rhs == TYPE_STRING; - } - - if (lhs == TYPE_CHAR || lhs == TYPE_HLL) { - return rhs == TYPE_CHAR || rhs == TYPE_VARCHAR || rhs == TYPE_HLL || rhs == TYPE_STRING; - } - - if (lhs == TYPE_STRING) { - return rhs == TYPE_CHAR || rhs == TYPE_VARCHAR || rhs == TYPE_HLL || rhs == TYPE_OBJECT || - rhs == TYPE_STRING; - } - - if (lhs == TYPE_QUANTILE_STATE) { - return rhs == TYPE_VARCHAR || rhs == TYPE_QUANTILE_STATE || rhs == TYPE_STRING; - } - - return lhs == rhs; -} +bool is_type_compatible(PrimitiveType lhs, PrimitiveType rhs); TExprOpcode::type to_in_opcode(PrimitiveType t); PrimitiveType thrift_to_type(TPrimitiveType::type ttype); @@ -280,7 +89,7 @@ TTypeDesc gen_type_desc(const TPrimitiveType::type val); TTypeDesc gen_type_desc(const TPrimitiveType::type val, const std::string& name); template -struct PrimitiveTypeTraits {}; +struct PrimitiveTypeTraits; template <> struct PrimitiveTypeTraits { diff --git a/be/src/runtime/raw_value.cpp b/be/src/runtime/raw_value.cpp index 3699b9ce0b..ac0a95c0c4 100644 --- a/be/src/runtime/raw_value.cpp +++ b/be/src/runtime/raw_value.cpp @@ -22,9 +22,8 @@ #include -#include "olap/utils.h" #include "runtime/collection_value.h" -#include "runtime/string_value.hpp" +#include "runtime/large_int_value.h" #include "runtime/tuple.h" #include "util/types.h" diff --git a/be/src/runtime/types.cpp b/be/src/runtime/types.cpp index ea5dbc5987..b59d5186d2 100644 --- a/be/src/runtime/types.cpp +++ b/be/src/runtime/types.cpp @@ -195,5 +195,4 @@ std::ostream& operator<<(std::ostream& os, const TypeDescriptor& type) { os << type.debug_string(); return os; } - } // namespace doris diff --git a/be/src/runtime/types.h b/be/src/runtime/types.h index 3382417b9c..b85fdb2dc2 100644 --- a/be/src/runtime/types.h +++ b/be/src/runtime/types.h @@ -24,22 +24,15 @@ #include #include "common/config.h" -#include "gen_cpp/Types_types.h" // for TPrimitiveType -#include "gen_cpp/types.pb.h" // for PTypeDesc -#include "olap/hll.h" -#include "runtime/collection_value.h" #include "runtime/primitive_type.h" -#include "thrift/protocol/TDebugProtocol.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_time.h" -#include "vec/data_types/data_type_decimal.h" -#include "vec/data_types/data_type_number.h" -#include "vec/data_types/data_type_string.h" namespace doris { +extern const int HLL_COLUMN_DEFAULT_LEN; + +struct TPrimitiveType; +class PTypeDesc; + // Describes a type. Includes the enum, children types, and any type-specific metadata // (e.g. precision and scale for decimals). // TODO for 2.3: rename to TypeDescriptor @@ -187,95 +180,9 @@ struct TypeDescriptor { bool is_collection_type() const { return type == TYPE_ARRAY || type == TYPE_MAP; } /// Returns the byte size of this type. Returns 0 for variable length types. - int get_byte_size() const { - switch (type) { - case TYPE_ARRAY: - case TYPE_MAP: - case TYPE_VARCHAR: - case TYPE_HLL: - case TYPE_OBJECT: - case TYPE_QUANTILE_STATE: - case TYPE_STRING: - return 0; + int get_byte_size() const { return ::doris::get_byte_size(type); } - case TYPE_NULL: - case TYPE_BOOLEAN: - case TYPE_TINYINT: - return 1; - - case TYPE_SMALLINT: - return 2; - - case TYPE_INT: - case TYPE_FLOAT: - return 4; - - case TYPE_BIGINT: - case TYPE_DOUBLE: - return 8; - - case TYPE_LARGEINT: - case TYPE_DATETIME: - case TYPE_DATE: - case TYPE_DECIMALV2: - return 16; - - case INVALID_TYPE: - default: - DCHECK(false); - } - return 0; - } - - /// Returns the size of a slot for this type. - int get_slot_size() const { - switch (type) { - case TYPE_CHAR: - case TYPE_VARCHAR: - case TYPE_HLL: - case TYPE_OBJECT: - case TYPE_QUANTILE_STATE: - case TYPE_STRING: - return sizeof(StringValue); - - case TYPE_NULL: - case TYPE_BOOLEAN: - case TYPE_TINYINT: - return 1; - - case TYPE_SMALLINT: - return 2; - - case TYPE_INT: - case TYPE_FLOAT: - return 4; - - case TYPE_BIGINT: - case TYPE_DOUBLE: - case TYPE_TIME: - return 8; - - case TYPE_LARGEINT: - return sizeof(__int128); - - case TYPE_DATE: - case TYPE_DATETIME: - // This is the size of the slot, the actual size of the data is 12. - return sizeof(DateTimeValue); - - case TYPE_DECIMALV2: - return 16; - - case TYPE_ARRAY: - return sizeof(CollectionValue); - - case INVALID_TYPE: - default: - DCHECK(false); - } - // For llvm complain - return -1; - } + int get_slot_size() const { return ::doris::get_slot_size(type); } static inline int get_decimal_byte_size(int precision) { DCHECK_GT(precision, 0); diff --git a/be/src/util/arrow/row_batch.cpp b/be/src/util/arrow/row_batch.cpp index 1ec1bb64f7..fe834289d7 100644 --- a/be/src/util/arrow/row_batch.cpp +++ b/be/src/util/arrow/row_batch.cpp @@ -35,11 +35,11 @@ #include #include -#include "common/logging.h" #include "exprs/slot_ref.h" #include "gutil/strings/substitute.h" #include "runtime/descriptor_helper.h" #include "runtime/descriptors.h" +#include "runtime/large_int_value.h" #include "runtime/row_batch.h" #include "util/arrow/utils.h" #include "util/types.h" diff --git a/be/src/util/cgroup_util.cpp b/be/src/util/cgroup_util.cpp index 9258df1556..91d5c909e7 100644 --- a/be/src/util/cgroup_util.cpp +++ b/be/src/util/cgroup_util.cpp @@ -18,6 +18,7 @@ #include "util/cgroup_util.h" #include +#include #include #include #include diff --git a/be/src/util/string_parser.cpp b/be/src/util/string_parser.cpp index 5f25fc8133..c3a59e47fe 100644 --- a/be/src/util/string_parser.cpp +++ b/be/src/util/string_parser.cpp @@ -20,6 +20,8 @@ #include "string_parser.hpp" +#include "runtime/large_int_value.h" + namespace doris { template <> diff --git a/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.h b/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.h index ed393afff0..e66686d725 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.h +++ b/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.h @@ -23,6 +23,7 @@ #include "vec/aggregate_functions/aggregate_function.h" #include "vec/aggregate_functions/aggregate_function_simple_factory.h" #include "vec/common/string_ref.h" +#include "vec/data_types/data_type_number.h" #include "vec/io/io_helper.h" namespace doris::vectorized { diff --git a/be/src/vec/core/types.h b/be/src/vec/core/types.h index 3f4d4317de..f4ca212d0b 100644 --- a/be/src/vec/core/types.h +++ b/be/src/vec/core/types.h @@ -25,15 +25,16 @@ #include #include -#include "gen_cpp/data.pb.h" -#include "olap/decimal12.h" -#include "olap/hll.h" -#include "olap/uint24.h" -#include "udf/udf.h" #include "util/binary_cast.hpp" -#include "util/bitmap_value.h" -namespace doris::vectorized { +namespace doris { + +class BitmapValue; +class HyperLogLog; +struct decimal12_t; +struct uint24_t; + +namespace vectorized { /// Data types for representing elementary values from a database in RAM. @@ -433,8 +434,8 @@ inline const char* getTypeName(TypeIndex idx) { __builtin_unreachable(); } - -} // namespace doris::vectorized +} // namespace vectorized +} // namespace doris /// Specialization of `std::hash` for the Decimal types. namespace std { diff --git a/be/src/vec/data_types/data_type_number_base.cpp b/be/src/vec/data_types/data_type_number_base.cpp index d8aa5a3985..2acd319ee6 100644 --- a/be/src/vec/data_types/data_type_number_base.cpp +++ b/be/src/vec/data_types/data_type_number_base.cpp @@ -22,13 +22,10 @@ #include -#include "gen_cpp/data.pb.h" #include "gutil/strings/numbers.h" -#include "vec/columns/column_const.h" +#include "util/mysql_global.h" #include "vec/columns/column_vector.h" #include "vec/common/assert_cast.h" -#include "vec/common/nan_utils.h" -#include "vec/common/typeid_cast.h" #include "vec/io/io_helper.h" namespace doris::vectorized { diff --git a/be/src/vec/exec/vaggregation_node.cpp b/be/src/vec/exec/vaggregation_node.cpp index b8f92bd4bf..c9017321b9 100644 --- a/be/src/vec/exec/vaggregation_node.cpp +++ b/be/src/vec/exec/vaggregation_node.cpp @@ -22,13 +22,11 @@ #include "exec/exec_node.h" #include "runtime/mem_pool.h" #include "runtime/row_batch.h" -#include "util/defer_op.h" #include "vec/core/block.h" #include "vec/data_types/data_type_nullable.h" +#include "vec/data_types/data_type_string.h" #include "vec/exprs/vexpr.h" #include "vec/exprs/vexpr_context.h" -#include "vec/exprs/vslot_ref.h" -#include "vec/functions/simple_function_factory.h" #include "vec/utils/util.hpp" namespace doris::vectorized { diff --git a/be/src/vec/exec/vanalytic_eval_node.h b/be/src/vec/exec/vanalytic_eval_node.h index 18845eb85d..ca2e355895 100644 --- a/be/src/vec/exec/vanalytic_eval_node.h +++ b/be/src/vec/exec/vanalytic_eval_node.h @@ -17,10 +17,11 @@ #pragma once +#include + #include "exec/exec_node.h" #include "exprs/expr.h" #include "runtime/tuple.h" -#include "thrift/protocol/TDebugProtocol.h" #include "vec/common/arena.h" #include "vec/core/block.h" #include "vec/exprs/vectorized_agg_fn.h" @@ -144,4 +145,4 @@ private: RuntimeProfile::Counter* _evaluation_timer; }; -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris::vectorized diff --git a/be/src/vec/exec/vjson_scanner.cpp b/be/src/vec/exec/vjson_scanner.cpp index e456e6dfc8..837b3ec289 100644 --- a/be/src/vec/exec/vjson_scanner.cpp +++ b/be/src/vec/exec/vjson_scanner.cpp @@ -21,18 +21,10 @@ #include -#include "env/env.h" -#include "exec/broker_reader.h" -#include "exec/buffered_reader.h" -#include "exec/local_file_reader.h" -#include "exec/plain_text_line_reader.h" -#include "exec/s3_reader.h" -#include "exprs/expr.h" +#include "exec/line_reader.h" #include "exprs/json_functions.h" -#include "gutil/strings/split.h" -#include "runtime/exec_env.h" #include "runtime/runtime_state.h" -#include "util/time.h" +#include "vec/data_types/data_type_string.h" namespace doris::vectorized { diff --git a/be/src/vec/exec/vunion_node.cpp b/be/src/vec/exec/vunion_node.cpp index f1c3002218..4484a2973f 100644 --- a/be/src/vec/exec/vunion_node.cpp +++ b/be/src/vec/exec/vunion_node.cpp @@ -21,6 +21,7 @@ #include "runtime/runtime_state.h" #include "util/runtime_profile.h" #include "vec/core/block.h" +#include "vec/data_types/data_type_number.h" #include "vec/exprs/vexpr.h" #include "vec/exprs/vexpr_context.h" #include "vec/utils/util.hpp" diff --git a/be/src/vec/exprs/vexpr.cpp b/be/src/vec/exprs/vexpr.cpp index 1c71c5b2a4..097a448e50 100644 --- a/be/src/vec/exprs/vexpr.cpp +++ b/be/src/vec/exprs/vexpr.cpp @@ -18,6 +18,7 @@ #include "vec/exprs/vexpr.h" #include +#include #include diff --git a/be/src/vec/exprs/vliteral.cpp b/be/src/vec/exprs/vliteral.cpp index c856c769dc..0eb6b552a8 100644 --- a/be/src/vec/exprs/vliteral.cpp +++ b/be/src/vec/exprs/vliteral.cpp @@ -19,11 +19,14 @@ #include +#include "runtime/large_int_value.h" #include "util/string_parser.hpp" #include "vec/core/field.h" -#include "vec/data_types/data_type_nullable.h" #include "vec/runtime/vdatetime_value.h" -namespace doris::vectorized { + +namespace doris { + +namespace vectorized { void VLiteral::init(const TExprNode& node) { Field field; @@ -132,4 +135,5 @@ Status VLiteral::execute(VExprContext* context, vectorized::Block* block, int* r *result_column_id = res; return Status::OK(); } -} // namespace doris::vectorized +} // namespace vectorized +} // namespace doris diff --git a/be/src/vec/functions/array/function_array_index.h b/be/src/vec/functions/array/function_array_index.h index dd46373ce5..046846424f 100644 --- a/be/src/vec/functions/array/function_array_index.h +++ b/be/src/vec/functions/array/function_array_index.h @@ -22,8 +22,8 @@ #include #include "vec/columns/column_array.h" -#include "vec/columns/column_const.h" #include "vec/columns/column_string.h" +#include "vec/data_types/data_type_array.h" #include "vec/data_types/data_type_number.h" #include "vec/functions/function.h" diff --git a/be/src/vec/functions/function_binary_arithmetic.h b/be/src/vec/functions/function_binary_arithmetic.h index ad3ad38bdf..b3bb43a803 100644 --- a/be/src/vec/functions/function_binary_arithmetic.h +++ b/be/src/vec/functions/function_binary_arithmetic.h @@ -20,13 +20,15 @@ #pragma once -#include "runtime/tuple.h" #include "vec/columns/column_const.h" #include "vec/columns/column_decimal.h" #include "vec/columns/column_nullable.h" #include "vec/columns/column_vector.h" +#include "vec/common/arithmetic_overflow.h" #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" #include "vec/data_types/number_traits.h" #include "vec/functions/cast_type_to_either.h" #include "vec/functions/function.h" diff --git a/be/src/vec/functions/function_bitmap_min_or_max.h b/be/src/vec/functions/function_bitmap_min_or_max.h index 10ab59b105..3675d5db59 100644 --- a/be/src/vec/functions/function_bitmap_min_or_max.h +++ b/be/src/vec/functions/function_bitmap_min_or_max.h @@ -18,7 +18,8 @@ #pragma once #include "util/bitmap_value.h" -#include "vec/functions/simple_function_factory.h" +#include "vec/columns/column_complex.h" +#include "vec/data_types/data_type_number.h" #include "vec/utils/util.hpp" namespace doris::vectorized { diff --git a/be/src/vec/functions/function_coalesce.cpp b/be/src/vec/functions/function_coalesce.cpp index c2c602c264..8ed7bf51f7 100644 --- a/be/src/vec/functions/function_coalesce.cpp +++ b/be/src/vec/functions/function_coalesce.cpp @@ -16,10 +16,9 @@ // under the License. #include "udf/udf.h" -#include "vec/data_types/get_least_supertype.h" +#include "vec/data_types/data_type_number.h" #include "vec/functions/simple_function_factory.h" #include "vec/utils/template_helpers.hpp" -#include "vec/utils/util.hpp" namespace doris::vectorized { class FunctionCoalesce : public IFunction { diff --git a/be/src/vec/functions/function_convert_tz.cpp b/be/src/vec/functions/function_convert_tz.cpp index 56461db12e..7dc2c1762c 100644 --- a/be/src/vec/functions/function_convert_tz.cpp +++ b/be/src/vec/functions/function_convert_tz.cpp @@ -17,6 +17,8 @@ #include "vec/functions/function_convert_tz.h" +#include "vec/functions/simple_function_factory.h" + namespace doris::vectorized { void register_function_convert_tz(SimpleFunctionFactory& factory) { diff --git a/be/src/vec/functions/function_convert_tz.h b/be/src/vec/functions/function_convert_tz.h index f96031c58b..6a9549188d 100644 --- a/be/src/vec/functions/function_convert_tz.h +++ b/be/src/vec/functions/function_convert_tz.h @@ -20,7 +20,7 @@ #include "vec/columns/columns_number.h" #include "vec/common/string_ref.h" #include "vec/core/types.h" -#include "vec/functions/simple_function_factory.h" +#include "vec/data_types/data_type_date_time.h" #include "vec/utils/util.hpp" namespace doris::vectorized { diff --git a/be/src/vec/functions/function_grouping.cpp b/be/src/vec/functions/function_grouping.cpp index 07872ee5ca..aa885aa596 100644 --- a/be/src/vec/functions/function_grouping.cpp +++ b/be/src/vec/functions/function_grouping.cpp @@ -17,6 +17,8 @@ #include "vec/functions/function_grouping.h" +#include "vec/functions/simple_function_factory.h" + namespace doris::vectorized { void register_function_grouping(SimpleFunctionFactory& factory) { factory.register_function(); diff --git a/be/src/vec/functions/function_grouping.h b/be/src/vec/functions/function_grouping.h index 01cfe497a6..17aa1fdfe6 100644 --- a/be/src/vec/functions/function_grouping.h +++ b/be/src/vec/functions/function_grouping.h @@ -17,11 +17,8 @@ #pragma once -#include "vec/columns/column_nullable.h" -#include "vec/data_types/get_least_supertype.h" -#include "vec/functions/function_helpers.h" -#include "vec/functions/simple_function_factory.h" -#include "vec/utils/util.hpp" +#include "vec/data_types/data_type_number.h" +#include "vec/functions/function.h" namespace doris::vectorized { diff --git a/be/src/vec/functions/function_string.h b/be/src/vec/functions/function_string.h index cc540084f3..3027c121d9 100644 --- a/be/src/vec/functions/function_string.h +++ b/be/src/vec/functions/function_string.h @@ -24,10 +24,8 @@ #include #include -#include "exprs/anyval_util.h" #include "exprs/math_functions.h" #include "exprs/string_functions.h" -#include "runtime/string_value.hpp" #include "udf/udf.h" #include "util/md5.h" #include "util/sm3.h" @@ -38,6 +36,7 @@ #include "vec/columns/columns_number.h" #include "vec/common/assert_cast.h" #include "vec/common/string_ref.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" #include "vec/data_types/data_type_string.h" @@ -1329,4 +1328,4 @@ private: } }; -} // namespace doris::vectorized \ No newline at end of file +} // namespace doris::vectorized diff --git a/be/src/vec/olap/olap_data_convertor.cpp b/be/src/vec/olap/olap_data_convertor.cpp index d1910919b5..5da9641fcb 100644 --- a/be/src/vec/olap/olap_data_convertor.cpp +++ b/be/src/vec/olap/olap_data_convertor.cpp @@ -17,8 +17,10 @@ #include "vec/olap/olap_data_convertor.h" +#include "vec/columns/column_array.h" #include "vec/columns/column_complex.h" #include "vec/columns/column_vector.h" +#include "vec/data_types/data_type_array.h" namespace doris::vectorized { diff --git a/be/src/vec/sink/mysql_result_writer.cpp b/be/src/vec/sink/mysql_result_writer.cpp index 7b45c713a2..489b70ed8c 100644 --- a/be/src/vec/sink/mysql_result_writer.cpp +++ b/be/src/vec/sink/mysql_result_writer.cpp @@ -18,11 +18,12 @@ #include "vec/sink/mysql_result_writer.h" #include "runtime/buffer_control_block.h" +#include "runtime/large_int_value.h" #include "runtime/runtime_state.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_array.h" #include "vec/exprs/vexpr.h" #include "vec/exprs/vexpr_context.h" #include "vec/runtime/vdatetime_value.h" diff --git a/be/test/exprs/math_functions_test.cpp b/be/test/exprs/math_functions_test.cpp index 1c8f12a6f5..3cfdc4225a 100644 --- a/be/test/exprs/math_functions_test.cpp +++ b/be/test/exprs/math_functions_test.cpp @@ -22,11 +22,9 @@ #include #include -#include "exprs/anyval_util.h" -#include "exprs/expr_context.h" +#include "runtime/large_int_value.h" #include "testutil/function_utils.h" -#include "testutil/test_util.h" -#include "util/logging.h" +#include "udf/udf_internal.h" namespace doris { diff --git a/be/test/exprs/string_functions_test.cpp b/be/test/exprs/string_functions_test.cpp index ec762d4f45..ef093da06f 100644 --- a/be/test/exprs/string_functions_test.cpp +++ b/be/test/exprs/string_functions_test.cpp @@ -24,9 +24,9 @@ #include #include "exprs/anyval_util.h" +#include "runtime/large_int_value.h" #include "testutil/function_utils.h" #include "testutil/test_util.h" -#include "util/logging.h" #include "util/simd/vstring_function.h" namespace doris { diff --git a/be/test/olap/rowset/segment_v2/column_reader_writer_test.cpp b/be/test/olap/rowset/segment_v2/column_reader_writer_test.cpp index e53f9279f4..126346d663 100644 --- a/be/test/olap/rowset/segment_v2/column_reader_writer_test.cpp +++ b/be/test/olap/rowset/segment_v2/column_reader_writer_test.cpp @@ -19,7 +19,6 @@ #include -#include "common/logging.h" #include "env/env.h" #include "olap/column_block.h" #include "olap/decimal12.h" @@ -34,8 +33,12 @@ #include "testutil/test_util.h" #include "util/file_utils.h" #include "vec/core/types.h" +#include "vec/data_types/data_type_date.h" +#include "vec/data_types/data_type_date_time.h" +#include "vec/data_types/data_type_decimal.h" #include "vec/data_types/data_type_nothing.h" #include "vec/data_types/data_type_number.h" +#include "vec/data_types/data_type_string.h" using std::string; diff --git a/be/test/olap/rowset/segment_v2/frame_of_reference_page_test.cpp b/be/test/olap/rowset/segment_v2/frame_of_reference_page_test.cpp index 725c7093d4..de7fce79ac 100644 --- a/be/test/olap/rowset/segment_v2/frame_of_reference_page_test.cpp +++ b/be/test/olap/rowset/segment_v2/frame_of_reference_page_test.cpp @@ -22,11 +22,9 @@ #include #include "olap/rowset/segment_v2/options.h" -#include "olap/rowset/segment_v2/page_builder.h" -#include "olap/rowset/segment_v2/page_decoder.h" +#include "runtime/large_int_value.h" #include "runtime/mem_pool.h" #include "runtime/mem_tracker.h" -#include "util/logging.h" using doris::segment_v2::PageBuilderOptions; using doris::segment_v2::PageDecoderOptions; @@ -83,7 +81,14 @@ public: for (uint i = 0; i < size; i++) { if (src[i] != values[i]) { - FAIL() << "Fail at index " << i << " inserted=" << src[i] << " got=" << values[i]; + if constexpr (Type == OLAP_FIELD_TYPE_LARGEINT) { + FAIL() << "Fail at index " << i + << " inserted=" << LargeIntValue::to_string(src[i]) + << " got=" << LargeIntValue::to_string(values[i]); + } else { + FAIL() << "Fail at index " << i << " inserted=" << src[i] + << " got=" << values[i]; + } } } diff --git a/be/test/runtime/collection_value_test.cpp b/be/test/runtime/collection_value_test.cpp index 399902e986..ce2fc7adec 100644 --- a/be/test/runtime/collection_value_test.cpp +++ b/be/test/runtime/collection_value_test.cpp @@ -19,6 +19,7 @@ #include +#include "common/object_pool.h" #include "string" #include "util/bitmap.h" diff --git a/be/test/vec/core/block_test.cpp b/be/test/vec/core/block_test.cpp index f9a8a86824..ffc7b4c039 100644 --- a/be/test/vec/core/block_test.cpp +++ b/be/test/vec/core/block_test.cpp @@ -26,15 +26,22 @@ #include "exec/schema_scanner.h" #include "gen_cpp/data.pb.h" #include "runtime/row_batch.h" +#include "runtime/string_value.h" #include "runtime/tuple_row.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/exception.h" #include "vec/data_types/data_type.h" +#include "vec/data_types/data_type_bitmap.h" +#include "vec/data_types/data_type_date.h" +#include "vec/data_types/data_type_date_time.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" +#include "vec/data_types/data_type_string.h" #include "vec/runtime/vdatetime_value.h" + namespace doris { using vectorized::Int32; diff --git a/be/test/vec/exprs/vexpr_test.cpp b/be/test/vec/exprs/vexpr_test.cpp index c2f882ccfd..d8e8a6d635 100644 --- a/be/test/vec/exprs/vexpr_test.cpp +++ b/be/test/vec/exprs/vexpr_test.cpp @@ -17,17 +17,17 @@ #include "vec/exprs/vexpr.h" +#include #include #include #include #include "exec/schema_scanner.h" -#include "gen_cpp/Data_types.h" #include "gen_cpp/Exprs_types.h" #include "gen_cpp/Types_types.h" -#include "gtest/gtest.h" #include "runtime/exec_env.h" +#include "runtime/large_int_value.h" #include "runtime/mem_tracker.h" #include "runtime/memory/chunk_allocator.h" #include "runtime/primitive_type.h" @@ -39,6 +39,7 @@ #include "vec/exprs/vliteral.h" #include "vec/runtime/vdatetime_value.h" #include "vec/utils/util.hpp" + TEST(TEST_VEXPR, ABSTEST) { doris::ChunkAllocator::init_instance(4096); doris::ObjectPool object_pool; diff --git a/be/test/vec/function/function_array_element_test.cpp b/be/test/vec/function/function_array_element_test.cpp index 1c1be231f6..16c0369718 100644 --- a/be/test/vec/function/function_array_element_test.cpp +++ b/be/test/vec/function/function_array_element_test.cpp @@ -21,8 +21,6 @@ #include #include "function_test_util.h" -#include "runtime/tuple_row.h" -#include "util/url_coding.h" #include "vec/core/field.h" #include "vec/data_types/data_type_decimal.h" diff --git a/be/test/vec/function/function_comparison_test.cpp b/be/test/vec/function/function_comparison_test.cpp index 889b11595d..0c2e53961d 100644 --- a/be/test/vec/function/function_comparison_test.cpp +++ b/be/test/vec/function/function_comparison_test.cpp @@ -23,6 +23,7 @@ #include "exec/schema_scanner.h" #include "runtime/row_batch.h" #include "runtime/tuple_row.h" +#include "vec/data_types/data_type_number.h" #include "vec/functions/simple_function_factory.h" namespace doris { diff --git a/be/test/vec/function/function_ifnull_test.cpp b/be/test/vec/function/function_ifnull_test.cpp index 0264d79a05..a456dc2e27 100644 --- a/be/test/vec/function/function_ifnull_test.cpp +++ b/be/test/vec/function/function_ifnull_test.cpp @@ -20,10 +20,7 @@ #include -#include "exec/schema_scanner.h" #include "function_test_util.h" -#include "util/url_coding.h" -#include "vec/core/field.h" namespace doris::vectorized { diff --git a/be/test/vec/function/function_math_test.cpp b/be/test/vec/function/function_math_test.cpp index 2a28521ff5..940bbc995e 100644 --- a/be/test/vec/function/function_math_test.cpp +++ b/be/test/vec/function/function_math_test.cpp @@ -24,8 +24,6 @@ #include #include "function_test_util.h" -#include "runtime/tuple_row.h" -#include "vec/functions/simple_function_factory.h" namespace doris::vectorized { diff --git a/be/test/vec/function/function_nullif_test.cpp b/be/test/vec/function/function_nullif_test.cpp index da37f4e54e..ba9cab3677 100644 --- a/be/test/vec/function/function_nullif_test.cpp +++ b/be/test/vec/function/function_nullif_test.cpp @@ -20,10 +20,7 @@ #include -#include "exec/schema_scanner.h" #include "function_test_util.h" -#include "util/url_coding.h" -#include "vec/core/field.h" namespace doris::vectorized { diff --git a/be/test/vec/function/function_string_test.cpp b/be/test/vec/function/function_string_test.cpp index 9a2d350285..1ed92aabe8 100644 --- a/be/test/vec/function/function_string_test.cpp +++ b/be/test/vec/function/function_string_test.cpp @@ -21,10 +21,7 @@ #include #include "function_test_util.h" -#include "runtime/tuple_row.h" #include "util/encryption_util.h" -#include "util/url_coding.h" -#include "vec/core/field.h" #include "vec/core/types.h" #include "vec/data_types/data_type_string.h" diff --git a/be/test/vec/function/function_test_util.cpp b/be/test/vec/function/function_test_util.cpp index 2de0fb67db..9587805b21 100644 --- a/be/test/vec/function/function_test_util.cpp +++ b/be/test/vec/function/function_test_util.cpp @@ -17,6 +17,10 @@ #include "vec/function/function_test_util.h" +#include "vec/data_types/data_type_array.h" +#include "vec/data_types/data_type_bitmap.h" +#include "vec/data_types/data_type_decimal.h" + namespace doris::vectorized { int64_t str_to_date_time(std::string datetime_str, bool data_time) { VecDateTimeValue v; diff --git a/be/test/vec/function/function_test_util.h b/be/test/vec/function/function_test_util.h index 2d8f4605d3..42ba1185b7 100644 --- a/be/test/vec/function/function_test_util.h +++ b/be/test/vec/function/function_test_util.h @@ -22,19 +22,18 @@ #include #include -#include "exec/schema_scanner.h" #include "exprs/table_function/table_function.h" -#include "runtime/row_batch.h" -#include "runtime/tuple_row.h" #include "testutil/function_utils.h" #include "udf/udf.h" #include "udf/udf_internal.h" -#include "util/bitmap_value.h" -#include "vec/columns/column_complex.h" -#include "vec/functions/function_string.h" -#include "vec/functions/function_string_to_string.h" +#include "vec/columns/column.h" +#include "vec/columns/column_const.h" +#include "vec/core/columns_with_type_and_name.h" +#include "vec/data_types/data_type_date_time.h" +#include "vec/data_types/data_type_decimal.h" +#include "vec/data_types/data_type_number.h" +#include "vec/data_types/data_type_string.h" #include "vec/functions/simple_function_factory.h" -#include "vec/runtime/vdatetime_value.h" namespace doris::vectorized { diff --git a/be/test/vec/function/function_time_test.cpp b/be/test/vec/function/function_time_test.cpp index 27c7b424cc..c7c3c98755 100644 --- a/be/test/vec/function/function_time_test.cpp +++ b/be/test/vec/function/function_time_test.cpp @@ -22,11 +22,7 @@ #include #include -#include "exec/schema_scanner.h" #include "function_test_util.h" -#include "runtime/row_batch.h" -#include "runtime/tuple_row.h" -#include "vec/functions/simple_function_factory.h" namespace doris::vectorized { using namespace ut_type; diff --git a/be/test/vec/runtime/vdata_stream_test.cpp b/be/test/vec/runtime/vdata_stream_test.cpp index 2c7d9d5521..c16224f470 100644 --- a/be/test/vec/runtime/vdata_stream_test.cpp +++ b/be/test/vec/runtime/vdata_stream_test.cpp @@ -15,16 +15,18 @@ // specific language governing permissions and limitations // under the License. +#include + #include "common/object_pool.h" #include "gen_cpp/internal_service.pb.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/service.h" -#include "gtest/gtest.h" #include "runtime/exec_env.h" #include "service/brpc.h" #include "testutil/desc_tbl_builder.h" #include "util/proto_util.h" #include "vec/columns/columns_number.h" +#include "vec/data_types/data_type_number.h" #include "vec/runtime/vdata_stream_mgr.h" #include "vec/runtime/vdata_stream_recvr.h" #include "vec/sink/vdata_stream_sender.h"