Skip to content

Commit

Permalink
[Refactor] Remove warning when compiling (#18338)
Browse files Browse the repository at this point in the history
Signed-off-by: imay <buaa.zhaoc@gmail.com>
  • Loading branch information
imay authored Feb 22, 2023
1 parent facafc0 commit c56caf4
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 33 deletions.
8 changes: 4 additions & 4 deletions be/src/column/adaptive_nullable_column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,24 +145,24 @@ bool AdaptiveNullableColumn::append_strings(const Buffer<Slice>& strs) {
switch (_state) {
case State::kUninitialized: {
_state = State::kNotConstant;
_data_column->append_strings(strs);
std::ignore = _data_column->append_strings(strs);
_size = strs.size();
break;
}
case State::kNotConstant: {
_data_column->append_strings(strs);
std::ignore = _data_column->append_strings(strs);
_size += strs.size();
break;
}
case State::kMaterialized: {
_data_column->append_strings(strs);
std::ignore = _data_column->append_strings(strs);
null_column_data().resize(_null_column->size() + strs.size(), 0);
DCHECK_EQ(_null_column->size(), _data_column->size());
break;
}
default: {
materialized_nullable();
_data_column->append_strings(strs);
std::ignore = _data_column->append_strings(strs);
null_column_data().resize(_null_column->size() + strs.size(), 0);
DCHECK_EQ(_null_column->size(), _data_column->size());
break;
Expand Down
2 changes: 1 addition & 1 deletion be/src/column/adaptive_nullable_column.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ class AdaptiveNullableColumn final : public ColumnFactory<NullableColumn, Adapti
}
}

void materialized_nullable() const {
void materialized_nullable() const override {
if (_state == State::kMaterialized) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions be/src/exec/tablet_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ Status OlapTablePartitionParam::find_tablets(Chunk* chunk, std::vector<OlapTable
return Status::InternalError("automatic partition only support single column partition.");
}
for (auto& column : *row.columns) {
(*partition_not_exist_row_values)[0].emplace_back(std::move(column->debug_item(i)));
(*partition_not_exist_row_values)[0].emplace_back(column->debug_item(i));
}
} else {
(*partitions)[i] = nullptr;
Expand All @@ -418,7 +418,7 @@ Status OlapTablePartitionParam::find_tablets(Chunk* chunk, std::vector<OlapTable
return Status::InternalError("automatic partition only support single column partition.");
}
for (auto& column : *row.columns) {
(*partition_not_exist_row_values)[0].emplace_back(std::move(column->debug_item(i)));
(*partition_not_exist_row_values)[0].emplace_back(column->debug_item(i));
}
} else {
(*partitions)[i] = nullptr;
Expand Down
1 change: 1 addition & 0 deletions be/src/storage/binlog_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class Rowset;
// Fetch rowsets
class RowsetFetcher {
public:
virtual ~RowsetFetcher() = default;
virtual std::shared_ptr<Rowset> get_rowset(int64_t rowset_id) = 0;
};

Expand Down
48 changes: 22 additions & 26 deletions be/test/exprs/string_fn_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1926,19 +1926,19 @@ PARALLEL_TEST(VecStringFunctionsTest, replaceNullablePattern) {

context->set_constant_columns(columns);

ASSERT_TRUE(
StringFunctions::replace_prepare(context, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
ASSERT_TRUE(StringFunctions::replace_prepare(context, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());

const auto result = StringFunctions::replace(context, columns).value();
const auto v = ColumnHelper::cast_to<TYPE_VARCHAR>(ColumnHelper::as_raw_column<NullableColumn>(result)->data_column());
const auto v =
ColumnHelper::cast_to<TYPE_VARCHAR>(ColumnHelper::as_raw_column<NullableColumn>(result)->data_column());

EXPECT_EQ(res[0], v->get_data()[0].to_string());
EXPECT_TRUE(result->is_null(1));
EXPECT_EQ(res[2], v->get_data()[2].to_string());

ASSERT_TRUE(
StringFunctions::replace_close(context, FunctionContext::FunctionContext::FunctionStateScope::FRAGMENT_LOCAL)
.ok());
ASSERT_TRUE(StringFunctions::replace_close(context,
FunctionContext::FunctionContext::FunctionStateScope::FRAGMENT_LOCAL)
.ok());
}

PARALLEL_TEST(VecStringFunctionsTest, replaceOnlyNullPattern) {
Expand All @@ -1964,18 +1964,17 @@ PARALLEL_TEST(VecStringFunctionsTest, replaceOnlyNullPattern) {

context->set_constant_columns(columns);

ASSERT_TRUE(
StringFunctions::replace_prepare(context, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
ASSERT_TRUE(StringFunctions::replace_prepare(context, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());

const auto result = StringFunctions::replace(context, columns).value();

for (int i = 0; i < sizeof(strs) / sizeof(strs[0]); ++i) {
EXPECT_TRUE(result->is_null(i));
}

ASSERT_TRUE(
StringFunctions::replace_close(context, FunctionContext::FunctionContext::FunctionStateScope::FRAGMENT_LOCAL)
.ok());
ASSERT_TRUE(StringFunctions::replace_close(context,
FunctionContext::FunctionContext::FunctionStateScope::FRAGMENT_LOCAL)
.ok());
}

PARALLEL_TEST(VecStringFunctionsTest, replaceConstPattern) {
Expand Down Expand Up @@ -2004,8 +2003,7 @@ PARALLEL_TEST(VecStringFunctionsTest, replaceConstPattern) {

context->set_constant_columns(columns);

ASSERT_TRUE(
StringFunctions::replace_prepare(context, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
ASSERT_TRUE(StringFunctions::replace_prepare(context, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());

const auto result = StringFunctions::replace(context, columns).value();
const auto v = ColumnHelper::as_column<BinaryColumn>(result);
Expand All @@ -2014,9 +2012,9 @@ PARALLEL_TEST(VecStringFunctionsTest, replaceConstPattern) {
ASSERT_EQ(res[i], v->get_data()[i].to_string());
}

ASSERT_TRUE(
StringFunctions::replace_close(context, FunctionContext::FunctionContext::FunctionStateScope::FRAGMENT_LOCAL)
.ok());
ASSERT_TRUE(StringFunctions::replace_close(context,
FunctionContext::FunctionContext::FunctionStateScope::FRAGMENT_LOCAL)
.ok());
}

PARALLEL_TEST(VecStringFunctionsTest, replace) {
Expand Down Expand Up @@ -2047,8 +2045,7 @@ PARALLEL_TEST(VecStringFunctionsTest, replace) {

context->set_constant_columns(columns);

ASSERT_TRUE(
StringFunctions::replace_prepare(context, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
ASSERT_TRUE(StringFunctions::replace_prepare(context, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());

const auto result = StringFunctions::replace(context, columns).value();
const auto v = ColumnHelper::as_column<BinaryColumn>(result);
Expand All @@ -2057,9 +2054,9 @@ PARALLEL_TEST(VecStringFunctionsTest, replace) {
ASSERT_EQ(res[i], v->get_data()[i].to_string());
}

ASSERT_TRUE(
StringFunctions::replace_close(context, FunctionContext::FunctionContext::FunctionStateScope::FRAGMENT_LOCAL)
.ok());
ASSERT_TRUE(StringFunctions::replace_close(context,
FunctionContext::FunctionContext::FunctionStateScope::FRAGMENT_LOCAL)
.ok());
}

PARALLEL_TEST(VecStringFunctionsTest, replaceWithEmptyPattern) {
Expand All @@ -2086,8 +2083,7 @@ PARALLEL_TEST(VecStringFunctionsTest, replaceWithEmptyPattern) {

context->set_constant_columns(columns);

ASSERT_TRUE(
StringFunctions::replace_prepare(context, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
ASSERT_TRUE(StringFunctions::replace_prepare(context, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());

const auto result = StringFunctions::replace(context, columns).value();
const auto v = ColumnHelper::as_column<BinaryColumn>(result);
Expand All @@ -2096,9 +2092,9 @@ PARALLEL_TEST(VecStringFunctionsTest, replaceWithEmptyPattern) {
ASSERT_EQ(strs[i], v->get_data()[i].to_string());
}

ASSERT_TRUE(
StringFunctions::replace_close(context, FunctionContext::FunctionContext::FunctionStateScope::FRAGMENT_LOCAL)
.ok());
ASSERT_TRUE(StringFunctions::replace_close(context,
FunctionContext::FunctionContext::FunctionStateScope::FRAGMENT_LOCAL)
.ok());
}

PARALLEL_TEST(VecStringFunctionsTest, moneyFormatDouble) {
Expand Down

0 comments on commit c56caf4

Please sign in to comment.