[jira] [Commented] (ASTERIXDB-2460) Sum does not calculate overflow correctly

2018-11-06 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/ASTERIXDB-2460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16677151#comment-16677151
 ] 

ASF subversion and git services commented on ASTERIXDB-2460:


Commit 5af85d9ed157ad6f942712ea5e6108ea3f1544e0 in asterixdb's branch 
refs/heads/master from [~HussainHT]
[ https://git-wip-us.apache.org/repos/asf?p=asterixdb.git;h=5af85d9 ]

[ASTERIXDB-2460][FUN] Fix sum() overflow bug

- user model changes: yes
- storage format changes: no
- interface changes: no

Details:
- Fixed the sum() overflow problem. Now the sum() function will
return either bigint or double based on the input types.

- Added sum() aggregate local, intermediate and global classes.
Currently, it is using the same class for the three steps and
checking the type using an if statement. Although the three
steps all have a very similar behavior, having them in split
classes makes it cleaner and easier to read and maintain in the
future.

- Added sum() aggregate local, intermediate and global for serialized
classes.

- Added sum() and serial sum() test cases and modified test cases
to cause the reported overflow issue.

- Added sum() and serial sum() test cases that cause a
Long.MAX_VALUE type overflow.

- Valid data type check is now part of the sum calculation to
avoid redundant steps.

Change-Id: I987417770b3bfbda6af29a27acc8c96dc8a99eb8
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3012
Tested-by: Jenkins 
Contrib: Jenkins 
Integration-Tests: Jenkins 
Reviewed-by: Dmitry Lychagin 


> Sum does not calculate overflow correctly
> -
>
> Key: ASTERIXDB-2460
> URL: https://issues.apache.org/jira/browse/ASTERIXDB-2460
> Project: Apache AsterixDB
>  Issue Type: Bug
>  Components: FUN - Functions
>Reporter: James Fang
>Assignee: Hussain Towaileb
>Priority: Major
>
> Overflow is not calculated correctly in the sum function.
> Query:
> array_sum( [ int8("48"), int8("48"), int8("48")]);
> Result:
> -112



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (ASTERIXDB-2460) Sum does not calculate overflow correctly

2018-10-26 Thread Till (JIRA)


[ 
https://issues.apache.org/jira/browse/ASTERIXDB-2460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16665518#comment-16665518
 ] 

Till commented on ASTERIXDB-2460:
-

If all arguments are integer values the result of sum should be bigint.
If at least one argument is of a floating point type, the result should be 
double.

> Sum does not calculate overflow correctly
> -
>
> Key: ASTERIXDB-2460
> URL: https://issues.apache.org/jira/browse/ASTERIXDB-2460
> Project: Apache AsterixDB
>  Issue Type: Bug
>  Components: FUN - Functions
>Reporter: James Fang
>Assignee: Hussain Towaileb
>Priority: Major
>
> Overflow is not calculated correctly in the sum function.
> Query:
> array_sum( [ int8("48"), int8("48"), int8("48")]);
> Result:
> -112



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)