[refactor](column) remove get_data_type in IColumn (#25242)

This commit is contained in:
lihangyu
2023-10-10 20:27:15 +08:00
committed by GitHub
parent 62a6b132be
commit 913282b29b
15 changed files with 2 additions and 48 deletions

View File

@ -148,11 +148,6 @@ public:
virtual void set_rowset_segment_id(std::pair<RowsetId, uint32_t> rowset_segment_id) {}
virtual std::pair<RowsetId, uint32_t> get_rowset_segment_id() const { return {}; }
// todo(Amory) from column to get data type is not correct ,column is memory data,can not to assume memory data belong to which data type
virtual TypeIndex get_data_type() const {
LOG(FATAL) << "Cannot get_data_type() column " << get_name();
__builtin_unreachable();
}
/// Returns number of values in column.
virtual size_t size() const = 0;

View File

@ -127,7 +127,6 @@ public:
const char* get_family_name() const override { return "Array"; }
bool is_column_array() const override { return true; }
bool can_be_inside_nullable() const override { return true; }
TypeIndex get_data_type() const override { return TypeIndex::Array; }
MutableColumnPtr clone_resized(size_t size) const override;
size_t size() const override;
void resize(size_t n) override;

View File

@ -127,10 +127,6 @@ public:
LOG(FATAL) << "get_permutation not implemented";
}
[[noreturn]] TypeIndex get_data_type() const override {
LOG(FATAL) << "ColumnComplexType get_data_type not implemeted";
}
void get_indices_of_non_default_rows(IColumn::Offsets64& indices, size_t from,
size_t limit) const override {
LOG(FATAL) << "get_indices_of_non_default_rows not implemented";

View File

@ -95,8 +95,6 @@ public:
StringRef get_data_at(size_t) const override { return data->get_data_at(0); }
TypeIndex get_data_type() const override { return data->get_data_type(); }
UInt64 get64(size_t) const override { return data->get64(0); }
UInt64 get_uint(size_t) const override { return data->get_uint(0); }

View File

@ -229,8 +229,6 @@ public:
void replicate(const uint32_t* indexs, size_t target_size, IColumn& column) const override;
TypeIndex get_data_type() const override { return TypeId<T>::value; }
MutableColumns scatter(IColumn::ColumnIndex num_columns,
const IColumn::Selector& selector) const override {
return this->template scatter_impl<Self>(num_columns, selector);

View File

@ -114,10 +114,6 @@ public:
void reserve(size_t n) override { _codes.reserve(n); }
[[noreturn]] TypeIndex get_data_type() const override {
LOG(FATAL) << "ColumnDictionary get_data_type not implemeted";
}
const char* get_family_name() const override { return "ColumnDictionary"; }
[[noreturn]] MutableColumnPtr clone_resized(size_t size) const override {

View File

@ -200,8 +200,6 @@ public:
LOG(FATAL) << "not support";
}
TypeIndex get_data_type() const override { LOG(FATAL) << "get_data_type not supported"; }
ColumnPtr index(const IColumn& indexes, size_t limit) const override {
LOG(FATAL) << "index not supported";
}

View File

@ -77,7 +77,6 @@ public:
std::string get_name() const override;
const char* get_family_name() const override { return "Map"; }
TypeIndex get_data_type() const override { return TypeIndex::Map; }
void for_each_subcolumn(ColumnCallback callback) override {
callback(keys_column);

View File

@ -116,8 +116,6 @@ public:
Float64 get_float64(size_t n) const override { return nested_column->get_float64(n); }
StringRef get_data_at(size_t n) const override;
TypeIndex get_data_type() const override { return TypeIndex::Nullable; }
/// Will insert null value if pos=nullptr
void insert_data(const char* pos, size_t length) override;

View File

@ -84,21 +84,8 @@ size_t getNumberOfDimensions(const IDataType& type) {
}
DataTypePtr get_data_type_by_column(const IColumn& column) {
auto idx = column.get_data_type();
if (WhichDataType(idx).is_simple()) {
return DataTypeFactory::instance().create_data_type(idx);
}
if (WhichDataType(idx).is_nothing()) {
return std::make_shared<DataTypeNothing>();
}
if (const auto* column_array = check_and_get_column<ColumnArray>(&column)) {
return std::make_shared<DataTypeArray>(get_data_type_by_column(column_array->get_data()));
}
if (const auto* column_nullable = check_and_get_column<ColumnNullable>(&column)) {
return make_nullable(get_data_type_by_column(column_nullable->get_nested_column()));
}
// TODO add more types
assert(false);
// Removed in the future PR
// assert(false);
return nullptr;
}

View File

@ -266,8 +266,6 @@ public:
/// Part of interface
const char* get_family_name() const override { return "Variant"; }
TypeIndex get_data_type() const override { return TypeIndex::VARIANT; }
size_t size() const override;
MutableColumnPtr clone_resized(size_t new_size) const override;

View File

@ -585,8 +585,6 @@ public:
return shrinked_column;
}
TypeIndex get_data_type() const override { return TypeIndex::String; }
void get_indices_of_non_default_rows(Offsets64& indices, size_t from,
size_t limit) const override {
return get_indices_of_non_default_rows_impl<ColumnString>(indices, from, limit);

View File

@ -83,7 +83,6 @@ public:
std::string get_name() const override;
const char* get_family_name() const override { return "Struct"; }
TypeIndex get_data_type() const override { return TypeIndex::Struct; }
bool can_be_inside_nullable() const override { return true; }
MutableColumnPtr clone_empty() const override;
MutableColumnPtr clone_resized(size_t size) const override;

View File

@ -468,7 +468,6 @@ public:
void compare_internal(size_t rhs_row_id, const IColumn& rhs, int nan_direction_hint,
int direction, std::vector<uint8>& cmp_res,
uint8* __restrict filter) const override;
TypeIndex get_data_type() const override { return TypeId<T>::value; }
void get_indices_of_non_default_rows(IColumn::Offsets64& indices, size_t from,
size_t limit) const override {
return this->template get_indices_of_non_default_rows_impl<Self>(indices, from, limit);

View File

@ -459,10 +459,6 @@ public:
LOG(FATAL) << "append_data_by_selector is not supported in PredicateColumnType!";
}
[[noreturn]] TypeIndex get_data_type() const override {
LOG(FATAL) << "PredicateColumnType get_data_type not implemeted";
}
Status filter_by_selector(const uint16_t* sel, size_t sel_size, IColumn* col_ptr) override {
ColumnType* column = assert_cast<ColumnType*>(col_ptr);
// DateV1 and DateTimeV1 is special, its storage format is different from compute format