Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: trueeyu <[email protected]>
  • Loading branch information
trueeyu committed Sep 23, 2024
1 parent 2c87b9c commit 92a80e3
Showing 1 changed file with 29 additions and 9 deletions.
38 changes: 29 additions & 9 deletions be/test/exprs/array_functions_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class ArrayFunctionsTest : public ::testing::Test {
template <typename CppType>
void _check_array_nullable(const Buffer<CppType>& check_values, const Buffer<uint8_t>& nulls,
const DatumArray& value);

FunctionContext _ctx;
};

template <typename CppType>
Expand Down Expand Up @@ -3925,7 +3927,9 @@ TEST_F(ArrayFunctionsTest, array_overlap_tinyint_with_nullable) {
src_column2->append_datum(DatumArray{(int8_t)4, Datum()});

ArrayOverlap<LogicalType::TYPE_TINYINT> overlap;
auto dest_column = overlap.process(nullptr, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.prepare(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
auto dest_column = overlap.process(&_ctx, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.close(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());

ASSERT_TRUE(dest_column->is_nullable());
ASSERT_EQ(dest_column->size(), 5);
Expand Down Expand Up @@ -3957,7 +3961,9 @@ TEST_F(ArrayFunctionsTest, array_overlap_tinyint) {
src_column2->append_datum(DatumArray{(int8_t)4, Datum()});

ArrayOverlap<LogicalType::TYPE_TINYINT> overlap;
auto dest_column = overlap.process(nullptr, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.prepare(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
auto dest_column = overlap.process(&_ctx, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.close(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());

ASSERT_TRUE(!dest_column->is_nullable());
ASSERT_EQ(dest_column->size(), 5);
Expand Down Expand Up @@ -3987,7 +3993,9 @@ TEST_F(ArrayFunctionsTest, array_overlap_bigint_with_nullable) {
src_column2->append_datum(DatumArray{(int64_t)4, Datum()});

ArrayOverlap<LogicalType::TYPE_BIGINT> overlap;
auto dest_column = overlap.process(nullptr, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.prepare(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
auto dest_column = overlap.process(&_ctx, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.close(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());

ASSERT_TRUE(dest_column->is_nullable());
ASSERT_EQ(dest_column->size(), 5);
Expand Down Expand Up @@ -4019,7 +4027,9 @@ TEST_F(ArrayFunctionsTest, array_overlap_bigint) {
src_column2->append_datum(DatumArray{(int64_t)4, Datum()});

ArrayOverlap<LogicalType::TYPE_BIGINT> overlap;
auto dest_column = overlap.process(nullptr, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.prepare(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
auto dest_column = overlap.process(&_ctx, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.close(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());

ASSERT_TRUE(!dest_column->is_nullable());
ASSERT_EQ(dest_column->size(), 5);
Expand Down Expand Up @@ -4049,7 +4059,9 @@ TEST_F(ArrayFunctionsTest, array_overlap_double_with_nullable) {
src_column2->append_datum(DatumArray{(double)4, Datum()});

ArrayOverlap<LogicalType::TYPE_DOUBLE> overlap;
auto dest_column = overlap.process(nullptr, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.prepare(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
auto dest_column = overlap.process(&_ctx, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.close(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());

ASSERT_TRUE(dest_column->is_nullable());
ASSERT_EQ(dest_column->size(), 5);
Expand Down Expand Up @@ -4081,7 +4093,9 @@ TEST_F(ArrayFunctionsTest, array_overlap_double) {
src_column2->append_datum(DatumArray{(double)4, Datum()});

ArrayOverlap<LogicalType::TYPE_DOUBLE> overlap;
auto dest_column = overlap.process(nullptr, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.prepare(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
auto dest_column = overlap.process(&_ctx, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.close(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());

ASSERT_TRUE(!dest_column->is_nullable());
ASSERT_EQ(dest_column->size(), 5);
Expand Down Expand Up @@ -4111,7 +4125,9 @@ TEST_F(ArrayFunctionsTest, array_overlap_varchar_with_nullable) {
src_column2->append_datum(DatumArray{Slice("4"), Datum()});

ArrayOverlap<LogicalType::TYPE_VARCHAR> overlap;
auto dest_column = overlap.process(nullptr, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.prepare(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
auto dest_column = overlap.process(&_ctx, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.close(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());

ASSERT_TRUE(dest_column->is_nullable());
ASSERT_EQ(dest_column->size(), 5);
Expand Down Expand Up @@ -4143,7 +4159,9 @@ TEST_F(ArrayFunctionsTest, array_overlap_varchar) {
src_column2->append_datum(DatumArray{Slice("4"), Datum()});

ArrayOverlap<LogicalType::TYPE_VARCHAR> overlap;
auto dest_column = overlap.process(nullptr, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.prepare(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
auto dest_column = overlap.process(&_ctx, {src_column, src_column2}).value();
ASSERT_TRUE(overlap.close(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());

ASSERT_TRUE(!dest_column->is_nullable());
ASSERT_EQ(dest_column->size(), 5);
Expand All @@ -4164,7 +4182,9 @@ TEST_F(ArrayFunctionsTest, array_overlap_with_onlynull) {
auto src_column2 = ColumnHelper::create_const_null_column(1);

ArrayOverlap<LogicalType::TYPE_TINYINT> overlap;
auto dest_column = overlap.process(nullptr, {src_column, src_column2});
ASSERT_TRUE(overlap.prepare(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
auto dest_column = overlap.process(&_ctx, {src_column, src_column2});
ASSERT_TRUE(overlap.close(&_ctx, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());

ASSERT_TRUE(dest_column->get()->only_null());
}
Expand Down

0 comments on commit 92a80e3

Please sign in to comment.