[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.