Implemented fixes, including tests.

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_fix_issue_207@1007 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/resources/runtimets/queries/fuzzyjoin/dblp-aqlplus_2.aql b/asterix-app/src/test/resources/runtimets/queries/fuzzyjoin/dblp-aqlplus_2.aql
new file mode 100644
index 0000000..7bf7d5f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/fuzzyjoin/dblp-aqlplus_2.aql
@@ -0,0 +1,32 @@
+/*
+ * Description    : Tests that a proper error messags is returned for this scenario.
+ *                  Since we cannot statically know the type of the field 'title', the FuzzyEqRule
+ *                  cannot auto-inject a tokenizer, and hence we expect an error saying that we cannot
+ *                  scan over a string as if it were a collection.
+ *                  Guards against regression to issue 207.
+ * Success        : Yes
+ */
+
+drop dataverse fuzzyjoin if exists;
+create dataverse fuzzyjoin;
+use dataverse fuzzyjoin;
+
+create type DBLPType as open {
+  id: int32
+}
+
+create dataset DBLP(DBLPType) partitioned by key id;
+
+load dataset DBLP 
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/dblp-small/dblp-small.adm"),("format"="adm"));
+
+write output to nc1:'rttest/fuzzyjoin_dblp-aqlplus_2.adm';
+
+set simthreshold '.5f';
+
+for $dblp in dataset('DBLP')
+for $dblp2 in dataset('DBLP')
+where $dblp.title ~= $dblp2.title and $dblp.id < $dblp2.id
+order by $dblp.id, $dblp2.id
+return {'dblp': $dblp, 'dblp2': $dblp2}
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/field-access-on-open-field.aql b/asterix-app/src/test/resources/runtimets/queries/records/field-access-on-open-field.aql
new file mode 100644
index 0000000..2592c67
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/field-access-on-open-field.aql
@@ -0,0 +1,24 @@
+/*
+ * Description    : Tests whether a field access on an open field (statically of type ANY) succeeds.
+ *                  Guards against regression to issue 207.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TestType as open {
+  id : int32,
+  name : string
+}
+
+create dataset testds(TestType) partitioned by key id;
+
+insert into dataset testds({"id": 123, "name": "John Doe", "address": { "zip": 92617} });
+
+write output to nc1:"rttest/records_field-access-on-open-field.adm";
+
+for $l in dataset("testds")
+let $a := $l.address
+return $a.zip
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/fuzzyjoin/dblp-aqlplus_2.adm b/asterix-app/src/test/resources/runtimets/results/fuzzyjoin/dblp-aqlplus_2.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/fuzzyjoin/dblp-aqlplus_2.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/records/field-access-on-open-field.adm b/asterix-app/src/test/resources/runtimets/results/records/field-access-on-open-field.adm
new file mode 100644
index 0000000..d4edf93
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/field-access-on-open-field.adm
@@ -0,0 +1 @@
+92617
\ 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 145ef62..2d740be 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -1474,6 +1474,12 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
+      <compilation-unit name="dblp-aqlplus_2">
+        <output-file compare="Text">dblp-aqlplus_2.adm</output-file>
+        <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="fuzzyjoin">
       <compilation-unit name="dblp-csx-2_1">
         <output-file compare="Text">dblp-csx-2_1.adm</output-file>
       </compilation-unit>
@@ -2561,6 +2567,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="records">
+      <compilation-unit name="field-access-on-open-field">
+        <output-file compare="Text">field-access-on-open-field.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="records">
       <compilation-unit name="open-record-constructor_01">
         <output-file compare="Text">open-record-constructor_01.adm</output-file>
       </compilation-unit>