Skip to content

Commit

Permalink
Assume all ExtensionType builders inherit from their StorageType's Ar…
Browse files Browse the repository at this point in the history
…rayBuilder (#909)

Arrow has ExtensionType, ExtensionArray, and ExtensionScalar, but no such luck for ExtensionBuilder.

Propose an invariant:
Any Builder for an ExtensionType is a subclass of the Builder for its StorageType.

In support of KAT-2876
  • Loading branch information
danielmawhirter authored Feb 22, 2022
1 parent 64d1c08 commit 42d08d0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libsupport/include/katana/ArrowVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ VisitArrowCast(const arrow::Array& array) {

inline arrow::Type::type
GetArrowTypeID(const arrow::ArrayBuilder* builder) {
return builder->type()->id();
arrow::Type::type id = builder->type()->id();
if (id != arrow::Type::EXTENSION) {
return id;
}
const auto& ext = static_cast<const arrow::ExtensionType&>(*builder->type());
return ext.storage_type()->id();
}

template <typename T>
Expand Down

0 comments on commit 42d08d0

Please sign in to comment.