Why does batch mode window aggregate yield arithmetic overflow?
Multiple commenters have been able to reproduce this issue. We initially thought that SQL Server 2017 CU10 resolved the issue, but then found that the error can be reproduced in all versions of SQL Server we tried, including CU10. However, some commenters observed an element of chance where the same script did not always trigger the error.

Because there is no logical way that computing a sum across a set of non-negative numbers whose maximum possible sum is 1,500 can overflow a 32 bit integer, we believe this is a bug in the batch mode window aggregate operator. Being a new operator in SQL Server 2016, it's reasonable to assume that there might still be some edge cases to iron out.

Here is the bug report we filed with Microsoft.

The response was:


  This is fixed in SQL Server 2019 CTP 2.1 and will also be fixed soon in Azure SQL Database.