[ 
https://issues.apache.org/jira/browse/ORC-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yiqun Zhang resolved ORC-1008.
------------------------------
    Fix Version/s: 1.8.0
       Resolution: Fixed

resolved via https://github.com/apache/orc/pull/917

> Overflow detection code is incorrect in IntegerColumnStatisticsImpl
> -------------------------------------------------------------------
>
>                 Key: ORC-1008
>                 URL: https://issues.apache.org/jira/browse/ORC-1008
>             Project: ORC
>          Issue Type: Bug
>          Components: C++, Java
>    Affects Versions: 1.6.0, 1.7.0, 1.8.0
>            Reporter: Yiqun Zhang
>            Priority: Major
>             Fix For: 1.8.0
>
>
> {code:java}
> void IntegerColumnStatisticsImpl::update(int64_t value, int repetitions) { 
>    _stats.updateMinMax(value); 
>   
>    if (_stats.hasSum()) { 
>      bool wasPositive = _stats.getSum() >= 0; 
>      _stats.setSum(value * repetitions + _stats.getSum()); 
>      if ((value >= 0) == wasPositive) { 
>        _stats.setHasSum((_stats.getSum() >= 0) == wasPositive); 
>      } 
>    } 
>  } 
> {code}
> A counter-example can easily be given
> Assume sum=1, update(std::numeric_limits<int64_t>::max(), 3);
> value * repetitions + _stats.getSum() is overflowed, but is still a positive 
> number : 9223372036854775806



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

Reply via email to