diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt index 2c3f5b74083b19..19606dedcbd8e7 100644 --- a/be/CMakeLists.txt +++ b/be/CMakeLists.txt @@ -18,13 +18,6 @@ cmake_minimum_required(VERSION 3.19.2) # set CMAKE_C_COMPILER, this must set before project command -if (DEFINED ENV{DORIS_GCC_HOME}) - set(CMAKE_C_COMPILER "$ENV{DORIS_GCC_HOME}/bin/gcc") - set(CMAKE_CXX_COMPILER "$ENV{DORIS_GCC_HOME}/bin/g++") - set(GCC_HOME $ENV{DORIS_GCC_HOME}) -else() - message(FATAL_ERROR "DORIS_GCC_HOME environment variable is not set") -endif() project(doris CXX C) @@ -89,16 +82,6 @@ endif() message(STATUS "make test: ${MAKE_TEST}") option(WITH_MYSQL "Support access MySQL" ON) -# Check gcc -if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "7.3.0") - message(FATAL_ERROR "Need GCC version at least 7.3.0") - endif() - message(STATUS "GCC version is greater than 7.3.0, disable -Werror. Be careful with compile warnings.") -elseif (NOT APPLE) - message(FATAL_ERROR "Compiler should be GNU") -endif() - set(PIC_LIB_PATH "${THIRDPARTY_DIR}") if(PIC_LIB_PATH) message(STATUS "defined PIC_LIB_PATH") diff --git a/be/src/exec/olap_utils.h b/be/src/exec/olap_utils.h index 129bd2c6eb0624..bc43df68cf238c 100644 --- a/be/src/exec/olap_utils.h +++ b/be/src/exec/olap_utils.h @@ -75,6 +75,8 @@ inline CompareLargeFunc get_compare_func(PrimitiveType type) { default: DCHECK(false) << "Unsupported Compare type"; + // Clang will report error if not all path have return value + return nullptr; } } diff --git a/be/src/olap/column_vector.cpp b/be/src/olap/column_vector.cpp index 7e3cf3065bb137..d9cf3176e3d578 100644 --- a/be/src/olap/column_vector.cpp +++ b/be/src/olap/column_vector.cpp @@ -164,9 +164,6 @@ ScalarColumnVectorBatch::ScalarColumnVectorBatch(const TypeInfo* typ bool is_nullable) : ColumnVectorBatch(type_info, is_nullable), _data(0) {} -template -ScalarColumnVectorBatch::~ScalarColumnVectorBatch() = default; - template Status ScalarColumnVectorBatch::resize(size_t new_cap) { if (capacity() < new_cap) { // before first init, _capacity is 0. @@ -222,35 +219,4 @@ void ArrayColumnVectorBatch::prepare_for_read(size_t start_idx, size_t size, boo } } -template -DataBuffer::DataBuffer(size_t new_size) : buf(nullptr), current_size(0), current_capacity(0) { - resize(new_size); -} - -template -DataBuffer::~DataBuffer() { - for (uint64_t i = current_size; i > 0; --i) { - (buf + i - 1)->~T(); - } - if (buf) { - std::free(buf); - } -} - -template -void DataBuffer::resize(size_t new_size) { - if (new_size > current_capacity || !buf) { - if (buf) { - T* buf_old = buf; - buf = reinterpret_cast(std::malloc(sizeof(T) * new_size)); - memcpy(buf, buf_old, sizeof(T) * current_size); - std::free(buf_old); - } else { - buf = reinterpret_cast(std::malloc(sizeof(T) * new_size)); - } - current_capacity = new_size; - } - current_size = new_size; -} - } // namespace doris diff --git a/be/src/olap/column_vector.h b/be/src/olap/column_vector.h index ca5b6e1c4daa4d..4ab97130deb3bb 100644 --- a/be/src/olap/column_vector.h +++ b/be/src/olap/column_vector.h @@ -51,6 +51,37 @@ class DataBuffer { void resize(size_t _size); }; +template +DataBuffer::DataBuffer(size_t new_size) : buf(nullptr), current_size(0), current_capacity(0) { + resize(new_size); +} + +template +DataBuffer::~DataBuffer() { + for (uint64_t i = current_size; i > 0; --i) { + (buf + i - 1)->~T(); + } + if (buf) { + std::free(buf); + } +} + +template +void DataBuffer::resize(size_t new_size) { + if (new_size > current_capacity || !buf) { + if (buf) { + T* buf_old = buf; + buf = reinterpret_cast(std::malloc(sizeof(T) * new_size)); + memcpy(buf, buf_old, sizeof(T) * current_size); + std::free(buf_old); + } else { + buf = reinterpret_cast(std::malloc(sizeof(T) * new_size)); + } + current_capacity = new_size; + } + current_size = new_size; +} + template class DataBuffer; template class DataBuffer; template class DataBuffer; @@ -161,6 +192,9 @@ class ScalarColumnVectorBatch : public ColumnVectorBatch { DataBuffer _data; }; +template +ScalarColumnVectorBatch::~ScalarColumnVectorBatch() = default; + // util class for read array's null signs. class ArrayNullColumnVectorBatch : public ColumnVectorBatch { public: diff --git a/be/src/olap/types.h b/be/src/olap/types.h index 4dddf08d889a36..ec59a92d4bdae6 100644 --- a/be/src/olap/types.h +++ b/be/src/olap/types.h @@ -420,7 +420,7 @@ struct CppTypeTraits { template <> struct CppTypeTraits { using CppType = int128_t; - using UnsignedCppType = unsigned int128_t; + using UnsignedCppType = uint128_t; }; template <> struct CppTypeTraits { diff --git a/be/src/runtime/dpp_sink_internal.cpp b/be/src/runtime/dpp_sink_internal.cpp index ad172020fbbeb7..72cf22ed4ced4c 100644 --- a/be/src/runtime/dpp_sink_internal.cpp +++ b/be/src/runtime/dpp_sink_internal.cpp @@ -31,11 +31,12 @@ namespace doris { PartRangeKey PartRangeKey::_s_pos_infinite(1); PartRangeKey PartRangeKey::_s_neg_infinite(-1); +// Clang will check constructor method not exist PartRange PartRange::_s_all_range = { - ._start_key = PartRangeKey::neg_infinite(), - ._end_key = PartRangeKey::pos_infinite(), - ._include_start_key = true, - ._include_end_key = true, + PartRangeKey::neg_infinite(), + PartRangeKey::pos_infinite(), + true, + true }; RollupSchema::RollupSchema() {} diff --git a/be/src/runtime/raw_value_ir.cpp b/be/src/runtime/raw_value_ir.cpp index 28375759150140..d6fef33f437b02 100644 --- a/be/src/runtime/raw_value_ir.cpp +++ b/be/src/runtime/raw_value_ir.cpp @@ -16,6 +16,7 @@ // under the License. #include "runtime/raw_value.h" +#include "runtime/string_value.hpp" #include "util/types.h" namespace doris { diff --git a/be/src/util/bitmap_value.h b/be/src/util/bitmap_value.h index 7259685c02cd48..25d54d90962f6d 100644 --- a/be/src/util/bitmap_value.h +++ b/be/src/util/bitmap_value.h @@ -1735,10 +1735,6 @@ class BitmapValue { // } class BitmapValueIterator { public: - BitmapValueIterator() - : _bitmap(BitmapValue()) { - } - BitmapValueIterator(const BitmapValue& bitmap, bool end = false) : _bitmap(bitmap), _end(end) { diff --git a/build.sh b/build.sh index 72faec4ff5d590..9f01524e58b399 100755 --- a/build.sh +++ b/build.sh @@ -38,6 +38,7 @@ set -eo pipefail ROOT=`dirname "$0"` ROOT=`cd "$ROOT"; pwd` + export DORIS_HOME=${ROOT} . ${DORIS_HOME}/env.sh @@ -201,6 +202,12 @@ make # Clean and build Backend if [ ${BUILD_BE} -eq 1 ] ; then + # Has to set CC and CXX here + # --gcc-toolchain=/usr/local/gcc-10.1.0 + # Could set use clang here to build BE with clang + #export CC="/data/common/clang-11/bin/clang --gcc-toolchain=${DORIS_GCC_HOME}" + #export CXX="/data/common/clang-11/bin/clang++ --gcc-toolchain=${DORIS_GCC_HOME}" + CMAKE_BUILD_TYPE=${BUILD_TYPE:-Release} echo "Build Backend: ${CMAKE_BUILD_TYPE}" CMAKE_BUILD_DIR=${DORIS_HOME}/be/build_${CMAKE_BUILD_TYPE} diff --git a/contrib/udf/CMakeLists.txt b/contrib/udf/CMakeLists.txt index 30ce621e0435d7..45a41ab4e920d6 100644 --- a/contrib/udf/CMakeLists.txt +++ b/contrib/udf/CMakeLists.txt @@ -18,13 +18,6 @@ cmake_minimum_required(VERSION 3.19.2) # set CMAKE_C_COMPILER, this must set before project command -if (DEFINED ENV{DORIS_GCC_HOME}) - set(CMAKE_C_COMPILER "$ENV{DORIS_GCC_HOME}/bin/gcc") - set(CMAKE_CXX_COMPILER "$ENV{DORIS_GCC_HOME}/bin/g++") - set(GCC_HOME $ENV{DORIS_GCC_HOME}) -else() - message(FATAL_ERROR "DORIS_GCC_HOME environment variable is not set") -endif() project(doris_udf)