Wes McKinney created ARROW-11661:
------------------------------------

             Summary: [C++] Compilation failure in arrow/scalar.cc on Xcode 
8.3.3 
                 Key: ARROW-11661
                 URL: https://issues.apache.org/jira/browse/ARROW-11661
             Project: Apache Arrow
          Issue Type: Bug
          Components: C++
            Reporter: Wes McKinney


See https://gist.github.com/wesm/e3b52381de1556f2af669c7e2458afd0

It seems that this template construct is not supported so robustly across older 
compilers:

{code}
// timestamp to string
Status CastImpl(const TimestampScalar& from, StringScalar* to) {
  to->value = FormatToBuffer(internal::StringFormatter<Int64Type>{}, from);
  return Status::OK();
}

// date to string
template <typename D>
Status CastImpl(const DateScalar<D>& from, StringScalar* to) {
  TimestampScalar ts({}, timestamp(TimeUnit::MILLI));
  RETURN_NOT_OK(CastImpl(from, &ts));
  return CastImpl(ts, to);
}

// string to any
template <typename ScalarType>
Status CastImpl(const StringScalar& from, ScalarType* to) {
  ARROW_ASSIGN_OR_RAISE(auto out,
                        Scalar::Parse(to->type, 
util::string_view(*from.value)));
  to->value = std::move(checked_cast<ScalarType&>(*out).value);
  return Status::OK();
}

// binary to string
Status CastImpl(const BinaryScalar& from, StringScalar* to) {
  to->value = from.value;
  return Status::OK();
}

// formattable to string
template <typename ScalarType, typename T = typename ScalarType::TypeClass,
          typename Formatter = internal::StringFormatter<T>,
          // note: Value unused but necessary to trigger SFINAE if Formatter is
          // undefined
          typename Value = typename Formatter::value_type>
Status CastImpl(const ScalarType& from, StringScalar* to) {
  to->value = FormatToBuffer(Formatter{from.type}, from);
  return Status::OK();
}
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to