diff --git a/com.oracle.truffle.r.test/tests/pgsql/QuerySideEffectWithFreeVars.R b/com.oracle.truffle.r.test/tests/pgsql/QuerySideEffectWithFreeVars.R new file mode 100644 index 0000000000000000000000000000000000000000..eb9b872a57e2aab8d06dbb978961e0bfc51d3c5f --- /dev/null +++ b/com.oracle.truffle.r.test/tests/pgsql/QuerySideEffectWithFreeVars.R @@ -0,0 +1,17 @@ +conv = function (a) a * 89.0 / 100.0 +emp = new.tableRef("emp", "PostgreSQL", "postgre.config", "public") +minsalary = 2500.0 +q = query.select(function (x) { + res = new.env() + res$empno = x$empno + res$ename = x$ename + res$salary = (function (dol){ + a = dol * 89.0 / 100.0 + while (a > 1000.0) a = conv(a) + a + })(x$sal) + res }, + query.where(function (x) x$sal >= minsalary, + query.from(emp))) +results = query.force(q) +print(results) diff --git a/com.oracle.truffle.r.test/tests/pgsql/QuerySideEffectWithFreeVars.out b/com.oracle.truffle.r.test/tests/pgsql/QuerySideEffectWithFreeVars.out new file mode 100644 index 0000000000000000000000000000000000000000..ae30189ca424eb38b87f5bc998d4383ccd07a1c2 --- /dev/null +++ b/com.oracle.truffle.r.test/tests/pgsql/QuerySideEffectWithFreeVars.out @@ -0,0 +1,7 @@ + ename empno salary +1 SMITH 1 984.1472014255202 +2 WARD 3 908.9094161734163 +3 JONES 4 971.310575818447 +4 SCOTT 8 930.9438795980075 +5 ADAMS 11 978.2054933202209 +