Possible Reason for a Data Function Running on TERR Services To Produce Different Results Compared to Running on the Local TERR Engine or TERR engine on TIBCO Spotfire Statistics Services.
book
Article ID: KB0076804
calendar_today
Updated On:
Products
Versions
Spotfire Enterprise Runtime for R - Server Edition
1.2 and lower
Description
Data functions running on TERR service might not get executed as expected if the script contains code like the following which checks for the existence of objects in the environment:
myDataFrame[Column2 == par2 & Column1 == par1, ] : longer object length is not a multiple of shorter object length
Resolution
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) )
Issue/Introduction
This article explains a possible reason for getting different results when a data function is run on TERR Services versus when run on a local TERR engine or TERR engine on TIBCO Spotfire Statistics Services.