You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@orc.apache.org by "Dongjoon Hyun (Jira)" <ji...@apache.org> on 2021/10/27 08:06:00 UTC
[jira] [Updated] (ORC-1008) Overflow detection code is incorrect in
IntegerColumnStatisticsImpl
[ https://issues.apache.org/jira/browse/ORC-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dongjoon Hyun updated ORC-1008:
-------------------------------
Fix Version/s: 1.6.12
1.7.1
> 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
> Assignee: Yiqun Zhang
> Priority: Major
> Fix For: 1.8.0, 1.7.1, 1.6.12
>
>
> {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)