Skip to content
Open
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
2 changes: 1 addition & 1 deletion be/src/storage/segment/segment_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Status SegmentWriter::_create_column_writer(uint32_t cid, const TabletColumn& co
opts.need_zone_map = column.is_key() || schema->keys_type() != KeysType::AGG_KEYS;
opts.need_bloom_filter = column.is_bf_column();
if (opts.need_bloom_filter) {
opts.bf_options.fpp = schema->has_bf_fpp() ? schema->bloom_filter_fpp() : 0.05;
opts.bf_options.fpp = schema->get_bloom_filter_fpp(column);
}
auto* tablet_index = schema->get_ngram_bf_index(column.unique_id());
if (tablet_index) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ Status _create_column_writer(uint32_t cid, const TabletColumn& column,
}
opt->need_zone_map = tablet_schema->keys_type() != KeysType::AGG_KEYS;
opt->need_bloom_filter = column.is_bf_column();
if (opt->need_bloom_filter) {
opt->bf_options.fpp = tablet_schema->get_bloom_filter_fpp(column);
}
const auto& parent_index = tablet_schema->inverted_indexs(column.parent_unique_id());

// init inverted index
Expand Down
3 changes: 1 addition & 2 deletions be/src/storage/segment/vertical_segment_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ Status VerticalSegmentWriter::_create_column_writer(uint32_t cid, const TabletCo
opts.need_zone_map = column.is_key() || tablet_schema->keys_type() != KeysType::AGG_KEYS;
opts.need_bloom_filter = column.is_bf_column();
if (opts.need_bloom_filter) {
opts.bf_options.fpp =
tablet_schema->has_bf_fpp() ? tablet_schema->bloom_filter_fpp() : 0.05;
opts.bf_options.fpp = tablet_schema->get_bloom_filter_fpp(column);
}
auto* tablet_index = tablet_schema->get_ngram_bf_index(column.unique_id());
if (tablet_index) {
Expand Down
27 changes: 27 additions & 0 deletions be/src/storage/tablet/tablet_schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
#include <algorithm>
#include <cctype>
// IWYU pragma: no_include <bits/std_abs.h>
#include <charconv>
#include <cmath> // IWYU pragma: keep
#include <memory>
#include <ostream>
#include <vector>

#include "common/check.h"
#include "common/compiler_util.h" // IWYU pragma: keep
#include "common/consts.h"
#include "common/status.h"
Expand All @@ -40,6 +42,7 @@
#include "core/data_type/data_type.h"
#include "core/data_type/data_type_factory.hpp"
#include "core/string_ref.h"
#include "core/types.h"
#include "exec/common/hex.h"
#include "exprs/aggregate/aggregate_function_simple_factory.h"
#include "exprs/aggregate/aggregate_function_state_union.h"
Expand Down Expand Up @@ -1868,6 +1871,30 @@ const TabletIndex* TabletSchema::get_ngram_bf_index(int32_t col_unique_id) const
return nullptr;
}

double TabletSchema::get_bloom_filter_fpp(int32_t col_unique_id) const {
const auto* bloom_filter_index = get_index(col_unique_id, IndexType::BLOOMFILTER, "");
if (bloom_filter_index != nullptr) {
const auto& properties = bloom_filter_index->properties();
auto iter = properties.find("bloom_filter_fpp");
if (iter != properties.end()) {
StringParser::ParseResult parse_result = StringParser::PARSE_FAILURE;
auto index_level_fpp = StringParser::string_to_float<Float64>(
iter->second.data(), iter->second.size(), &parse_result);
DORIS_CHECK(parse_result == StringParser::PARSE_SUCCESS)
<< "failed to parse '" << iter->second << "' as double";
return index_level_fpp;
}
return BLOOM_FILTER_DEFAULT_FPP;
}
return has_bf_fpp() ? bloom_filter_fpp() : BLOOM_FILTER_DEFAULT_FPP;
}

double TabletSchema::get_bloom_filter_fpp(const TabletColumn& column) const {
const int32_t col_unique_id =
column.is_extracted_column() ? column.parent_unique_id() : column.unique_id();
return get_bloom_filter_fpp(col_unique_id);
}

const TabletIndex* TabletSchema::get_index(int32_t col_unique_id, IndexType index_type,
const std::string& suffix_path) const {
IndexKey index_key(index_type, col_unique_id, suffix_path);
Expand Down
2 changes: 2 additions & 0 deletions be/src/storage/tablet/tablet_schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,8 @@ class TabletSchema : public MetadataAdder<TabletSchema> {

bool has_ngram_bf_index(int32_t col_unique_id) const;
const TabletIndex* get_ngram_bf_index(int32_t col_unique_id) const;
double get_bloom_filter_fpp(int32_t col_unique_id) const;
double get_bloom_filter_fpp(const TabletColumn& column) const;
const TabletIndex* get_index(int32_t col_unique_id, IndexType index_type,
const std::string& suffix_path) const;
void update_indexes_from_thrift(const std::vector<doris::TOlapTableIndex>& indexes);
Expand Down
Loading
Loading