From 8fa2f3ce261c5a951e7d48f52f8f35e6b3aa6474 Mon Sep 17 00:00:00 2001 From: Matthias Loibl Date: Thu, 31 Oct 2024 16:53:31 +0000 Subject: [PATCH] arrow-cast: Support FixedSizeBinary packing --- arrow-cast/src/cast/dictionary.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arrow-cast/src/cast/dictionary.rs b/arrow-cast/src/cast/dictionary.rs index ec0ab346f997..0a4d75c75ee0 100644 --- a/arrow-cast/src/cast/dictionary.rs +++ b/arrow-cast/src/cast/dictionary.rs @@ -325,6 +325,13 @@ pub(crate) fn cast_to_dictionary( } pack_byte_to_dictionary::>(array, cast_options) } + FixedSizeBinary(i32) => { + // If the input is a view type, we can avoid casting (thus copying) the data + if array.data_type() == &DataType::FixedSizeBinary(i32) { + return binary_view_to_dictionary::(array); + } + pack_byte_to_dictionary::>(array, cast_options) + } _ => Err(ArrowError::CastError(format!( "Unsupported output type for dictionary packing: {dict_value_type:?}" ))),