Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions be/src/exec/olap_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
34 changes: 0 additions & 34 deletions be/src/olap/column_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ ScalarColumnVectorBatch<ScalarType>::ScalarColumnVectorBatch(const TypeInfo* typ
bool is_nullable)
: ColumnVectorBatch(type_info, is_nullable), _data(0) {}

template <class ScalarType>
ScalarColumnVectorBatch<ScalarType>::~ScalarColumnVectorBatch() = default;

template <class ScalarType>
Status ScalarColumnVectorBatch<ScalarType>::resize(size_t new_cap) {
if (capacity() < new_cap) { // before first init, _capacity is 0.
Expand Down Expand Up @@ -222,35 +219,4 @@ void ArrayColumnVectorBatch::prepare_for_read(size_t start_idx, size_t size, boo
}
}

template <class T>
DataBuffer<T>::DataBuffer(size_t new_size) : buf(nullptr), current_size(0), current_capacity(0) {
resize(new_size);
}

template <class T>
DataBuffer<T>::~DataBuffer() {
for (uint64_t i = current_size; i > 0; --i) {
(buf + i - 1)->~T();
}
if (buf) {
std::free(buf);
}
}

template <class T>
void DataBuffer<T>::resize(size_t new_size) {
if (new_size > current_capacity || !buf) {
if (buf) {
T* buf_old = buf;
buf = reinterpret_cast<T*>(std::malloc(sizeof(T) * new_size));
memcpy(buf, buf_old, sizeof(T) * current_size);
std::free(buf_old);
} else {
buf = reinterpret_cast<T*>(std::malloc(sizeof(T) * new_size));
}
current_capacity = new_size;
}
current_size = new_size;
}

} // namespace doris
34 changes: 34 additions & 0 deletions be/src/olap/column_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,37 @@ class DataBuffer {
void resize(size_t _size);
};

template <class T>
DataBuffer<T>::DataBuffer(size_t new_size) : buf(nullptr), current_size(0), current_capacity(0) {
resize(new_size);
}

template <class T>
DataBuffer<T>::~DataBuffer() {
for (uint64_t i = current_size; i > 0; --i) {
(buf + i - 1)->~T();
}
if (buf) {
std::free(buf);
}
}

template <class T>
void DataBuffer<T>::resize(size_t new_size) {
if (new_size > current_capacity || !buf) {
if (buf) {
T* buf_old = buf;
buf = reinterpret_cast<T*>(std::malloc(sizeof(T) * new_size));
memcpy(buf, buf_old, sizeof(T) * current_size);
std::free(buf_old);
} else {
buf = reinterpret_cast<T*>(std::malloc(sizeof(T) * new_size));
}
current_capacity = new_size;
}
current_size = new_size;
}

template class DataBuffer<bool>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"explicit template instantiation" is definition and should be in source file (translation unit), or else in theory it's ODR violation. In practice it doesn't make sense to have them in header files (outline defined) which slows down compilation and leads to problems you're trying to work around.

template class DataBuffer<int8_t>;
template class DataBuffer<int16_t>;
Expand Down Expand Up @@ -161,6 +192,9 @@ class ScalarColumnVectorBatch : public ColumnVectorBatch {
DataBuffer<ScalarCppType> _data;
};

template <class ScalarType>
ScalarColumnVectorBatch<ScalarType>::~ScalarColumnVectorBatch() = default;

