Skip to content

AddAsColumn inefficiency #25

Description

@yb303

Hi,

This check, on every addition of an array to a column, is very expensive for enums:

//---- columns/array.cpp:
void ColumnArray::AppendAsColumn(ColumnRef array) {
    if (!data_->Type()->IsEqual(array->Type())) {
        throw std::runtime_error(...

//---- types/types.h:
bool IsEqual(const TypeRef& other) const { return this->GetName() == other->GetName(); }
                                                   -----^

EnumType::GetName() is walking a std::map, on every call, to generate the full enum description string: "A"=1, "B"=2, ...
I believe a 64 bit hash of whatever type info would make this comparison properly fast.

Thanks,
Yakov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions