Skip to content

Commit

Permalink
fixed_width: Fix linker errors
Browse files Browse the repository at this point in the history
  • Loading branch information
felipecrv committed May 2, 2024
1 parent 56a8b40 commit 0034a04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
14 changes: 5 additions & 9 deletions cpp/src/arrow/util/fixed_width_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ bool IsFixedWidthLike(const ArraySpan& source, bool force_null_count,
});
}

namespace internal {

int64_t FixedWidthInBytesFallback(const FixedSizeListType& fixed_size_list_type) {
static int64_t FixedWidthInBytesFallback(const FixedSizeListType& fixed_size_list_type) {
auto* fsl = &fixed_size_list_type;
int64_t list_size = fsl->list_size();
for (auto type = fsl->value_type().get();;) {
Expand All @@ -62,8 +60,6 @@ int64_t FixedWidthInBytesFallback(const FixedSizeListType& fixed_size_list_type)
return -1;
}

} // namespace internal

int64_t FixedWidthInBytes(const DataType& type) {
auto type_id = type.id();
if (is_fixed_width(type_id)) {
Expand All @@ -72,7 +68,7 @@ int64_t FixedWidthInBytes(const DataType& type) {
}
if (type_id == Type::FIXED_SIZE_LIST) {
auto& fsl = ::arrow::internal::checked_cast<const FixedSizeListType&>(type);
return internal::FixedWidthInBytesFallback(fsl);
return FixedWidthInBytesFallback(fsl);
}
return -1;
}
Expand Down Expand Up @@ -148,6 +144,8 @@ Status PreallocateFixedWidthArrayData(::arrow::compute::KernelContext* ctx,
return Status::Invalid("PreallocateFixedWidthArrayData: Invalid type: ", *type);
}

} // namespace internal

/// \pre same as OffsetPointerOfFixedWidthValues
/// \pre source.type->id() != Type::BOOL
static const uint8_t* OffsetPointerOfFixedWidthValuesFallback(const ArraySpan& source) {
Expand Down Expand Up @@ -181,8 +179,6 @@ static const uint8_t* OffsetPointerOfFixedWidthValuesFallback(const ArraySpan& s
return value_width < 0 ? nullptr : array->GetValues<uint8_t>(1, offset_in_bytes);
}

} // namespace internal

const uint8_t* OffsetPointerOfFixedWidthValues(const ArraySpan& source) {
auto type_id = source.type->id();
if (is_fixed_width(type_id)) {
Expand All @@ -194,7 +190,7 @@ const uint8_t* OffsetPointerOfFixedWidthValues(const ArraySpan& source) {
}
return source.GetValues<uint8_t>(1, 0) + source.offset * source.type->byte_width();
}
return internal::OffsetPointerOfFixedWidthValuesFallback(source);
return OffsetPointerOfFixedWidthValuesFallback(source);
}

/// \brief Get the mutable pointer to the fixed-width values of an array
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/util/fixed_width_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,14 @@ inline bool IsFixedWidthLike(const ArraySpan& source, bool force_null_count,
/// \return The fixed-byte width of the values or -1 if the type is BOOL or not
/// fixed-width like. 0 is a valid return value as fixed-size-lists
/// and fixed-size-binary with size 0 are allowed.
int64_t FixedWidthInBytes(const DataType& type);
ARROW_EXPORT int64_t FixedWidthInBytes(const DataType& type);

/// \brief Get the fixed-width in bits of a type if it is a fixed-width like
/// type.
///
/// \return The bit-width of the values or -1
/// \see FixedWidthInBytes
int64_t FixedWidthInBits(const DataType& type);
ARROW_EXPORT int64_t FixedWidthInBits(const DataType& type);

namespace internal {

Expand Down Expand Up @@ -291,7 +291,7 @@ ARROW_EXPORT Status PreallocateFixedWidthArrayData(::arrow::compute::KernelConte
/// is_fixed_width(*mutable_array->type) SHOULD be true
/// \return The pointer to the fixed-width values of an array or NULLPTR
/// if pre-conditions are not satisfied.
const uint8_t* OffsetPointerOfFixedWidthValues(const ArraySpan& source);
ARROW_EXPORT const uint8_t* OffsetPointerOfFixedWidthValues(const ArraySpan& source);

/// \brief Get the mutable pointer to the fixed-width values of an array
/// allocated by PreallocateFixedWidthArrayData.
Expand All @@ -302,6 +302,6 @@ const uint8_t* OffsetPointerOfFixedWidthValues(const ArraySpan& source);
/// is_fixed_width(*mutable_array->type) MUST be true
/// \return The mutable pointer to the fixed-width byte blocks of the array. If
/// pre-conditions are not satisfied, the return values is undefined.
uint8_t* MutableFixedWidthValuesPointer(ArrayData* mutable_array);
ARROW_EXPORT uint8_t* MutableFixedWidthValuesPointer(ArrayData* mutable_array);

} // namespace arrow::util

0 comments on commit 0034a04

Please sign in to comment.