Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] fix clang compile error #7883

Merged
merged 1 commit into from
Jan 26, 2022
Merged
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
5 changes: 5 additions & 0 deletions be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ if (COMPILER_GCC)
endif ()

if (COMPILER_CLANG)

if(MAKE_TEST STREQUAL "OFF")
add_compile_options(-Qunused-arguments)
endif()

# TODO: Fix all these warnings
add_compile_options(
-Wno-address-of-packed-member
Expand Down
10 changes: 5 additions & 5 deletions be/src/olap/storage_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,11 @@ void StorageEngine::stop() {
THREAD_JOIN(_tablet_checkpoint_tasks_producer_thread);
#undef THREAD_JOIN

#define THREADS_JOIN(threads) \
for (const auto thread : threads) { \
if (thread) { \
thread->join(); \
} \
#define THREADS_JOIN(threads) \
for (const auto& thread : threads) { \
if (thread) { \
thread->join(); \
} \
}

THREADS_JOIN(_path_gc_threads);
Expand Down
4 changes: 2 additions & 2 deletions be/test/exprs/bitmap_function_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ TEST_F(BitmapFunctionsTest, bitmap_not) {
expected = BigIntVal(0);
ASSERT_EQ(expected, result);

bitmap1 = BitmapValue({1});
bitmap1 = BitmapValue(1);
bitmap2 = BitmapValue({2, 1});

bitmap_src = convert_bitmap_to_string(ctx, bitmap1);
Expand Down Expand Up @@ -1151,7 +1151,7 @@ TEST_F(BitmapFunctionsTest, sub_bitmap) {
ASSERT_EQ(res, convert_bitmap_to_string(ctx, bitmap5));

res = BitmapFunctions::sub_bitmap(ctx, bitmap_src, BigIntVal(-1), BigIntVal(2));
BitmapValue bitmap6({500});
BitmapValue bitmap6(500);
ASSERT_EQ(res, convert_bitmap_to_string(ctx, bitmap6));

res = BitmapFunctions::sub_bitmap(ctx, bitmap_src, BigIntVal(-7), BigIntVal(6));
Expand Down
7 changes: 5 additions & 2 deletions be/test/olap/delta_writer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ TEST_F(TestDeltaWriter, write) {
memcpy(var_ptr->ptr, "abcde", 5);
var_ptr->len = 5;

DecimalV2Value decimal_value(1.1);
DecimalV2Value decimal_value;
decimal_value.assign_from_double(1.1);
*(DecimalV2Value*)(tuple->get_slot(slots[9]->tuple_offset())) = decimal_value;

*(int8_t*)(tuple->get_slot(slots[10]->tuple_offset())) = -127;
Expand All @@ -463,7 +464,9 @@ TEST_F(TestDeltaWriter, write) {
memcpy(var_ptr->ptr, "abcde", 5);
var_ptr->len = 5;

DecimalV2Value val_decimal(1.1);
DecimalV2Value val_decimal;
val_decimal.assign_from_double(1.1);

*(DecimalV2Value*)(tuple->get_slot(slots[19]->tuple_offset())) = val_decimal;

res = delta_writer->write(tuple);
Expand Down
2 changes: 1 addition & 1 deletion be/test/olap/rowset/beta_rowset_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ TEST_F(BetaRowsetTest, BasicFunctionTest) {
} // namespace doris

int main(int argc, char** argv) {
doris::StoragePageCache::create_global_cache(1 << 30, 0.1);
doris::StoragePageCache::create_global_cache(1 << 30, 10);
doris::SegmentLoader::create_global_instance(1000);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
Expand Down
10 changes: 5 additions & 5 deletions be/test/olap/rowset/rowset_converter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@ void RowsetConverterTest::process(RowsetTypePB src_type, RowsetTypePB dst_type)
schema_hash_path_desc.filepath = _schema_hash_path;
if (dst_type == BETA_ROWSET) {
ASSERT_EQ(OLAP_SUCCESS,
rowset_converter.convert_alpha_to_beta(src_rowset->rowset_meta(),
schema_hash_path_desc, &dst_rowset_meta_pb));
rowset_converter.convert_alpha_to_beta(
src_rowset->rowset_meta(), schema_hash_path_desc, &dst_rowset_meta_pb));
} else {
ASSERT_EQ(OLAP_SUCCESS,
rowset_converter.convert_beta_to_alpha(src_rowset->rowset_meta(),
schema_hash_path_desc, &dst_rowset_meta_pb));
rowset_converter.convert_beta_to_alpha(
src_rowset->rowset_meta(), schema_hash_path_desc, &dst_rowset_meta_pb));
}

ASSERT_EQ(dst_type, dst_rowset_meta_pb.rowset_type());
Expand Down Expand Up @@ -299,7 +299,7 @@ TEST_F(RowsetConverterTest, TestConvertBetaRowsetToAlpha) {
} // namespace doris

int main(int argc, char** argv) {
doris::StoragePageCache::create_global_cache(1 << 30, 0.1);
doris::StoragePageCache::create_global_cache(1 << 30, 10);
doris::SegmentLoader::create_global_instance(1000);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
Expand Down
5 changes: 3 additions & 2 deletions be/test/olap/rowset/segment_v2/bitmap_index_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ void write_index_file(std::string& filename, const void* values, size_t value_co
{
std::unique_ptr<fs::WritableBlock> wblock;
fs::CreateBlockOptions opts(filename);
ASSERT_TRUE(fs::fs_util::block_manager(TStorageMedium::HDD)->create_block(opts, &wblock).ok());
ASSERT_TRUE(
fs::fs_util::block_manager(TStorageMedium::HDD)->create_block(opts, &wblock).ok());

std::unique_ptr<BitmapIndexWriter> writer;
BitmapIndexWriter::create(type_info, &writer);
Expand Down Expand Up @@ -239,7 +240,7 @@ TEST_F(BitmapIndexTest, test_null) {
} // namespace doris

int main(int argc, char** argv) {
doris::StoragePageCache::create_global_cache(1 << 30, 0.1);
doris::StoragePageCache::create_global_cache(1 << 30, 10);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ TEST_F(BloomFilterIndexReaderWriterTest, test_decimal) {
} // namespace doris

int main(int argc, char** argv) {
doris::StoragePageCache::create_global_cache(1 << 30, 0.1);
doris::StoragePageCache::create_global_cache(1 << 30, 10);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
6 changes: 3 additions & 3 deletions be/test/olap/rowset/segment_v2/column_reader_writer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
#include "runtime/mem_tracker.h"
#include "test_util/test_util.h"
#include "util/file_utils.h"
#include "vec/data_types/data_type_number.h"
#include "vec/data_types/data_type_nothing.h"
#include "vec/core/types.h"
#include "vec/data_types/data_type_nothing.h"
#include "vec/data_types/data_type_number.h"

using std::string;

Expand Down Expand Up @@ -802,7 +802,7 @@ TEST_F(ColumnReaderWriterTest, test_v_default_value) {
} // namespace doris

int main(int argc, char** argv) {
doris::StoragePageCache::create_global_cache(1 << 30, 0.1);
doris::StoragePageCache::create_global_cache(1 << 30, 10);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
5 changes: 3 additions & 2 deletions be/test/olap/rowset/segment_v2/ordinal_page_index_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ TEST_F(OrdinalPageIndexTest, normal) {
{
std::unique_ptr<fs::WritableBlock> wblock;
fs::CreateBlockOptions opts(filename);
ASSERT_TRUE(fs::fs_util::block_manager(TStorageMedium::HDD)->create_block(opts, &wblock).ok());
ASSERT_TRUE(
fs::fs_util::block_manager(TStorageMedium::HDD)->create_block(opts, &wblock).ok());

ASSERT_TRUE(builder.finish(wblock.get(), &index_meta).ok());
ASSERT_EQ(ORDINAL_INDEX, index_meta.type());
Expand Down Expand Up @@ -160,7 +161,7 @@ TEST_F(OrdinalPageIndexTest, one_data_page) {
} // namespace doris

int main(int argc, char** argv) {
doris::StoragePageCache::create_global_cache(1 << 30, 0.1);
doris::StoragePageCache::create_global_cache(1 << 30, 10);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
2 changes: 1 addition & 1 deletion be/test/olap/rowset/segment_v2/segment_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ TEST_F(SegmentReaderWriterTest, TestBloomFilterIndexUniqueModel) {
} // namespace doris

int main(int argc, char** argv) {
doris::StoragePageCache::create_global_cache(1 << 30, 0.1);
doris::StoragePageCache::create_global_cache(1 << 30, 10);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
15 changes: 10 additions & 5 deletions be/test/olap/rowset/segment_v2/zone_map_index_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
// specific language governing permissions and limitations
// under the License.

#include "common/config.h"
#include "olap/rowset/segment_v2/zone_map_index.h"

#include <gtest/gtest.h>

#include <memory>
#include <string>

#include "common/config.h"
#include "env/env.h"
#include "olap/fs/block_manager.h"
#include "olap/fs/fs_util.h"
Expand Down Expand Up @@ -75,7 +75,9 @@ class ColumnZoneMapTest : public testing::Test {
{
std::unique_ptr<fs::WritableBlock> wblock;
fs::CreateBlockOptions opts(filename);
ASSERT_TRUE(fs::fs_util::block_manager(TStorageMedium::HDD)->create_block(opts, &wblock).ok());
ASSERT_TRUE(fs::fs_util::block_manager(TStorageMedium::HDD)
->create_block(opts, &wblock)
.ok());
ASSERT_TRUE(builder.finish(wblock.get(), &index_meta).ok());
ASSERT_EQ(ZONE_MAP_INDEX, index_meta.type());
ASSERT_TRUE(wblock->close().ok());
Expand Down Expand Up @@ -119,7 +121,9 @@ class ColumnZoneMapTest : public testing::Test {
{
std::unique_ptr<fs::WritableBlock> wblock;
fs::CreateBlockOptions opts(filename);
ASSERT_TRUE(fs::fs_util::block_manager(TStorageMedium::HDD)->create_block(opts, &wblock).ok());
ASSERT_TRUE(fs::fs_util::block_manager(TStorageMedium::HDD)
->create_block(opts, &wblock)
.ok());
ASSERT_TRUE(builder.finish(wblock.get(), &index_meta).ok());
ASSERT_EQ(ZONE_MAP_INDEX, index_meta.type());
ASSERT_TRUE(wblock->close().ok());
Expand Down Expand Up @@ -169,7 +173,8 @@ TEST_F(ColumnZoneMapTest, NormalTestIntPage) {
{
std::unique_ptr<fs::WritableBlock> wblock;
fs::CreateBlockOptions opts({filename});
ASSERT_TRUE(fs::fs_util::block_manager(TStorageMedium::HDD)->create_block(opts, &wblock).ok());
ASSERT_TRUE(
fs::fs_util::block_manager(TStorageMedium::HDD)->create_block(opts, &wblock).ok());
ASSERT_TRUE(builder.finish(wblock.get(), &index_meta).ok());
ASSERT_EQ(ZONE_MAP_INDEX, index_meta.type());
ASSERT_TRUE(wblock->close().ok());
Expand Down Expand Up @@ -226,7 +231,7 @@ TEST_F(ColumnZoneMapTest, ZoneMapCut) {
} // namespace doris

int main(int argc, char** argv) {
doris::StoragePageCache::create_global_cache(1 << 30, 0.1);
doris::StoragePageCache::create_global_cache(1 << 30, 10);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
5 changes: 3 additions & 2 deletions be/test/tools/benchmark_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ class BinaryDictPageBenchmark : public BaseBenchmark {
BinaryDictPageDecoder page_decoder(src.slice(), decoder_options);
page_decoder.init();

page_decoder.set_dict_decoder(dict_page_decoder.get(), dict_start_offset_array, dict_len_array);
page_decoder.set_dict_decoder(dict_page_decoder.get(), dict_start_offset_array,
dict_len_array);

//check values
size_t num = page_start_ids[slice_index + 1] - page_start_ids[slice_index];
Expand Down Expand Up @@ -627,7 +628,7 @@ int main(int argc, char** argv) {
gflags::SetUsageMessage(usage);
google::ParseCommandLineFlags(&argc, &argv, true);

doris::StoragePageCache::create_global_cache(1 << 30, 0.1);
doris::StoragePageCache::create_global_cache(1 << 30, 10);

doris::MultiBenchmark multi_bm;
multi_bm.add_bm();
Expand Down
10 changes: 9 additions & 1 deletion run-be-ut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ else
fi

cd ${CMAKE_BUILD_DIR}
${CMAKE_CMD} -G "${GENERATOR}" ../ -DWITH_MYSQL=OFF -DMAKE_TEST=ON -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
${CMAKE_CMD} -DCMAKE_MAKE_PROGRAM="${BUILD_SYSTEM}" ../ -DWITH_MYSQL=OFF -DMAKE_TEST=ON -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
-DGLIBC_COMPATIBILITY=${GLIBC_COMPATIBILITY} ${CMAKE_USE_CCACHE}
${BUILD_SYSTEM} -j ${PARALLEL} $RUN_FILE

Expand All @@ -153,6 +153,14 @@ mkdir -p $LOG_DIR
mkdir -p ${UDF_RUNTIME_DIR}
rm -f ${UDF_RUNTIME_DIR}/*

# clean all gcda file

gcda_files=`find ${DORIS_TEST_BINARY_DIR} -name "*gcda"`
for gcda_file in ${gcda_files[@]}
do
rm $gcda_file
done

export DORIS_TEST_BINARY_DIR=${DORIS_TEST_BINARY_DIR}/test/

# prepare gtest output dir
Expand Down