[FEAT MERGE] impl vectorization 2.0

Co-authored-by: Naynahs <cfzy002@126.com>
Co-authored-by: hwx65 <1780011298@qq.com>
Co-authored-by: oceanoverflow <oceanoverflow@gmail.com>
This commit is contained in:
obdev
2023-12-22 03:43:19 +00:00
committed by ob-robot
parent 1178245448
commit b6773084c6
592 changed files with 358124 additions and 303288 deletions

View File

@ -15,6 +15,7 @@
#define OCEANBASE_CS_ENCODING_OB_CS_ENCODING_TEST_BASE_H_
#define USING_LOG_PREFIX STORAGE
#include "unittest/storage/blocksstable/encoding/test_column_decoder.h"
#include "../ob_row_generate.h"
#include "common/rowkey/ob_rowkey.h"
#include "lib/string/ob_sql_string.h"
@ -61,6 +62,10 @@ protected:
ObMicroBlockData &full_transformed_data,
ObMicroBlockCSDecoder &decoder);
int build_micro_block_desc(ObMicroBlockCSEncoder &encoder, ObMicroBlockDesc &desc, ObMicroBlockHeader* &header);
int check_decode_vector(ObMicroBlockCSDecoder &decoder,
const ObDatumRow *row_arr,
const int64_t row_cnt,
const VectorFormat vector_format);
int full_transform_check_row(const ObMicroBlockHeader *header,
const ObMicroBlockDesc &desc,
const ObDatumRow *row_arr,
@ -269,6 +274,16 @@ int ObCSEncodingTestBase::full_transform_check_row(const ObMicroBlockHeader *hea
}
}
}
if (OB_FAIL(ret)) {
} else if (OB_FAIL(check_decode_vector(decoder, row_arr, row_cnt, VEC_UNIFORM))) {
LOG_WARN("fail to check_decode_vector for VEC_UNIFORM", K(ret));
} else if (OB_FAIL(check_decode_vector(decoder, row_arr, row_cnt, VEC_FIXED))) {
LOG_WARN("fail to check_decode_vector for VEC_FIXED", K(ret));
} else if (OB_FAIL(check_decode_vector(decoder, row_arr, row_cnt, VEC_DISCRETE))) {
LOG_WARN("fail to check_decode_vector for VEC_DISCRETE", K(ret));
} else if (OB_FAIL(check_decode_vector(decoder, row_arr, row_cnt, VEC_CONTINUOUS))) {
LOG_WARN("fail to check_decode_vector for VEC_CONTINUOUS", K(ret));
}
if (OB_SUCC(ret) && check_by_get) {
ObCSEncodeBlockGetReader get_reader;
@ -291,6 +306,96 @@ int ObCSEncodingTestBase::full_transform_check_row(const ObMicroBlockHeader *hea
return ret;
}
int ObCSEncodingTestBase::check_decode_vector(ObMicroBlockCSDecoder &decoder,
const ObDatumRow *row_arr,
const int64_t row_cnt,
const VectorFormat vector_format)
{
int ret = OB_SUCCESS;
ObArenaAllocator frame_allocator;
sql::ObExecContext exec_context(allocator_);
sql::ObEvalCtx eval_ctx(exec_context);
char *buf = nullptr;
if (OB_ISNULL(buf = reinterpret_cast<char*>(allocator_.alloc(
row_cnt * (sizeof(char*)/*ptr_arr*/ + sizeof(uint32_t)/*len_arr*/ + sizeof(int64_t)/*row_ids*/))))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("fail to allocate", K(ret));
} else {
const char** ptr_arr = reinterpret_cast<const char**>(buf);
buf += row_cnt * sizeof(char*);
uint32_t *len_arr = reinterpret_cast<uint32_t*>(buf) ;
buf += row_cnt * sizeof(uint32_t);
int64_t *row_ids = reinterpret_cast<int64_t*>(buf);
bool need_test_column = true;
for (int col_idx = 0; OB_SUCC(ret) && col_idx < ctx_.column_cnt_; col_idx++) {
sql::ObExpr col_expr;
ObObjMeta col_meta = col_descs_.at(col_idx).col_type_;
const int16_t precision = col_meta.is_decimal_int() ? col_meta.get_stored_precision() : PRECISION_UNKNOWN_YET;
VecValueTypeClass vec_tc = common::get_vec_value_tc(col_meta.get_type(), col_meta.get_scale(), precision);
need_test_column = true;
if (vector_format == VEC_FIXED) {
VecValueTypeClass fixed_tc_arr[] = {VEC_TC_INTEGER, VEC_TC_UINTEGER, VEC_TC_FLOAT, VEC_TC_DOUBLE,
VEC_TC_FIXED_DOUBLE, VEC_TC_DATETIME, VEC_TC_DATE, VEC_TC_TIME, VEC_TC_YEAR, VEC_TC_UNKNOWN,
VEC_TC_BIT, VEC_TC_ENUM_SET, VEC_TC_TIMESTAMP_TZ, VEC_TC_TIMESTAMP_TINY, VEC_TC_INTERVAL_YM,
VEC_TC_INTERVAL_DS, VEC_TC_DEC_INT32, VEC_TC_DEC_INT64, VEC_TC_DEC_INT128, VEC_TC_DEC_INT256,
VEC_TC_DEC_INT512};
VecValueTypeClass *vec = std::find(std::begin(fixed_tc_arr), std::end(fixed_tc_arr), vec_tc);
if (vec == std::end(fixed_tc_arr)) {
need_test_column = false;
}
} else if (vector_format == VEC_DISCRETE || vector_format == VEC_UNIFORM) {
VecValueTypeClass var_tc_arr[] = {VEC_TC_NUMBER, VEC_TC_EXTEND, VEC_TC_STRING, VEC_TC_ENUM_SET_INNER,
VEC_TC_RAW, VEC_TC_ROWID, VEC_TC_LOB, VEC_TC_JSON, VEC_TC_GEO, VEC_TC_UDT};
VecValueTypeClass *vec = std::find(std::begin(var_tc_arr), std::end(var_tc_arr), vec_tc);
if (vec == std::end(var_tc_arr)) {
need_test_column = false;
}
} else if (vector_format == VEC_CONTINUOUS) {
/* can't test now
VecValueTypeClass var_tc_arr[] = {VEC_TC_NUMBER, VEC_TC_EXTEND, VEC_TC_STRING, VEC_TC_ENUM_SET_INNER,
VEC_TC_RAW, VEC_TC_ROWID, VEC_TC_LOB, VEC_TC_JSON, VEC_TC_GEO, VEC_TC_UDT};
VecValueTypeClass *vec = std::find(std::begin(var_tc_arr), std::end(var_tc_arr), vec_tc);
if (vec == std::end(var_tc_arr)) {
need_test_column = false;
}
*/
need_test_column = false;
}
if (!need_test_column) {
continue;
}
LOG_INFO("Current col: ", K(col_idx), K(col_meta), K(vector_format), K(precision), K(vec_tc));
if (OB_FAIL(VectorDecodeTestUtil::generate_column_output_expr(
row_cnt, col_meta, vector_format, eval_ctx, col_expr, frame_allocator))) {
LOG_WARN("fail to generate_column_output_expr", K(ret), K(vec_tc), K(col_meta), K(vector_format));
} else {
for (int64_t row_idx = 0; row_idx < row_cnt; ++row_idx) {
row_ids[row_idx] = row_idx;
}
ObVectorDecodeCtx vector_ctx(ptr_arr, len_arr, row_ids, row_cnt, 0, col_expr.get_vector_header(eval_ctx));
if (OB_FAIL(decoder.get_col_data(col_idx, vector_ctx))) {
LOG_WARN("fail to get_col_dagta", K(col_idx), K(vector_ctx));
}
for (int64_t vec_idx = 0; OB_SUCC(ret) && vec_idx < row_cnt; ++vec_idx) {
if (false == VectorDecodeTestUtil::verify_vector_and_datum_match(
*vector_ctx.get_vector(), vec_idx, row_arr[vec_idx].storage_datums_[col_idx])) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("decode vector result mismatch",
K(ret), K(vec_idx), K(col_idx), K(col_meta), K(vec_tc), K(vector_format), K(precision));
}
}
}
}
}
return ret;
}
int ObCSEncodingTestBase::part_transform_check_row(const ObMicroBlockHeader *header,
const ObMicroBlockDesc &desc,
const ObDatumRow *row_arr,

View File

@ -19,7 +19,6 @@
#include "ob_cs_encoding_test_base.h"
#include "storage/blocksstable/cs_encoding/ob_cs_encoding_util.h"
#include "storage/blocksstable/cs_encoding/ob_micro_block_cs_decoder.h"
#include "storage/blocksstable/cs_encoding/ob_micro_block_cs_encoder.h"
namespace oceanbase
{
@ -39,14 +38,14 @@ class ObPdFilterTestBase : public ObCSEncodingTestBase, public ::testing::Test
{
public:
ObPdFilterTestBase()
: enable_abnormal_filter_type_(false)
: abnormal_filter_type_(AbnormalFilterType::NOT_ABNORMAL)
{}
virtual ~ObPdFilterTestBase() {}
virtual void SetUp() {}
virtual void TearDown()
{
reuse();
enable_abnormal_filter_type_ = false;
abnormal_filter_type_ = AbnormalFilterType::NOT_ABNORMAL;
}
void set_obj_collation(ObObj &obj, const ObObjType &column_type);
@ -75,14 +74,19 @@ public:
const int64_t row_cnt,
const int64_t col_cnt,
const int64_t col_offset,
const ObObjType &col_type,
const ObObjMeta &col_meta,
const ObIArray<ObObj> &ref_objs,
ObMicroBlockCSDecoder &decoder,
const int64_t res_count);
public:
bool enable_abnormal_filter_type_;
enum AbnormalFilterType
{
NOT_ABNORMAL = 0,
WIDER_WIDTH,
OPPOSITE_SIGN
};
AbnormalFilterType abnormal_filter_type_;
};
void ObPdFilterTestBase::set_obj_collation(ObObj &obj, const ObObjType &column_type)
@ -126,11 +130,19 @@ void ObPdFilterTestBase::setup_obj(ObObj& obj, int64_t column_idx)
ObObjMeta column_meta = row_generate_.column_list_.at(column_idx).col_type_;
ObObjType column_type = column_meta.get_type();
bool is_integer = (ob_obj_type_class(column_type) == ObObjTypeClass::ObIntTC) || (ob_obj_type_class(column_type) == ObObjTypeClass::ObUIntTC);
if (enable_abnormal_filter_type_ && is_integer) {
if (ob_obj_type_class(column_type) == ObObjTypeClass::ObIntTC) {
column_meta.set_int();
} else {
column_meta.set_uint64();
if (is_integer) {
if (abnormal_filter_type_ == AbnormalFilterType::WIDER_WIDTH) {
if (ob_obj_type_class(column_type) == ObObjTypeClass::ObIntTC) {
column_meta.set_int();
} else {
column_meta.set_uint64();
}
} else if (abnormal_filter_type_ == AbnormalFilterType::OPPOSITE_SIGN) {
if (ob_obj_type_class(column_type) == ObObjTypeClass::ObIntTC) {
column_meta.set_uint64();
} else {
column_meta.set_int();
}
}
}
column_type = column_meta.get_type();
@ -273,7 +285,7 @@ int ObPdFilterTestBase::check_column_store_white_filter(
const int64_t row_cnt,
const int64_t col_cnt,
const int64_t col_offset,
const ObObjType &col_type,
const ObObjMeta &col_meta,
const ObIArray<ObObj> &ref_objs,
ObMicroBlockCSDecoder &decoder,
const int64_t res_count)
@ -303,13 +315,7 @@ int ObPdFilterTestBase::check_column_store_white_filter(
white_filter->col_offsets_.init(1);
white_filter->col_params_.init(1);
ObColumnParam col_param(allocator_);
ObObjMeta col_meta;
if (ref_objs.count() < 1) {
set_obj_meta_collation(col_meta, col_type);
col_param.set_meta_type(col_meta);
} else {
col_param.set_meta_type(ref_objs.at(0).meta_);
}
col_param.set_meta_type(col_meta);
white_filter->col_params_.push_back(&col_param);
white_filter->col_offsets_.push_back(col_offset);
white_filter->n_cols_ = 1;
@ -358,13 +364,14 @@ int ObPdFilterTestBase::check_column_store_white_filter(
}
} else {
white_filter->filter_.expr_->args_[i]->type_ = T_REF_COLUMN;
white_filter->filter_.expr_->args_[arg_cnt-1]->obj_meta_ = col_meta;
}
}
if (OB_UNLIKELY(2 > white_filter->filter_.expr_->arg_cnt_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("Unexpected filter expr", K(ret), K(white_filter->filter_.expr_->arg_cnt_));
} else {
white_filter->cmp_func_ = get_datum_cmp_func(white_filter->filter_.expr_->args_[0]->obj_meta_, white_filter->filter_.expr_->args_[0]->obj_meta_);
white_filter->cmp_func_ = get_datum_cmp_func(white_filter->filter_.expr_->args_[arg_cnt-1]->obj_meta_, white_filter->filter_.expr_->args_[0]->obj_meta_);
}
if (OB_SUCC(ret) ) {
@ -408,7 +415,7 @@ int ObPdFilterTestBase::check_column_store_white_filter(
ASSERT_EQ(OB_SUCCESS, build_integer_filter_ref(ref_cnt, tmp_ref_arr, col_offset, ref_objs, false)); \
} \
ASSERT_EQ(OB_SUCCESS, check_column_store_white_filter(op_type, row_cnt, col_cnt, \
col_offset, col_types[col_offset], ref_objs, decoder, res_arr[i])) << "round: " << i << std::endl; \
col_offset, col_descs_[col_offset].col_type_, ref_objs, decoder, res_arr[i])) << "round: " << i << std::endl; \
} \
} \
@ -427,7 +434,7 @@ int ObPdFilterTestBase::check_column_store_white_filter(
ASSERT_EQ(OB_SUCCESS, build_decimal_filter_ref(ref_cnt, tmp_ref_arr, col_offset, ref_objs)); \
} \
ASSERT_EQ(OB_SUCCESS, check_column_store_white_filter(op_type, row_cnt, col_cnt, \
col_offset, col_types[col_offset], ref_objs, decoder, res_arr[i])) << "round: " << i << std::endl; \
col_offset, col_descs_[col_offset].col_type_, ref_objs, decoder, res_arr[i])) << "round: " << i << std::endl; \
} \
} \
@ -447,7 +454,7 @@ int ObPdFilterTestBase::check_column_store_white_filter(
ASSERT_EQ(OB_SUCCESS, build_integer_filter_ref(ref_cnt, tmp_ref_seed_arr, col_offset, ref_objs, true)); \
} \
ASSERT_EQ(OB_SUCCESS, check_column_store_white_filter(op_type, row_cnt, col_cnt, \
col_offset, col_types[col_offset], ref_objs, decoder, res_arr[i])) << "round: " << i << std::endl; \
col_offset, col_descs_[col_offset].col_type_, ref_objs, decoder, res_arr[i])) << "round: " << i << std::endl; \
} \
} \
@ -467,7 +474,7 @@ int ObPdFilterTestBase::check_column_store_white_filter(
} \
} \
ASSERT_EQ(OB_SUCCESS, check_column_store_white_filter(op_type, row_cnt, col_cnt, \
col_offset, col_types[col_offset], ref_objs, decoder, res_arr[i])); \
col_offset, col_descs_[col_offset].col_type_, ref_objs, decoder, res_arr[i])); \
} \
} \

