fix issue218
diff --git a/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218-2/query-issue218-2.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218-2/query-issue218-2.1.ddl.aql
new file mode 100644
index 0000000..257cbcf
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218-2/query-issue218-2.1.ddl.aql
@@ -0,0 +1,17 @@
+/*
+ * Description : This test case is to verify the fix for issue218
+ : https://code.google.com/p/asterixdb/issues/detail?id=218
+ * Expected Res : Success
+ * Date : 5th June 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+create function test.computeBonus($pbcRating,$salary)
+{
+ if ($pbcRating = 1) then
+ $salary * 0.25
+ else
+ $salary * 0.10
+}
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218-2/query-issue218-2.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218-2/query-issue218-2.2.update.aql
new file mode 100644
index 0000000..c5732be
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218-2/query-issue218-2.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description : This test case is to verify the fix for issue218
+ : https://code.google.com/p/asterixdb/issues/detail?id=218
+ * Expected Res : Success
+ * Date : 5th June 2013
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218-2/query-issue218-2.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218-2/query-issue218-2.3.query.aql
new file mode 100644
index 0000000..ee6a31e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218-2/query-issue218-2.3.query.aql
@@ -0,0 +1,8 @@
+/*
+ * Description : This test case is to verify the fix for issue218
+ : https://code.google.com/p/asterixdb/issues/detail?id=218
+ * Expected Res : Success
+ * Date : 5th June 2013
+ */
+
+test.computeBonus(-1,-1);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218/query-issue218.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218/query-issue218.1.ddl.aql
new file mode 100644
index 0000000..c5732be
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218/query-issue218.1.ddl.aql
@@ -0,0 +1,6 @@
+/*
+ * Description : This test case is to verify the fix for issue218
+ : https://code.google.com/p/asterixdb/issues/detail?id=218
+ * Expected Res : Success
+ * Date : 5th June 2013
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218/query-issue218.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218/query-issue218.2.update.aql
new file mode 100644
index 0000000..c5732be
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218/query-issue218.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description : This test case is to verify the fix for issue218
+ : https://code.google.com/p/asterixdb/issues/detail?id=218
+ * Expected Res : Success
+ * Date : 5th June 2013
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218/query-issue218.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218/query-issue218.3.query.aql
new file mode 100644
index 0000000..3938b75
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/query-issue218/query-issue218.3.query.aql
@@ -0,0 +1,13 @@
+/*
+ * Description : This test case is to verify the fix for issue218
+ : https://code.google.com/p/asterixdb/issues/detail?id=218
+ * Expected Res : Success
+ * Date : 5th June 2013
+ */
+
+let $a:= let $temp:=1
+ return (
+ let $z:=$temp
+ return $z
+ )
+return $a
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/user-defined-functions/query-issue218-2/query-issue218-2.1.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/query-issue218-2/query-issue218-2.1.adm
new file mode 100644
index 0000000..b5135a2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/query-issue218-2/query-issue218-2.1.adm
@@ -0,0 +1 @@
+-0.1
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/user-defined-functions/query-issue218/query-issue218.1.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/query-issue218/query-issue218.1.adm
new file mode 100644
index 0000000..56a6051
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/query-issue218/query-issue218.1.adm
@@ -0,0 +1 @@
+1
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index d6c6733..01301a5 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -4033,6 +4033,16 @@
</test-case>
</test-group>
<test-group name="user-defined-functions">
+ <test-case FilePath="user-defined-functions">
+ <compilation-unit name="query-issue218-2">
+ <output-dir compare="Text">query-issue218-2</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="user-defined-functions">
+ <compilation-unit name="query-issue218">
+ <output-dir compare="Text">query-issue218</output-dir>
+ </compilation-unit>
+ </test-case>
<test-case FilePath="user-defined-functions">
<compilation-unit name="query-issue201">
<output-dir compare="Text">query-issue201</output-dir>