Skip to content

Commit

Permalink
[refactor](variant) remove duplicated and trivial sanitize
Browse files Browse the repository at this point in the history
1. could improve serialization performance
2. check is incorrect, example int8 and int16 could be compatible
  • Loading branch information
eldenmoon committed Dec 20, 2024
1 parent 6283f45 commit cb3759e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 30 deletions.
26 changes: 0 additions & 26 deletions be/src/vec/columns/column_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1354,14 +1354,6 @@ Status find_and_set_leave_value(const IColumn* column, const PathInData& path,
TypeIndex base_type_index, rapidjson::Value& root,
rapidjson::Document::AllocatorType& allocator, Arena& mem_pool,
size_t row) {
#ifndef NDEBUG
// sanitize type and column
if (column->get_name() != type->create_column()->get_name()) {
return Status::InternalError(
"failed to set value for path {}, expected type {}, but got {} at row {}",
path.get_path(), type->get_name(), column->get_name(), row);
}
#endif
const auto* nullable = check_and_get_column<ColumnNullable>(column);
if (skip_empty_json(nullable, type, base_type_index, row, path)) {
return Status::OK();
Expand Down Expand Up @@ -1952,24 +1944,6 @@ std::string ColumnObject::debug_string() const {
return res.str();
}

Status ColumnObject::sanitize() const {
RETURN_IF_CATCH_EXCEPTION(check_consistency());
for (const auto& subcolumn : subcolumns) {
if (subcolumn->data.is_finalized()) {
auto column = subcolumn->data.get_least_common_type()->create_column();
std::string original = subcolumn->data.get_finalized_column().get_name();
std::string expected = column->get_name();
if (original != expected) {
return Status::InternalError("Incompatible type between {} and {}, debug_info:",
original, expected, debug_string());
}
}
}

VLOG_DEBUG << "sanitized " << debug_string();
return Status::OK();
}

ColumnObject::Subcolumn ColumnObject::Subcolumn::cut(size_t start, size_t length) const {
Subcolumn new_subcolumn(0, is_nullable);
new_subcolumn.insert_range_from(*this, start, length);
Expand Down
3 changes: 0 additions & 3 deletions be/src/vec/columns/column_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,6 @@ class ColumnObject final : public COWHelper<IColumn, ColumnObject> {

bool empty() const;

// Check if all columns and types are aligned
Status sanitize() const;

std::string debug_string() const;

void update_hashes_with_value(uint64_t* __restrict hashes,
Expand Down
1 change: 0 additions & 1 deletion be/src/vec/data_types/serde/data_type_object_serde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ Status DataTypeObjectSerDe::_write_column_to_mysql(const IColumn& column,
if (!variant.is_finalized()) {
const_cast<ColumnObject&>(variant).finalize();
}
RETURN_IF_ERROR(variant.sanitize());
if (variant.is_scalar_variant()) {
// Serialize scalar types, like int, string, array, faster path
const auto& root = variant.get_subcolumn({});
Expand Down

0 comments on commit cb3759e

Please sign in to comment.