View File

@ -1132,13 +1132,17 @@ void TestDecoderFilterPerf::init_encoding_ctx(
char *datum_ptr_buf = reinterpret_cast<char *>(cur_allocator.alloc(SIMPLE_ROW_CNT * cur_column_cnt * sizeof(char) * single_ptr_buf_len)); \
ObDatum *datum_buf = new ObDatum[SIMPLE_ROW_CNT * cur_column_cnt]; \
ObSEArray<ObSqlDatumInfo, 16> datum_arr; \
void *expr_arr = cur_allocator.alloc(sizeof(sql::ObExpr) * cur_column_cnt); \
sql::ObExpr *exprs = reinterpret_cast<sql::ObExpr *>(expr_arr); \
for (int64_t i = 0; i < cur_column_cnt; ++i) { \
ASSERT_EQ(OB_SUCCESS, datum_arr.push_back(ObSqlDatumInfo())); \
datum_arr.at(i).datum_ptr_ = datum_buf + SIMPLE_ROW_CNT * i; \
if (i == cur_column_cnt - 1) { \
datum_arr.at(i).map_type_ = ObObjDatumMapType::OBJ_DATUM_STRING; \
exprs[i].obj_datum_map_ = ObObjDatumMapType::OBJ_DATUM_STRING; \
datum_arr.at(i).expr_ = exprs + i; \
} else { \
datum_arr.at(i).map_type_ = ObObjDatumMapType::OBJ_DATUM_NUMBER; \
exprs[i].obj_datum_map_ = ObObjDatumMapType::OBJ_DATUM_NUMBER; \
datum_arr.at(i).expr_ = exprs + i; \
} \
cols.push_back(i); \
col_params.push_back(param); \

View File

@ -376,7 +376,7 @@ TEST_F(TestIntDictPdFilter, test_int_dict_const_without_null_decoder)
// NOTICE:
// In this case, we will use 'abnormal' filter value, that means, although the column type is smallint,
// we will use some value larger than INT16_MAX or less than INT16_MIN to check the correctness of filter.
enable_abnormal_filter_type_ = true;
abnormal_filter_type_ = AbnormalFilterType::WIDER_WIDTH;
// check NU/NN
{
@ -539,6 +539,87 @@ TEST_F(TestIntDictPdFilter, test_exceed_range_compare_filter)
LOG_INFO(">>>>>>>>>>FINISH PD FILTER<<<<<<<<<<<");
}
//
// but actually int dict encoding does not trigger this problem, because int dict are always sorted
// and take other paths. only integer encoding may trigger this problem.
TEST_F(TestIntDictPdFilter, test_singed_and_unsigned_compare_filter)
{
const int64_t rowkey_cnt = 1;
const int64_t col_cnt = 3;
const bool enable_check = ENABLE_CASE_CHECK;
abnormal_filter_type_ = AbnormalFilterType::OPPOSITE_SIGN;
ObObjType col_types[col_cnt] = {ObInt32Type, ObUSmallIntType, ObIntType};
ASSERT_EQ(OB_SUCCESS, prepare(col_types, rowkey_cnt, col_cnt));
ctx_.column_encodings_[0] = ObCSColumnHeader::Type::INT_DICT;
ctx_.column_encodings_[1] = ObCSColumnHeader::Type::INT_DICT;
ctx_.column_encodings_[2] = ObCSColumnHeader::Type::INT_DICT;
const int64_t row_cnt = 2;
ObMicroBlockCSEncoder encoder;
ASSERT_EQ(OB_SUCCESS, encoder.init(ctx_));
ObDatumRow row_arr[row_cnt];
for (int64_t i = 0; i < row_cnt; ++i) {
ASSERT_EQ(OB_SUCCESS, row_arr[i].init(allocator_, col_cnt));
}
row_arr[0].storage_datums_[0].set_int32(0);
row_arr[0].storage_datums_[1].set_uint(0);
row_arr[0].storage_datums_[2].set_int(-1);
ASSERT_EQ(OB_SUCCESS, encoder.append_row(row_arr[0]));
row_arr[1].storage_datums_[0].set_int32(1);
row_arr[1].storage_datums_[1].set_uint(1);
row_arr[1].storage_datums_[2].set_int(0);
ASSERT_EQ(OB_SUCCESS, encoder.append_row(row_arr[1]));
HANDLE_TRANSFORM();
int64_t col_offset = 1;
bool need_check = true;
// check EQ NE
{
int64_t ref_arr[4] = {0, 1, 100, 1000};
int64_t res_arr_eq[4] = {1, 1, 0, 0};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_EQ, 4, 1, res_arr_eq);
int64_t res_arr_ne[4] = {1, 1, 2, 2};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_NE, 4, 1, res_arr_ne);
}
// check LT/LE/GT/GE
{
int64_t ref_arr[4] = {-1, 0, 1, 100};
int64_t res_arr_lt[4] = {0, 0, 1, 2};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_LT, 4, 1, res_arr_lt);
int64_t res_arr_le[4] = {0, 1, 2, 2};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_LE, 4, 1, res_arr_le);
}
{
int64_t ref_arr[4] = {-1, 0, 1, 100};
int64_t res_arr_gt[4] = {2, 1, 0, 0};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_GT, 4, 1, res_arr_gt);
int64_t res_arr_ge[4] = {2, 2, 1, 0};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_GE, 4, 1, res_arr_ge);
}
LOG_INFO(">>>>>>>>>>FINISH PD FILTER<<<<<<<<<<<");
col_offset = 2;
// check LT/LE/GT/GE
{
int64_t ref_arr[4] = {0, 1, 10, 100};
int64_t res_arr_lt[4] = {1, 2, 2, 2};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_LT, 4, 1, res_arr_lt);
int64_t res_arr_le[4] = {2, 2, 2, 2};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_LE, 4, 1, res_arr_le);
}
{
int64_t ref_arr[4] = {0, 1, 10, 100};
int64_t res_arr_gt[4] = {0, 0, 0, 0};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_GT, 4, 1, res_arr_gt);
int64_t res_arr_ge[4] = {1, 0, 0, 0};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_GE, 4, 1, res_arr_ge);
}
LOG_INFO(">>>>>>>>>>FINISH PD FILTER<<<<<<<<<<<");
}
}
}

