You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Wes McKinney (Jira)" <ji...@apache.org> on 2021/02/17 00:04:00 UTC

[jira] [Commented] (ARROW-11661) [C++] Compilation failure in arrow/scalar.cc on Xcode 8.3.3

    [ https://issues.apache.org/jira/browse/ARROW-11661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17285555#comment-17285555 ] 

Wes McKinney commented on ARROW-11661:
--------------------------------------

cc [~bkietz] 

> [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
>            Priority: Major
>
> 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)