Support bloom filter index for large int type (#2550)

This commit is contained in:
kangpinghuang
2019-12-24 19:04:03 +08:00
committed by ZHAO Chun
parent f9685372a1
commit 7f48bd3c5a
2 changed files with 18 additions and 1 deletions

View File

@ -171,6 +171,9 @@ Status BloomFilterIndexWriter::create(const BloomFilterOptions& bf_options,
case OLAP_FIELD_TYPE_BIGINT:
res->reset(new BloomFilterIndexWriterImpl<OLAP_FIELD_TYPE_BIGINT>(bf_options, typeinfo));
break;
case OLAP_FIELD_TYPE_LARGEINT:
res->reset(new BloomFilterIndexWriterImpl<OLAP_FIELD_TYPE_LARGEINT>(bf_options, typeinfo));
break;
case OLAP_FIELD_TYPE_CHAR:
res->reset(new BloomFilterIndexWriterImpl<OLAP_FIELD_TYPE_CHAR>(bf_options, typeinfo));
break;

View File

@ -117,7 +117,7 @@ void test_bloom_filter_index_reader_writer_template(const std::string file_name,
Slice* value = (Slice*)(val + i);
ASSERT_TRUE(bf->test_bytes(value->data, value->size));
} else {
ASSERT_TRUE(bf->test_bytes((char*)&val[i], sizeof(CppType))) << "index:" << i << ", value:" << val[i];
ASSERT_TRUE(bf->test_bytes((char*)&val[i], sizeof(CppType)));
}
}
@ -179,6 +179,20 @@ TEST_F(BloomFilterIndexReaderWriterTest, test_bigint) {
delete[] val;
}
TEST_F(BloomFilterIndexReaderWriterTest, test_largeint) {
size_t num = 1024 * 3 - 1;
int128_t* val = new int128_t[num];
for (int i = 0; i < num; ++i) {
// there will be 3 bloom filter pages
val[i] = 100000000 + i + 1;
}
std::string file_name = "bloom_filter_largeint";
int128_t not_exist_value = 18888;
test_bloom_filter_index_reader_writer_template<OLAP_FIELD_TYPE_LARGEINT>(file_name, val, num, 1, &not_exist_value);
delete[] val;
}
TEST_F(BloomFilterIndexReaderWriterTest, test_varchar_type) {
size_t num = 1024 * 3 - 1;
std::string* val = new std::string[num];