Added fix for issue 289, with a test case.
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@1454 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/data/custord-tiny/customer-tiny-neg.adm b/asterix-app/data/custord-tiny/customer-tiny-neg.adm
new file mode 100644
index 0000000..4e8e9ab
--- /dev/null
+++ b/asterix-app/data/custord-tiny/customer-tiny-neg.adm
@@ -0,0 +1,10 @@
+{ "cid": 4440, "name": "Renea Lavelett", "age": 72, "address": { "number": 8963, "street": "Oak St.", "city": "Mountain View" }, "lastorder": { "oid": 20520, "total": 6.198883E-4f } }
+{ "cid": 530, "name": "Clint Coil", "age": 79, "address": { "number": 4491, "street": "7th St.", "city": "San Jose" }, "lastorder": { "oid": 530, "total": 7.5879574f } }
+{ "cid": 76, "name": "Marvella Loud", "age": 72, "address": { "number": 6988, "street": "7th St.", "city": "Sunnyvale" }, "lastorder": { "oid": 76, "total": 12.811708f } }
+{ "cid": 586, "name": "Tamie Pollara", "age": 89, "address": { "number": 7424, "street": "Oak St.", "city": "Sunnyvale" }, "lastorder": { "oid": 586, "total": 22.163845f } }
+{ "cid": 59, "name": "Lance Pracht", "age": 27, "address": { "number": 342, "street": "Washington St.", "city": "Mountain View" }, "lastorder": { "oid": 59, "total": 26.975239f } }
+{ "cid": 939, "name": "Larry Gothier", "age": 34, "address": { "number": 1786, "street": "Park St.", "city": "Mountain View" }, "lastorder": { "oid": 939, "total": 33.49055f } }
+{ "cid": 996, "name": "Obdulia Dicosmo", "age": 14, "address": { "number": 9237, "street": "Cedar St.", "city": "Los Angeles" }, "lastorder": { "oid": 996, "total": 94.23889f } }
+{ "cid": 953, "name": "Elias Leonardo", "age": 62, "address": { "number": 7831, "street": "Main St.", "city": "San Jose" }, "lastorder": { "oid": 953, "total": 79.990875f } }
+{ "cid": 74, "name": "Myrtice Cubias", "age": 11, "address": { "number": 9048, "street": "Park St.", "city": "San Jose" }, "lastorder": { "oid": 74, "total": 47.675938f } }
+{ "cid": 758, "name": "Curt Savage", "age": 81, "address": { "number": 5651, "street": "Main St.", "city": "Seattle" }, "lastorder": { "oid": 758, "total": 45.33596f } }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.1.ddl.aql
new file mode 100644
index 0000000..b9683dd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.1.ddl.aql
@@ -0,0 +1,29 @@
+/*
+ * Description : Load dataset with float numbers containing "E-4f"
+ * Expected Res : Success
+ * Date : 01 Apr 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type AddressType as open {
+ number: int32,
+ street: string,
+ city: string
+}
+
+create type CustomerType as closed {
+ cid: int32,
+ name: string,
+ age: int32?,
+ address: AddressType?,
+ lastorder: {
+ oid: int32,
+ total: float
+ }
+}
+
+create dataset Customers(CustomerType)
+primary key cid;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.2.update.aql
new file mode 100644
index 0000000..f0671ca
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.2.update.aql
@@ -0,0 +1,11 @@
+/*
+ * Description : Load dataset with float numbers containing "E-4f"
+ * Expected Res : Success
+ * Date : 01 Apr 2013
+ */
+
+use dataverse test;
+
+load dataset Customers
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/custord-tiny/customer-tiny-neg.adm"),("format"="adm")) pre-sorted;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.3.query.aql
new file mode 100644
index 0000000..1d2c9b6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : Load dataset with float numbers containing "E-4f"
+ * Expected Res : Success
+ * Date : 01 Apr 2013
+ */
+
+use dataverse test;
+
+count(
+for $l in dataset('Customers')
+return $l
+)
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/load/issue289_query/issue289_query.1.adm b/asterix-app/src/test/resources/runtimets/results/load/issue289_query/issue289_query.1.adm
new file mode 100644
index 0000000..9a03714
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/load/issue289_query/issue289_query.1.adm
@@ -0,0 +1 @@
+10
\ 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 a883531..7e3a0c4 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -3911,6 +3911,11 @@
<expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
</compilation-unit>
</test-case>
+ <test-case FilePath="load">
+ <compilation-unit name="issue289_query">
+ <output-dir compare="Text">issue289_query</output-dir>
+ </compilation-unit>
+ </test-case>
</test-group>
<test-group name="hints">
<test-case FilePath="hints">
diff --git a/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/rules/RulePartial.java b/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/rules/RulePartial.java
index 89caf4f..045df58 100644
--- a/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/rules/RulePartial.java
+++ b/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/rules/RulePartial.java
@@ -61,8 +61,10 @@
public String javaMatch(String action) {
StringBuilder result = new StringBuilder();
result.append("if (parse_" + partialName + "(currentChar)==TOKEN_" + partialName + "){");
+ result.append("currentChar = buffer[bufpos];");
result.append(action);
result.append("}");
+ result.append("else { currentChar = buffer[bufpos];}");
return result.toString();
}