// util class for read array's null signs.
class ArrayNullColumnVectorBatch : public ColumnVectorBatch {
public:
Expand Down
2 changes: 1 addition & 1 deletion be/src/olap/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ struct CppTypeTraits<OLAP_FIELD_TYPE_UNSIGNED_BIGINT> {
template <>
struct CppTypeTraits<OLAP_FIELD_TYPE_LARGEINT> {
using CppType = int128_t;
using UnsignedCppType = unsigned int128_t;
using UnsignedCppType = uint128_t;
};
template <>
struct CppTypeTraits<OLAP_FIELD_TYPE_FLOAT> {
Expand Down
9 changes: 5 additions & 4 deletions be/src/runtime/dpp_sink_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down
1 change: 1 addition & 0 deletions be/src/runtime/raw_value_ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// under the License.

#include "runtime/raw_value.h"
#include "runtime/string_value.hpp"
#include "util/types.h"

namespace doris {
Expand Down
4 changes: 0 additions & 4 deletions be/src/util/bitmap_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -1734,10 +1734,6 @@ class BitmapValue {
// }
class BitmapValueIterator {
public:
BitmapValueIterator()
: _bitmap(BitmapValue()) {
}

BitmapValueIterator(const BitmapValue& bitmap, bool end = false)
: _bitmap(bitmap), _end(end) {

Expand Down
15 changes: 15 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,25 @@ set -eo pipefail
ROOT=`dirname "$0"`
ROOT=`cd "$ROOT"; pwd`


export DORIS_HOME=${ROOT}

#export CC="/data/common/clang-11/bin/clang-wrapper"
#export CXX="/data/common/clang-11/bin/clang++-wrapper"

#export CC="/usr/local/gcc-10.1.0/bin/gcc"
#export CXX="/usr/local/gcc-10.1.0/bin/g++"

. ${DORIS_HOME}/env.sh

if [[ -z ${CC} ]]; then
if [[ -z ${DORIS_GCC_HOME} ]]; then
DORIS_GCC_HOME=$(dirname $(which gcc))/..
fi
export CC="${DORIS_GCC_HOME}/bin/gcc"
export CXX="${DORIS_GCC_HOME}/bin/g++"
fi

# Check args
usage() {
echo "
Expand Down
7 changes: 0 additions & 7 deletions contrib/udf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
31 changes: 13 additions & 18 deletions env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,25 @@ if ! ${PYTHON} --version; then
fi
fi

# set GCC HOME
if [[ -z ${DORIS_GCC_HOME} ]]; then
export DORIS_GCC_HOME=$(dirname $(which gcc))/..
fi

gcc_ver=$(${DORIS_GCC_HOME}/bin/gcc -dumpfullversion -dumpversion)
required_ver="7.3.0"
if [[ ! "$(printf '%s\n' "$required_ver" "$gcc_ver" | sort -V | head -n1)" = "$required_ver" ]]; then
echo "Error: GCC version (${gcc_ver}) must be greater than or equal to ${required_ver}"
# register keyword is forbidden to use in C++17
# the C++ code generated by flex that remove register keyword after version 2.6.0
# so we need check flex version here to avoid compilation failed
flex_ver=$(flex --version | awk '{print $2}')
required_ver="2.6.0"
if [[ ! "$(printf '%s\n' "$required_ver" "$flex_ver" | sort -V | head -n1)" = "$required_ver" ]]; then
echo "Error: flex version (${flex_ver}) must be greater than or equal to ${required_ver}"
exit 1
fi

# find binutils
if test -x ${DORIS_GCC_HOME}/bin/ld; then
export DORIS_BIN_UTILS=${DORIS_GCC_HOME}/bin/
# check java home
if [ -z "$JAVA_HOME" ]; then
export JAVACMD=$(which java)
JAVAP=$(which javap)
else
export DORIS_BIN_UTILS=/usr/bin/
export JAVA="${JAVA_HOME}/bin/java"
JAVAP="${JAVA_HOME}/bin/javap"
fi

# export CLANG COMPATIBLE FLAGS
export CLANG_COMPATIBLE_FLAGS=$(echo | ${DORIS_GCC_HOME}/bin/gcc -Wp,-v -xc++ - -fsyntax-only 2>&1 |
grep -E '^\s+/' | awk '{print "-I" $1}' | tr '\n' ' ')


# if is called from build-thirdparty.sh, no need to check these tools
if test -z "${BUILD_THIRDPARTY_WIP}"; then
# register keyword is forbidden to use in C++17
Expand Down
Loading