View File

@ -195,7 +195,7 @@ TEST_F(TestIntegerPdFilter, test_integer_decoder_nullbitmap_type)
const bool enable_check = ENABLE_CASE_CHECK;
const bool has_null = true;
const bool is_force_raw = true;
enable_abnormal_filter_type_ = true;
abnormal_filter_type_ = AbnormalFilterType::WIDER_WIDTH;
ObObjType col_types[col_cnt] = {ObInt32Type, ObTinyIntType};
ASSERT_EQ(OB_SUCCESS, prepare(col_types, rowkey_cnt, col_cnt));
ctx_.column_encodings_[0] = ObCSColumnHeader::Type::INTEGER;
@ -341,7 +341,7 @@ TEST_F(TestIntegerPdFilter, test_integer_abnormal_filter)
{
const int64_t rowkey_cnt = 1;
const int64_t col_cnt = 2;
enable_abnormal_filter_type_ = true;
abnormal_filter_type_ = AbnormalFilterType::WIDER_WIDTH;
const bool enable_check = ENABLE_CASE_CHECK;
ObObjType col_types[col_cnt] = {ObInt32Type, ObSmallIntType};
ASSERT_EQ(OB_SUCCESS, prepare(col_types, rowkey_cnt, col_cnt));
@ -554,6 +554,86 @@ TEST_F(TestIntegerPdFilter, test_exceed_range_compare_filter)
LOG_INFO(">>>>>>>>>>FINISH PD FILTER<<<<<<<<<<<");
}
//
TEST_F(TestIntegerPdFilter, test_singed_and_unsigned_compare_filter)
{
const int64_t rowkey_cnt = 1;
const int64_t col_cnt = 3;
const bool enable_check = ENABLE_CASE_CHECK;
abnormal_filter_type_ = AbnormalFilterType::OPPOSITE_SIGN;
ObObjType col_types[col_cnt] = {ObInt32Type, ObUSmallIntType, ObIntType};
ASSERT_EQ(OB_SUCCESS, prepare(col_types, rowkey_cnt, col_cnt));
ctx_.column_encodings_[0] = ObCSColumnHeader::Type::INTEGER; // integer
ctx_.column_encodings_[1] = ObCSColumnHeader::Type::INTEGER; // integer
ctx_.column_encodings_[2] = ObCSColumnHeader::Type::INTEGER; // integer
const int64_t row_cnt = 2;
ObMicroBlockCSEncoder encoder;
ASSERT_EQ(OB_SUCCESS, encoder.init(ctx_));
ObDatumRow row_arr[row_cnt];
for (int64_t i = 0; i < row_cnt; ++i) {
ASSERT_EQ(OB_SUCCESS, row_arr[i].init(allocator_, col_cnt));
}
row_arr[0].storage_datums_[0].set_int32(0);
row_arr[0].storage_datums_[1].set_uint(0);
row_arr[0].storage_datums_[2].set_int(-1);
ASSERT_EQ(OB_SUCCESS, encoder.append_row(row_arr[0]));
row_arr[1].storage_datums_[0].set_int32(1);
row_arr[1].storage_datums_[1].set_uint(1);
row_arr[1].storage_datums_[2].set_int(0);
ASSERT_EQ(OB_SUCCESS, encoder.append_row(row_arr[1]));
HANDLE_TRANSFORM();
int64_t col_offset = 1;
bool need_check = true;
// check EQ NE
{
int64_t ref_arr[4] = {0, 1, 100, 1000};
int64_t res_arr_eq[4] = {1, 1, 0, 0};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_EQ, 4, 1, res_arr_eq);
int64_t res_arr_ne[4] = {1, 1, 2, 2};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_NE, 4, 1, res_arr_ne);
}
// check LT/LE/GT/GE
{
int64_t ref_arr[4] = {-1, 0, 1, 100};
int64_t res_arr_lt[4] = {0, 0, 1, 2};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_LT, 4, 1, res_arr_lt);
int64_t res_arr_le[4] = {0, 1, 2, 2};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_LE, 4, 1, res_arr_le);
}
{
int64_t ref_arr[4] = {-1, 0, 1, 100};
int64_t res_arr_gt[4] = {2, 1, 0, 0};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_GT, 4, 1, res_arr_gt);
int64_t res_arr_ge[4] = {2, 2, 1, 0};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_GE, 4, 1, res_arr_ge);
}
LOG_INFO(">>>>>>>>>>FINISH PD FILTER<<<<<<<<<<<");
col_offset = 2;
// check LT/LE/GT/GE
{
int64_t ref_arr[4] = {0, 1, 10, 100};
int64_t res_arr_lt[4] = {1, 2, 2, 2};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_LT, 4, 1, res_arr_lt);
int64_t res_arr_le[4] = {2, 2, 2, 2};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_LE, 4, 1, res_arr_le);
}
{
int64_t ref_arr[4] = {0, 1, 10, 100};
int64_t res_arr_gt[4] = {0, 0, 0, 0};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_GT, 4, 1, res_arr_gt);
int64_t res_arr_ge[4] = {1, 0, 0, 0};
integer_type_filter_normal_check(true, ObWhiteFilterOperatorType::WHITE_OP_GE, 4, 1, res_arr_ge);
}
LOG_INFO(">>>>>>>>>>FINISH PD FILTER<<<<<<<<<<<");
}
}
}