When returning a number from a UDF function which is greater than 2,147,483,647 but less than long.MaxValue and bound to a Stream Analytics bigint type then the number is shown as a negative which indicates that the integer has been overflowed. This error does not happen when using the local or portal query tester.
The workaround we've used to return the value as a string. However, this behaviour does not match the documentation: https://docs.microsoft.com/en-us/azure/stream-analytics/stream-analytics-javascript-user-defined-functions#stream-analytics-and-javascript-type-conversion