From 42d08d0ad5e88ee62af8767b55d33722df50efa1 Mon Sep 17 00:00:00 2001 From: Daniel Mawhirter Date: Tue, 22 Feb 2022 11:14:57 -0600 Subject: [PATCH] Assume all ExtensionType builders inherit from their StorageType's ArrayBuilder (#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 --- libsupport/include/katana/ArrowVisitor.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libsupport/include/katana/ArrowVisitor.h b/libsupport/include/katana/ArrowVisitor.h index 1c196334d0..fca87a81da 100644 --- a/libsupport/include/katana/ArrowVisitor.h +++ b/libsupport/include/katana/ArrowVisitor.h @@ -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(*builder->type()); + return ext.storage_type()->id(); } template