The problem is due to a difference in how the local TERR and the TERR Service handle multiple data function jobs executed on the same session. Data Functions executed on a local TERR engine or TERR engine on TIBCO Spotfire Statistics Services are always executed in a clean environment since a new engine is started for each execution, however on the TERR Service the engine is reused (which can have performance benefits with multiple, smaller data function executions), leaving the potential for objects created by a previous data function call to be accessed by a later one.
In the example above, there are no issues when running the data function the first time, but the next call that comes in on that session will already have Column1, and this code does not re-initialize the vector properly which leads to the issue.
To resolve the issue currently, ensure you always initialize the array in your script, for example by changing the earlier line:
Column1 <- rep(0, length(Column2) )