You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Yibo Cai (Jira)" <ji...@apache.org> on 2021/07/27 07:52:00 UTC
[jira] [Commented] (ARROW-13439) [C++] Unify BasicDecimal128 and
BasicDecimal256 classes
[ https://issues.apache.org/jira/browse/ARROW-13439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17387856#comment-17387856 ]
Yibo Cai commented on ARROW-13439:
----------------------------------
Looks it doesn't deserve the effort.
One possible approach is to derive BasicDecimal128 and 256 from a templated base class. It does reduces many common code. But the problem is I have to put all implementation code in header file, which is too big.
{code:cpp}
template <int BitWidth>
class BasicDecimal {
......
std::array<uint64_t, BidWidth/64> array_;
}
class BasicDecimal128 : public BasicDecimal<128> {
......
};
class BasicDecimal256 : public BasicDecimal<128> {
......
};
{code}
> [C++] Unify BasicDecimal128 and BasicDecimal256 classes
> -------------------------------------------------------
>
> Key: ARROW-13439
> URL: https://issues.apache.org/jira/browse/ARROW-13439
> Project: Apache Arrow
> Issue Type: Improvement
> Components: C++
> Reporter: Yibo Cai
> Assignee: Yibo Cai
> Priority: Major
> Fix For: 6.0.0
>
>
> BasicDecimal128 uses two dedicated int64 (higher, lower) to store the value. It's possible to use std::array<uint64, 2> to store the value, just like BasicDecimal256 does, and to unify the two classes.
> As decimal operations are quite expensive, guess this indirection won't cause performance loss.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)