Skip to content

Commit

Permalink
[Refactor] Remove unused function (StarRocks#13867)
Browse files Browse the repository at this point in the history
  • Loading branch information
imay authored Nov 22, 2022
1 parent c0a1b94 commit 063fdac
Showing 2 changed files with 0 additions and 79 deletions.
26 changes: 0 additions & 26 deletions be/src/storage/field.h
Original file line number Diff line number Diff line change
@@ -93,36 +93,10 @@ class Field {
// It's a critical function, used by ZoneMapIndexWriter to serialize max and min value
std::string to_string(const char* src) const { return _type_info->to_string(src); }

template <typename CellType>
std::string debug_string(const CellType& cell) const {
std::stringstream ss;
if (cell.is_null()) {
ss << "(null)";
} else {
ss << _type_info->to_string(cell.cell_ptr());
}
return ss.str();
}

LogicalType type() const { return _type_info->type(); }
const TypeInfoPtr& type_info() const { return _type_info; }
bool is_nullable() const { return _is_nullable; }

// similar to `full_encode_ascending`, but only encode part (the first `index_size` bytes) of the value.
// only applicable to string type
void encode_ascending(const void* value, std::string* buf) const {
_key_coder->encode_ascending(value, _index_size, buf);
}

// encode the provided `value` into `buf`.
void full_encode_ascending(const void* value, std::string* buf) const {
_key_coder->full_encode_ascending(value, buf);
}

Status decode_ascending(Slice* encoded_key, uint8_t* cell_ptr, MemPool* pool) const {
return _key_coder->decode_ascending(encoded_key, _index_size, cell_ptr, pool);
}

std::string to_zone_map_string(const char* value) const {
switch (type()) {
case TYPE_DECIMAL32:
53 changes: 0 additions & 53 deletions be/src/storage/short_key_index.h
Original file line number Diff line number Diff line change
@@ -56,59 +56,6 @@ constexpr uint8_t KEY_NULL_LAST_MARKER = 0xFE;
// Used to represent maximal value for that field
constexpr uint8_t KEY_MAXIMAL_MARKER = 0xFF;

// Encode one row into binary according given num_keys.
// A cell will be encoded in the format of a marker and encoded content.
// When function encoding row, if any cell isn't found in row, this function will
// fill a marker and return. If padding_minimal is true, KEY_MINIMAL_MARKER will
// be added, if padding_minimal is false, KEY_MAXIMAL_MARKER will be added.
// If all num_keys are found in row, no marker will be added.
template <typename RowType, bool null_first = true>
void encode_key_with_padding(std::string* buf, const RowType& row, size_t num_keys, bool padding_minimal) {
for (auto cid = 0; cid < num_keys; cid++) {
auto field = row.schema()->column(cid);
if (field == nullptr) {
if (padding_minimal) {
buf->push_back(KEY_MINIMAL_MARKER);
} else {
buf->push_back(KEY_MAXIMAL_MARKER);
}
break;
}

auto cell = row.cell(cid);
if (cell.is_null()) {
if (null_first) {
buf->push_back(KEY_NULL_FIRST_MARKER);
} else {
buf->push_back(KEY_NULL_LAST_MARKER);
}
continue;
}
buf->push_back(KEY_NORMAL_MARKER);
field->encode_ascending(cell.cell_ptr(), buf);
}
}

// Encode one row into binary according given num_keys.
// Client call this function must assure that row contains the first
// num_keys columns.
template <typename RowType, bool null_first = true>
void encode_key(std::string* buf, const RowType& row, size_t num_keys) {
for (auto cid = 0; cid < num_keys; cid++) {
auto cell = row.cell(cid);
if (cell.is_null()) {
if (null_first) {
buf->push_back(KEY_NULL_FIRST_MARKER);
} else {
buf->push_back(KEY_NULL_LAST_MARKER);
}
continue;
}
buf->push_back(KEY_NORMAL_MARKER);
row.schema()->column(cid)->encode_ascending(cell.cell_ptr(), buf);
}
}

// Encode a segment short key indices to one ShortKeyPage. This version
// only accepts binary key, client should assure that input key is sorted,
// otherwise error could happens. This builder would arrange the page body in the

0 comments on commit 063fdac

Please sign in to comment.