You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Mingyu Zhong (Jira)" <ji...@apache.org> on 2020/09/03 22:52:00 UTC

[jira] [Created] (ARROW-9913) Outputs of Decimal128::FromString depend on presence of one another

Mingyu Zhong created ARROW-9913:
-----------------------------------

             Summary: Outputs of Decimal128::FromString depend on presence of one another
                 Key: ARROW-9913
                 URL: https://issues.apache.org/jira/browse/ARROW-9913
             Project: Apache Arrow
          Issue Type: Bug
          Components: C++
            Reporter: Mingyu Zhong
            Assignee: Mingyu Zhong


[This block|[https://github.com/apache/arrow/blame/bfac60dd73bffa5f7bcefc890486268036182278/cpp/src/arrow/util/decimal.cc#L365-L373]] in Decimal128::FromString makes *out depend on whether scale is null, and makes *scale depend on whether out is null. For example, given an input "1e2",
 # if out is not null and scale is not null, then *out is 1
 # if out is null and scale is not null, then *scale is -2
 # if neither out nor scale is null, then *out is 100 and *scale is 0

It is very counter-intuitive that when an additional output-only pointer is given for receiving extra info, it alters the value of another output.

Similarly, *precision is also affected by presence of out and scale.

The block of adjustment was added in [https://github.com/apache/arrow/commit/bfac60dd73bffa5f7bcefc890486268036182278] for preventing negative scale output (https://issues.apache.org/jira/browse/ARROW-2177). While the motivation looks reasonable, the change is not sufficient (see case #2 above).

I think we should make the outputs independent of one-another. For the input "1e2", *out should be 100 if out is not null, and *scale should be 0 if scale is not null.



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