asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject asterixdb git commit: ASTERIXDB-1918: support scientific math representation.
Date Thu, 25 May 2017 17:00:30 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 639fe8cb3 -> 144453b3d


ASTERIXDB-1918: support scientific math representation.

Change-Id: Ic0b6661416751a82a552cebc6248596b4eeff500
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1777
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/144453b3
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/144453b3
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/144453b3

Branch: refs/heads/master
Commit: 144453b3dd2a603af326936b46032c0b8f8c48d5
Parents: 639fe8c
Author: Yingyi Bu <yingyi@couchbase.com>
Authored: Wed May 24 14:34:46 2017 -0700
Committer: Yingyi Bu <buyingyi@gmail.com>
Committed: Thu May 25 10:00:10 2017 -0700

----------------------------------------------------------------------
 .../numeric/scientific/scientific.1.query.aql   | 21 ++++++++++++++++
 .../numeric/scientific/scientific.1.query.sqlpp | 21 ++++++++++++++++
 .../scientific_error.1.query.sqlpp              | 25 ++++++++++++++++++++
 .../scientific_error.2.query.sqlpp              | 25 ++++++++++++++++++++
 .../results/numeric/scientific/scientific.1.adm |  1 +
 .../src/test/resources/runtimets/testsuite.xml  |  5 ++++
 .../resources/runtimets/testsuite_sqlpp.xml     | 12 ++++++++++
 .../asterix-lang-aql/src/main/javacc/AQL.jj     |  6 ++---
 .../asterix-lang-sqlpp/src/main/javacc/SQLPP.jj |  5 ++--
 9 files changed, 116 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/144453b3/asterixdb/asterix-app/src/test/resources/runtimets/queries/numeric/scientific/scientific.1.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/numeric/scientific/scientific.1.query.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/numeric/scientific/scientific.1.query.aql
new file mode 100644
index 0000000..d668b0b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/numeric/scientific/scientific.1.query.aql
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+[2e5, 2e-5, .2e2, .2e-2, 0.5e3, 0.5e-3, 3.2e5, 3.2e-5]
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/144453b3/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/scientific/scientific.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/scientific/scientific.1.query.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/scientific/scientific.1.query.sqlpp
new file mode 100644
index 0000000..d668b0b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/scientific/scientific.1.query.sqlpp
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+[2e5, 2e-5, .2e2, .2e-2, 0.5e3, 0.5e-3, 3.2e5, 3.2e-5]
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/144453b3/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/scientific_error/scientific_error.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/scientific_error/scientific_error.1.query.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/scientific_error/scientific_error.1.query.sqlpp
new file mode 100644
index 0000000..551e394
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/scientific_error/scientific_error.1.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// This test makes sure the error message of undefined variable is still correct.
+
+WITH t AS 10
+
+SELECT t-e-10
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/144453b3/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/scientific_error/scientific_error.2.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/scientific_error/scientific_error.2.query.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/scientific_error/scientific_error.2.query.sqlpp
new file mode 100644
index 0000000..3f14a0e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/numeric/scientific_error/scientific_error.2.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// This test makes sure the error message of undefined variable is still correct.
+
+WITH t AS 10
+
+SELECT e-10
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/144453b3/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/scientific/scientific.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/scientific/scientific.1.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/scientific/scientific.1.adm
new file mode 100644
index 0000000..f65c2fe
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/numeric/scientific/scientific.1.adm
@@ -0,0 +1 @@
+[ 200000.0, 2.0E-5, 20.0, 0.002, 500.0, 5.0E-4, 320000.0, 3.2E-5 ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/144453b3/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
index 83d5581..e2070c0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -4527,6 +4527,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="numeric">
+      <compilation-unit name="scientific">
+        <output-dir compare="Text">scientific</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="numeric">
       <compilation-unit name="subtract_double">
         <output-dir compare="Text">subtract_double</output-dir>
       </compilation-unit>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/144453b3/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 29917d4..f9ae2fa 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -4572,6 +4572,18 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="numeric">
+      <compilation-unit name="scientific">
+        <output-dir compare="Text">scientific</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="numeric">
+      <compilation-unit name="scientific_error">
+        <output-dir compare="Text">none</output-dir>
+        <expected-error>Cannot find dataset e in dataverse Default nor an alias with
name e</expected-error>
+        <expected-error>Cannot find dataset e in dataverse Default nor an alias with
name e</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="numeric">
       <compilation-unit name="sign">
         <output-dir compare="Text">sign</output-dir>
       </compilation-unit>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/144453b3/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj b/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
index b92805b..8170eab 100644
--- a/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
+++ b/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
@@ -2812,9 +2812,9 @@ TOKEN :
 <DEFAULT,IN_DBL_BRACE>
 TOKEN:
 {
-    < DOUBLE_LITERAL: <DIGITS>
-        | <DIGITS> ( "." <DIGITS> )?
-        | "." <DIGITS>
+    < DOUBLE_LITERAL: <DIGITS> ( "." <DIGITS> ) (("e"|"E") ("-")? <DIGITS>)?
+                          | <DIGITS> (("e"|"E") ("-")? <DIGITS>)
+                          | "." <DIGITS> (("e"|"E") ("-")? <DIGITS>)?
     >
   | < FLOAT_LITERAL: <DIGITS> ( "f" | "F" )
         | <DIGITS> ( "." <DIGITS> ( "f" | "F" ) )?

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/144453b3/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index 69bfbc5..ce81a91 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -3332,8 +3332,9 @@ TOKEN :
 <DEFAULT,IN_DBL_BRACE>
 TOKEN:
 {
-    < DOUBLE_LITERAL: <DIGITS> ( "." <DIGITS> )
-                      | "." <DIGITS>
+    < DOUBLE_LITERAL: <DIGITS> ( "." <DIGITS> ) (("e"|"E") ("-")? <DIGITS>)?
+                      | <DIGITS> (("e"|"E") ("-")? <DIGITS>)
+                      | "." <DIGITS> (("e"|"E") ("-")? <DIGITS>)?
     >
   | < FLOAT_LITERAL:  <DIGITS> ( "f" | "F" )
                       | <DIGITS> ( "." <DIGITS> ( "f" | "F" ) )?


Mime
View raw message