Skip to content

Commit

Permalink
Fixes compilation failure of ArrowTensorT<string_view> with template …
Browse files Browse the repository at this point in the history
…specialization (#806)

Signed-off-by: lidongze0629 <[email protected]>
  • Loading branch information
lidongze0629 authored Jun 27, 2022
1 parent d229431 commit 7b5b144
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions modules/basic/ds/tensor.vineyard-mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,23 @@ class ITensor : public Object {
[[shared]] virtual const std::shared_ptr<arrow::Buffer> buffer() const = 0;
};

namespace detail {

template <typename T>
struct ArrowTensorType {
using type = arrow::NumericTensor<typename arrow::CTypeTraits<T>::ArrowType>;
};

template <>
struct ArrowTensorType<arrow::util::string_view> {
using type = void;
};

} // namespace detail

template <typename T>
class [[vineyard]] Tensor : public ITensor, public BareRegistered<Tensor<T>> {
using ArrowTensorT =
arrow::NumericTensor<typename arrow::CTypeTraits<T>::ArrowType>;
using ArrowTensorT = typename detail::ArrowTensorType<T>::type;

public:
/**
Expand Down Expand Up @@ -129,6 +142,7 @@ class [[vineyard]] Tensor : public ITensor, public BareRegistered<Tensor<T>> {
* arrow's Tensor.
*
*/
template <typename = std::enable_if<!std::is_void<ArrowTensorT>::value>>
[[shared]] const std::shared_ptr<ArrowTensorT> ArrowTensor() {
return std::make_shared<ArrowTensorT>(buffer_->Buffer(), shape());
}
Expand Down

0 comments on commit 7b5b144

Please sign in to comment.