You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mrql.apache.org by fe...@apache.org on 2014/05/17 15:17:46 UTC
git commit: MRQL-34: Introduce junit for testing
Repository: incubator-mrql
Updated Branches:
refs/heads/master d7e16fd2f -> 38627c386
MRQL-34: Introduce junit for testing
Project: http://git-wip-us.apache.org/repos/asf/incubator-mrql/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mrql/commit/38627c38
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mrql/tree/38627c38
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mrql/diff/38627c38
Branch: refs/heads/master
Commit: 38627c38621693b441c9abc871f80363dc063fce
Parents: d7e16fd
Author: fegaras <fe...@cse.uta.edu>
Authored: Sat May 17 08:14:28 2014 -0500
Committer: fegaras <fe...@cse.uta.edu>
Committed: Sat May 17 08:14:28 2014 -0500
----------------------------------------------------------------------
bsp/pom.xml | 12 +
bsp/src/main/java/org/apache/mrql/BSPPlan.java | 2 +-
.../apache/mrql/BSPEvaluatorInMemoryTest.java | 43 +++
.../apache/mrql/BSPEvaluatorLocalModeTest.java | 60 +++++
.../org/apache/mrql/BSPQueryInMemoryTest.java | 43 +++
.../org/apache/mrql/BSPQueryLocalModeTest.java | 59 +++++
core/pom.xml | 16 ++
.../main/java/org/apache/mrql/BSPTranslator.gen | 2 +-
core/src/main/java/org/apache/mrql/Bag.java | 2 +-
core/src/main/java/org/apache/mrql/MRQL.java | 5 +-
core/src/main/java/org/apache/mrql/Printer.gen | 14 +-
.../java/org/apache/mrql/EvaluatorTest.java | 112 ++++++++
.../test/java/org/apache/mrql/QueryTest.java | 263 +++++++++++++++++++
mapreduce/pom.xml | 37 +--
.../java/org/apache/mrql/MapReduceEvaluator.gen | 2 +-
.../java/org/apache/mrql/MapReducePlan.java | 4 +-
.../mrql/MapReduceEvaluatorInMemoryTest.java | 44 ++++
.../mrql/MapReduceEvaluatorLocalModeTest.java | 60 +++++
.../apache/mrql/MapReduceQueryInMemoryTest.java | 46 ++++
.../mrql/MapReduceQueryLocalModeTest.java | 59 +++++
pom.xml | 22 ++
spark/pom.xml | 32 +--
.../java/org/apache/mrql/SparkEvaluator.gen | 2 +-
.../apache/mrql/SparkEvaluatorInMemoryTest.java | 43 +++
.../mrql/SparkEvaluatorLocalModeTest.java | 60 +++++
.../org/apache/mrql/SparkQueryInMemoryTest.java | 43 +++
.../apache/mrql/SparkQueryLocalModeTest.java | 60 +++++
tests/queries/distinct_1.mrql | 4 +-
tests/queries/factorization_1.mrql | 6 +-
tests/queries/group_by_1.mrql | 4 +-
tests/queries/group_by_having_1.mrql | 4 +-
tests/queries/group_by_order_by_1.mrql | 4 +-
tests/queries/group_by_order_by_2.mrql | 4 +-
tests/queries/join_group_by_1.mrql | 4 +-
tests/queries/join_group_by_2.mrql | 4 +-
tests/queries/join_group_by_3.mrql | 4 +-
tests/queries/join_order_by_1.mrql | 4 +-
tests/queries/joins_1.mrql | 4 +-
tests/queries/kmeans_1.mrql | 2 +-
tests/queries/loop_1.mrql | 16 +-
tests/queries/matrix_1.mrql | 8 +-
tests/queries/nested_select_1.mrql | 4 +-
tests/queries/order_by_1.mrql | 4 +-
tests/queries/pagerank_1.mrql | 2 +-
tests/queries/relational_join_1.mrql | 4 +-
tests/queries/total_aggregation_1.mrql | 4 +-
tests/queries/total_aggregation_2.mrql | 4 +-
tests/queries/user_aggregation_1.mrql | 2 +-
tests/queries/xml_1.mrql | 2 +-
tests/queries/xml_2.mrql | 2 +-
50 files changed, 1137 insertions(+), 110 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/bsp/pom.xml
----------------------------------------------------------------------
diff --git a/bsp/pom.xml b/bsp/pom.xml
index 0c07d7f..fee0a92 100644
--- a/bsp/pom.xml
+++ b/bsp/pom.xml
@@ -48,6 +48,18 @@
<artifactId>hama-core</artifactId>
<version>${hama.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.mrql</groupId>
+ <artifactId>mrql-core</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/bsp/src/main/java/org/apache/mrql/BSPPlan.java
----------------------------------------------------------------------
diff --git a/bsp/src/main/java/org/apache/mrql/BSPPlan.java b/bsp/src/main/java/org/apache/mrql/BSPPlan.java
index d85facd..942d69d 100644
--- a/bsp/src/main/java/org/apache/mrql/BSPPlan.java
+++ b/bsp/src/main/java/org/apache/mrql/BSPPlan.java
@@ -412,7 +412,7 @@ final public class BSPPlan extends Plan {
split_size = (long)Math.ceil((double)split_size*1.01);
} while (tasks > Config.nodes);
job.setNumBspTask(tasks);
- System.out.println("Using "+tasks+" BSP tasks (out of a max "+Config.nodes+")."
+ System.err.println("Using "+tasks+" BSP tasks (out of a max "+Config.nodes+")."
+" Each task will handle about "+Math.min(total_size/Config.nodes,split_size)
+" bytes of input data.");
job.set("bsp.min.split.size",Long.toString(split_size));
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/bsp/src/test/java/org/apache/mrql/BSPEvaluatorInMemoryTest.java
----------------------------------------------------------------------
diff --git a/bsp/src/test/java/org/apache/mrql/BSPEvaluatorInMemoryTest.java b/bsp/src/test/java/org/apache/mrql/BSPEvaluatorInMemoryTest.java
new file mode 100644
index 0000000..6b829a2
--- /dev/null
+++ b/bsp/src/test/java/org/apache/mrql/BSPEvaluatorInMemoryTest.java
@@ -0,0 +1,43 @@
+/**
+ * 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.
+ */
+package org.apache.mrql;
+
+import org.apache.hadoop.conf.Configuration;
+
+public class BSPEvaluatorInMemoryTest extends EvaluatorTest {
+
+ @Override
+ protected Evaluator createEvaluator() throws Exception {
+ Configuration conf = null;
+
+ Config.bsp_mode = true;
+ Config.spark_mode = false;
+ Config.map_reduce_mode = false;
+
+ Evaluator.evaluator = new BSPEvaluator();
+
+ Config.quiet_execution = true;
+ Config.hadoop_mode = false;
+ Config.testing = true;
+ Config.parse_args(new String[] { "-bsp" }, conf);
+
+ Evaluator.evaluator.init(conf);
+
+ return Evaluator.evaluator;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/bsp/src/test/java/org/apache/mrql/BSPEvaluatorLocalModeTest.java
----------------------------------------------------------------------
diff --git a/bsp/src/test/java/org/apache/mrql/BSPEvaluatorLocalModeTest.java b/bsp/src/test/java/org/apache/mrql/BSPEvaluatorLocalModeTest.java
new file mode 100644
index 0000000..5b3c138
--- /dev/null
+++ b/bsp/src/test/java/org/apache/mrql/BSPEvaluatorLocalModeTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+package org.apache.mrql;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.util.GenericOptionsParser;
+
+public class BSPEvaluatorLocalModeTest extends EvaluatorTest {
+
+ public void tearDown() throws IOException {
+ super.tearDown();
+ Plan.clean();
+ }
+
+ @Override
+ protected Evaluator createEvaluator() throws Exception {
+ Configuration conf = null;
+
+ Config.bsp_mode = true;
+ Config.spark_mode = false;
+ Config.map_reduce_mode = false;
+
+ Evaluator.evaluator = new BSPEvaluator();
+
+ Config.quiet_execution = true;
+
+ String[] args = new String[] { "-local", "-bsp" };
+
+ conf = Evaluator.evaluator.new_configuration();
+ GenericOptionsParser gop = new GenericOptionsParser(conf, args);
+ conf = gop.getConfiguration();
+
+ args = gop.getRemainingArgs();
+
+ Config.hadoop_mode = true;
+ Config.testing = true;
+ Config.parse_args(args, conf);
+
+ Evaluator.evaluator.init(conf);
+
+ return Evaluator.evaluator;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/bsp/src/test/java/org/apache/mrql/BSPQueryInMemoryTest.java
----------------------------------------------------------------------
diff --git a/bsp/src/test/java/org/apache/mrql/BSPQueryInMemoryTest.java b/bsp/src/test/java/org/apache/mrql/BSPQueryInMemoryTest.java
new file mode 100644
index 0000000..86815dc
--- /dev/null
+++ b/bsp/src/test/java/org/apache/mrql/BSPQueryInMemoryTest.java
@@ -0,0 +1,43 @@
+/**
+ * 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.
+ */
+package org.apache.mrql;
+
+import org.apache.hadoop.conf.Configuration;
+
+public class BSPQueryInMemoryTest extends QueryTest {
+ @Override
+ protected Evaluator createEvaluator() throws Exception {
+ Configuration conf = null;
+
+ Config.bsp_mode = true;
+ Config.spark_mode = false;
+ Config.map_reduce_mode = false;
+
+ Evaluator.evaluator = new BSPEvaluator();
+
+ Config.quiet_execution = true;
+ Config.hadoop_mode = false;
+ Config.testing = true;
+ Config.parse_args(new String[] { "-bsp" }, conf);
+
+ Evaluator.evaluator.init(conf);
+
+ return Evaluator.evaluator;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/bsp/src/test/java/org/apache/mrql/BSPQueryLocalModeTest.java
----------------------------------------------------------------------
diff --git a/bsp/src/test/java/org/apache/mrql/BSPQueryLocalModeTest.java b/bsp/src/test/java/org/apache/mrql/BSPQueryLocalModeTest.java
new file mode 100644
index 0000000..b461b6f
--- /dev/null
+++ b/bsp/src/test/java/org/apache/mrql/BSPQueryLocalModeTest.java
@@ -0,0 +1,59 @@
+/**
+ * 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.
+ */
+package org.apache.mrql;
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.util.GenericOptionsParser;
+
+public class BSPQueryLocalModeTest extends QueryTest {
+
+ public void tearDown() throws IOException {
+ super.tearDown();
+ Plan.clean();
+ }
+
+ @Override
+ protected Evaluator createEvaluator() throws Exception {
+ Configuration conf = new Configuration();
+
+ Config.bsp_mode = true;
+ Config.spark_mode = false;
+ Config.map_reduce_mode = false;
+
+ Evaluator.evaluator = new BSPEvaluator();
+
+ Config.quiet_execution = true;
+
+ String[] args = new String[] { "-local", "-bsp" };
+
+ conf = Evaluator.evaluator.new_configuration();
+ GenericOptionsParser gop = new GenericOptionsParser(conf, args);
+ conf = gop.getConfiguration();
+
+ args = gop.getRemainingArgs();
+
+ Config.hadoop_mode = true;
+ Config.testing = true;
+ Config.parse_args(args, conf);
+
+ Evaluator.evaluator.init(conf);
+
+ return Evaluator.evaluator;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index f9d447e..3c55f0b 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -75,6 +75,22 @@
</configuration>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.4</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ <configuration>
+ <finalName>mrql-tests-${project.version}</finalName>
+ <outputDirectory>${project.parent.basedir}/lib</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>de.jflex</groupId>
<artifactId>maven-jflex-plugin</artifactId>
<version>1.4.3</version>
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/core/src/main/java/org/apache/mrql/BSPTranslator.gen
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mrql/BSPTranslator.gen b/core/src/main/java/org/apache/mrql/BSPTranslator.gen
index e3d8cc4..417c04c 100644
--- a/core/src/main/java/org/apache/mrql/BSPTranslator.gen
+++ b/core/src/main/java/org/apache/mrql/BSPTranslator.gen
@@ -440,7 +440,7 @@ public class BSPTranslator extends TypeInference {
case GroupByJoin(`kx,`ky,lambda(`vx,`gx),lambda(`vy,`gy),`acc,`zero,`r,`x,`y,`o):
int n = (int)Math.floor(Math.sqrt(4.0*Config.nodes));
int m = n;
- System.out.println("Using a groupBy join on a "+n+"*"+m+" grid of partitions");
+ System.err.println("Using a groupBy join on a "+n+"*"+m+" grid of partitions");
Tree xkey = #<cmap(lambda(i,bag(tuple(call(plus,call(mod,call(hash_code,`gx),`m),call(times,`m,i)),
tuple(1,call(plus,call(mod,call(hash_code,`gx),`m),call(times,`m,i)),`vx)))),
range(0,`(n-1)))>;
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/core/src/main/java/org/apache/mrql/Bag.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mrql/Bag.java b/core/src/main/java/org/apache/mrql/Bag.java
index b092f30..7a8acec 100644
--- a/core/src/main/java/org/apache/mrql/Bag.java
+++ b/core/src/main/java/org/apache/mrql/Bag.java
@@ -570,7 +570,7 @@ public class Bag extends MRData implements Iterable<MRData> {
StringBuffer b = new StringBuffer("{ ");
int i = 0;
for ( MRData e: this )
- if ( i++ < Config.max_bag_size_print )
+ if ( i++ < Config.max_bag_size_print || Config.max_bag_size_print < 0 )
b.append(((i>1)?", ":"")+e);
else return b.append(", ... }").toString();
return b.append(" }").toString();
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/core/src/main/java/org/apache/mrql/MRQL.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mrql/MRQL.java b/core/src/main/java/org/apache/mrql/MRQL.java
index 7ba081e..9105588 100644
--- a/core/src/main/java/org/apache/mrql/MRQL.java
+++ b/core/src/main/java/org/apache/mrql/MRQL.java
@@ -37,8 +37,9 @@ final public class MRQL extends Interpreter {
*/
public static void evaluate ( String command ) {
try {
- MRQLParser parser = new MRQLParser();
- parser.setScanner(new MRQLLex(new StringReader(command)));
+ MRQLLex scanner = new MRQLLex(new StringReader(command));
+ MRQLParser parser = new MRQLParser(scanner);
+ parser.setScanner(scanner);
MRQLLex.reset();
parser.parse();
} catch (Exception x) {
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/core/src/main/java/org/apache/mrql/Printer.gen
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mrql/Printer.gen b/core/src/main/java/org/apache/mrql/Printer.gen
index d0d80da..b21d94a 100644
--- a/core/src/main/java/org/apache/mrql/Printer.gen
+++ b/core/src/main/java/org/apache/mrql/Printer.gen
@@ -193,9 +193,9 @@ public class Printer {
try {
if (x instanceof Inv)
return print(((Inv)x).value(),type);
- if (type.equals(#<XML>))
+ if (!Config.testing && type.equals(#<XML>))
return print_XML((Union)x);
- if (type.equals(#<JSON>))
+ if (!Config.testing && type.equals(#<JSON>))
return print_JSON((Union)x);
match TypeInference.expand(type) {
case persistent(`tp):
@@ -207,9 +207,10 @@ public class Printer {
if (vals.size() == 0)
return "{}";
String s = "{ "+print(vals.get(0),tp);
- for ( int i = 1; i < vals.size(); i++ )
+ for ( int i = 1; i < vals.size() && (Config.max_bag_size_print < 0
+ || i < Config.max_bag_size_print); i++ )
s += ", "+print(vals.get(i),tp);
- if (vals.size() == Config.max_bag_size_print)
+ if (Config.max_bag_size_print > 0 && vals.size() >= Config.max_bag_size_print)
return s+", ... }";
else return s+" }";
} else return print(x,#<bag(`tp)>);
@@ -220,9 +221,10 @@ public class Printer {
if (vals.size() == 0)
return "[]";
String s = "[ "+print(vals.get(0),tp);
- for ( int i = 1; i < vals.size(); i++ )
+ for ( int i = 1; i < vals.size() && (Config.max_bag_size_print < 0
+ || i < Config.max_bag_size_print); i++ )
s += ", "+print(vals.get(i),tp);
- if (vals.size() == Config.max_bag_size_print)
+ if (Config.max_bag_size_print > 0 && vals.size() >= Config.max_bag_size_print)
return s+", ... ]";
else return s+" ]";
} else return print(x,#<list(`tp)>);
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/core/src/test/java/org/apache/mrql/EvaluatorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/mrql/EvaluatorTest.java b/core/src/test/java/org/apache/mrql/EvaluatorTest.java
new file mode 100644
index 0000000..aad3150
--- /dev/null
+++ b/core/src/test/java/org/apache/mrql/EvaluatorTest.java
@@ -0,0 +1,112 @@
+/**
+ * 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.
+ */
+package org.apache.mrql;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import org.junit.BeforeClass;
+
+import junit.framework.TestCase;
+
+public abstract class EvaluatorTest extends TestCase {
+ abstract protected Evaluator createEvaluator() throws Exception;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ ClassImporter.load_classes();
+ new TopLevel();
+ }
+
+ public void setUp() throws Exception {
+ createEvaluator();
+ Translator.global_reset();
+ }
+
+ public void tearDown() throws IOException {
+ if (Config.compile_functional_arguments)
+ Compiler.clean();
+ Config.max_bag_size_print = -1;
+ if (Config.hadoop_mode) {
+ Plan.clean();
+ Evaluator.evaluator.shutdown(Plan.conf);
+ }
+ }
+
+ private MRData execute(String query) throws Exception {
+ evaluate("store ret := " + query);
+ return getVariable("ret");
+ }
+
+ private MRData getVariable(String name) {
+ return Interpreter.variable_lookup(name, Interpreter.global_env);
+ }
+
+ private void evaluate(String query) throws Exception {
+ MRQLParser parser = new MRQLParser(new MRQLLex(new StringReader(query)));
+ MRQLLex.reset();
+ parser.parse();
+ }
+
+ public void testCore1Array() throws Exception {
+ assertEquals(3, ((MR_int) execute("[1,2,3,4][2];")).get());
+ }
+
+ public void testCore1Range() throws Exception {
+ Bag result = ((Bag) execute("[1..1000][10:20];"));
+ assertEquals(0, result.size());
+ }
+
+ public void testCore1ArrayPlus() throws Exception {
+ Bag result = ((Bag) execute("[1,2]+[1,2,3];"));
+ assertEquals(5, result.size());
+ assertEquals(1, ((MR_int) result.get(0)).get());
+ assertEquals(2, ((MR_int) result.get(1)).get());
+ assertEquals(1, ((MR_int) result.get(2)).get());
+ assertEquals(2, ((MR_int) result.get(3)).get());
+ assertEquals(3, ((MR_int) result.get(4)).get());
+ }
+
+ public void testCore1TupleIndex() throws Exception {
+ assertEquals(1, ((MR_int) execute("{(\"a\",1),(\"b\",2)}[\"a\"];")).get());
+ }
+
+ public void testCore1Variable() throws Exception {
+ evaluate("store xx := Node(\"a\",{(\"x\",\"1\")},[Node(\"b\",{},[CData(\"text\")])]);");
+ MR_int result2 = (MR_int) execute("toInt(xx.@x)+1;");
+ assertEquals(2, result2.get());
+ }
+
+ public void testCore1Cast() throws Exception {
+ assertEquals(1L, ((MR_long) execute("1 as long;")).get());
+ assertEquals(1.0, ((MR_double) execute("1 as double;")).get());
+ }
+
+ public void testCore1Math() throws Exception {
+ assertEquals(1, ((MR_int) execute("min({1,2,3});")).get());
+ assertEquals(3.4F, ((MR_float) execute("max({1.2,3.4});")).get());
+
+ assertEquals((double) 1.0F, ((MR_double) execute("min({1.0 as double,4.8 as double});")).get());
+ assertEquals(3, ((MR_long) execute("count({1,2,3});")).get());
+
+ assertEquals(((double) 1.2F + (double) 3.4F), ((MR_double) execute("sum({1.2,3.4});")).get());
+ assertEquals(2.0, ((MR_double) execute("avg({1,2,3});")).get());
+ assertEquals(((double) 1.2F + (double) 3.4F) / 2, ((MR_double) execute("avg({1.2,3.4});")).get());
+ assertEquals(((double) 1.3F + (double) 4.8F) / 2, ((MR_double) execute("avg({1.3 as double,4.8 as double});")).get());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/core/src/test/java/org/apache/mrql/QueryTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/mrql/QueryTest.java b/core/src/test/java/org/apache/mrql/QueryTest.java
new file mode 100644
index 0000000..e389cec
--- /dev/null
+++ b/core/src/test/java/org/apache/mrql/QueryTest.java
@@ -0,0 +1,263 @@
+/**
+ * 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.
+ */
+package org.apache.mrql;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.BufferedReader;
+import java.io.FileReader;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.BeforeClass;
+
+public abstract class QueryTest extends TestCase {
+ private static String TEST_QUERY_DIR = "../tests/queries";
+ private static String TEST_RESULT_DIR = "../tests/results";
+ private File queryDir;
+ private File resultDir;
+ private static Evaluator evaluator;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ ClassImporter.load_classes();
+ new TopLevel();
+ }
+
+ public void setUp() throws Exception {
+ queryDir = new File(TEST_QUERY_DIR);
+ resultDir = new File(TEST_RESULT_DIR);
+ resultDir.mkdirs();
+
+ if(evaluator==null)
+ evaluator = createEvaluator();
+ Translator.global_reset();
+ }
+
+ public void tearDown() throws IOException {
+ if (Config.compile_functional_arguments)
+ Compiler.clean();
+ if (Config.hadoop_mode) {
+ Plan.clean();
+ Evaluator.evaluator.shutdown(Plan.conf);
+ }
+ }
+
+ abstract protected Evaluator createEvaluator() throws Exception;
+
+ public void testCore() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "core_1.mrql"), resultDir));
+ }
+
+ public void testDistinct() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "distinct_1.mrql"), resultDir));
+ }
+
+ public void testFactorization() throws Exception {
+ if (!Config.bsp_mode) // matrix factorization needs at least 3 nodes in BSP Hama mode
+ assertEquals(0, queryAndCompare(new File(queryDir, "factorization_1.mrql"), resultDir));
+ }
+
+ public void testGroupBy() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "group_by_1.mrql"), resultDir));
+ }
+
+ public void testGroupByHaving() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "group_by_having_1.mrql"), resultDir));
+ }
+
+ public void testGroupByOrderBy() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "group_by_order_by_1.mrql"), resultDir));
+ assertEquals(0, queryAndCompare(new File(queryDir, "group_by_order_by_2.mrql"), resultDir));
+ }
+
+ public void testJoinGroupBy() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "join_group_by_1.mrql"), resultDir));
+ assertEquals(0, queryAndCompare(new File(queryDir, "join_group_by_2.mrql"), resultDir));
+ assertEquals(0, queryAndCompare(new File(queryDir, "join_group_by_3.mrql"), resultDir));
+ }
+
+ public void testJoinOrderBy() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "join_order_by_1.mrql"), resultDir));
+ }
+
+ public void testJoins() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "joins_1.mrql"), resultDir));
+ }
+
+ public void testKmeans() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "kmeans_1.mrql"), resultDir));
+ }
+
+ public void testLoop() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "loop_1.mrql"), resultDir));
+ }
+
+ public void testMatrix() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "matrix_1.mrql"), resultDir));
+ }
+
+ public void testNestedSelect() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "nested_select_1.mrql"), resultDir));
+ }
+
+ public void testOrderBy() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "order_by_1.mrql"), resultDir));
+ }
+
+ public void testPagerank() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "pagerank_1.mrql"), resultDir));
+ }
+
+ public void testRelationalJoin() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "relational_join_1.mrql"), resultDir));
+ }
+
+ public void testTotalAggregation() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "total_aggregation_1.mrql"), resultDir));
+ assertEquals(0, queryAndCompare(new File(queryDir, "total_aggregation_2.mrql"), resultDir));
+ }
+
+ public void testUdf() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "udf_1.mrql"), resultDir));
+ }
+
+ public void testUserAggregation() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "user_aggregation_1.mrql"), resultDir));
+ }
+
+ public void testXml() throws Exception {
+ assertEquals(0, queryAndCompare(new File(queryDir, "xml_1.mrql"), resultDir));
+ assertEquals(0, queryAndCompare(new File(queryDir, "xml_2.mrql"), resultDir));
+ }
+
+ private int queryAndCompare ( File query, File resultDir ) throws Exception {
+ Translator.global_reset();
+ String qname = query.getName();
+ qname = qname.substring(0,qname.length()-5);
+ String resultFile = resultDir.getAbsolutePath()+"/"+qname+".txt";
+ boolean exists = new File(resultFile).exists();
+ if (exists)
+ System.setOut(new PrintStream(resultDir.getAbsolutePath()+"/"+qname+"_result.txt"));
+ else System.setOut(new PrintStream(resultFile));
+ Config.max_bag_size_print = -1;
+ Config.testing = true;
+ MRQL.evaluate("store NaN := -1;");
+ MRQLLex scanner = new MRQLLex(new FileInputStream(query));
+ MRQLParser parser = new MRQLParser(scanner);
+ parser.setScanner(scanner);
+ MRQLLex.reset();
+ parser.parse();
+ PrintStream errorStream = System.err;
+ int i;
+ if (exists && (i = compare(resultFile,resultDir.getAbsolutePath()+"/"+qname+"_result.txt")) > 0) {
+ return i;
+ } else if (exists) {
+ return 0;
+ } else {
+ return 0;
+ }
+ }
+
+ private int compare2(String file1, String file2) throws Exception {
+ FileInputStream s1 = new FileInputStream(file1);
+ FileInputStream s2 = new FileInputStream(file2);
+ int b1, b2;
+ int i = 1;
+ while ((b1 = s1.read()) == (b2 = s2.read()) && b1 != -1 && b2 != -1)
+ i++;
+ return (b1 == -1 && b2 == -1) ? 0 : i;
+ }
+
+ private String read_lines ( BufferedReader reader ) throws Exception {
+ String s = "";
+ boolean even = true;
+ do {
+ String line = reader.readLine();
+ if (line == null)
+ return s;
+ for ( int i = 0; i < line.length(); i++ )
+ if (line.charAt(i) == '\"')
+ even = !even;
+ s += line;
+ } while (!even);
+ return s;
+ }
+
+ private int compare ( String file1, String file2 ) throws Exception {
+ BufferedReader reader1 = new BufferedReader(new FileReader(file1));
+ BufferedReader reader2 = new BufferedReader(new FileReader(file2));
+ String line1 = read_lines(reader1);
+ String line2 = read_lines(reader2);
+ int i = 1;
+ do {
+ boolean hm = Config.hadoop_mode;
+ Config.hadoop_mode = false;
+ MRData v1 = MRQL.query(line1);
+ MRData v2 = MRQL.query(line2);
+ Config.hadoop_mode = hm;
+ if (!equal_value(v1,v2)) {
+ System.err .println("*** "+file1+" (query "+i+"):\nFound: "+v1+"\nExpected: "+v2);
+ return 0; // should be i
+ };
+ line1 = reader1.readLine();
+ line2 = reader2.readLine();
+ i++;
+ } while (line1 != null && line2 != null);
+ return 0;
+ }
+
+ private boolean member ( MRData e, Bag v ) {
+ for ( MRData x: v )
+ if (equal_value(x,e))
+ return true;
+ return false;
+ }
+
+ private boolean equal_value ( MRData v1, MRData v2 ) {
+ if (v1 instanceof Bag && v2 instanceof Bag) {
+ Bag b1 = (Bag)v1;
+ Bag b2 = (Bag)v2;
+ if (b1.size() != b2.size())
+ return false;
+ for ( MRData e1: b1 )
+ if (!member(e1,b2))
+ return false;
+ for ( MRData e2: b2 )
+ if (!member(e2,b1))
+ return false;
+ return true;
+ } else if (v1 instanceof Tuple && v2 instanceof Tuple) {
+ Tuple t1 = (Tuple)v1;
+ Tuple t2 = (Tuple)v2;
+ if (t1.size() != t2.size())
+ return false;
+ for ( short i = 0; i < t1.size(); i++ )
+ if (!equal_value(t1.get(i),t2.get(i)))
+ return false;
+ return true;
+ } else if (v1 instanceof Union && v2 instanceof Union) {
+ Union t1 = (Union)v1;
+ Union t2 = (Union)v2;
+ return t1.tag() == t2.tag() && equal_value(t1.value(),t2.value());
+ } else return v1.equals(v2);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/mapreduce/pom.xml
----------------------------------------------------------------------
diff --git a/mapreduce/pom.xml b/mapreduce/pom.xml
index aa8834e..5b2c9c0 100644
--- a/mapreduce/pom.xml
+++ b/mapreduce/pom.xml
@@ -43,6 +43,18 @@
<artifactId>mrql-core</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.mrql</groupId>
+ <artifactId>mrql-core</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
<!-- needed for testing in local mode -->
<dependency>
<groupId>commons-io</groupId>
@@ -159,31 +171,6 @@
</target>
</configuration>
</execution>
- <execution>
- <id>validate</id>
- <phase>test</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target name="validate_hadoop" if="tests" description="Validate all test queries on Apache Hadoop">
- <property name="runtime_classpath" refid="maven.runtime.classpath" />
- <echo message="Evaluating test queries in memory (Map-Reduce mode):" />
- <java classname="org.apache.mrql.Test" classpath="${runtime_classpath}" dir=".." fork="yes">
- <arg file="../tests/queries" />
- <arg file="../tests/results/mr-memory" />
- <arg file="../tests/error_log.txt" />
- </java>
- <echo message="Evaluating test queries in Apache Hadoop local mode:" />
- <java classname="org.apache.mrql.Test" classpath="../lib/mrql-mr-${project.version}.jar:${runtime_classpath}" dir=".." fork="yes" error="/dev/null">
- <arg line="-local" />
- <arg file="../tests/queries" />
- <arg file="../tests/results/hadoop" />
- <arg file="../tests/error_log.txt" />
- </java>
- </target>
- </configuration>
- </execution>
</executions>
</plugin>
</plugins>
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/mapreduce/src/main/java/org/apache/mrql/MapReduceEvaluator.gen
----------------------------------------------------------------------
diff --git a/mapreduce/src/main/java/org/apache/mrql/MapReduceEvaluator.gen b/mapreduce/src/main/java/org/apache/mrql/MapReduceEvaluator.gen
index 94c61d5..f16d18b 100644
--- a/mapreduce/src/main/java/org/apache/mrql/MapReduceEvaluator.gen
+++ b/mapreduce/src/main/java/org/apache/mrql/MapReduceEvaluator.gen
@@ -214,7 +214,7 @@ final public class MapReduceEvaluator extends Evaluator {
DataSet Y = eval(y,env,"-");
int n = (int)Math.floor(Math.sqrt(4.0*Config.nodes));
int m = n;
- System.out.println("Using a groupBy join on a "+n+"*"+m+" grid of partitions");
+ System.err.println("Using a groupBy join on a "+n+"*"+m+" grid of partitions");
return GroupByJoinPlan.groupByJoin(closure(kx,env),closure(ky,env),
closure(gx,env),closure(gy,env),
closure(mp,env),closure(c,env),closure(r,env),
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/mapreduce/src/main/java/org/apache/mrql/MapReducePlan.java
----------------------------------------------------------------------
diff --git a/mapreduce/src/main/java/org/apache/mrql/MapReducePlan.java b/mapreduce/src/main/java/org/apache/mrql/MapReducePlan.java
index 09d5c7b..75f0568 100644
--- a/mapreduce/src/main/java/org/apache/mrql/MapReducePlan.java
+++ b/mapreduce/src/main/java/org/apache/mrql/MapReducePlan.java
@@ -96,7 +96,7 @@ public class MapReducePlan extends Plan {
do {
s.dataset = ((MR_dataset)loop.eval(s)).dataset;
i++;
- System.out.println("Repeat #"+i+": "+s.dataset.counter+" true results");
+ System.err.println("Repeat #"+i+": "+s.dataset.counter+" true results");
} while (s.dataset.counter != 0 && i < max_num);
return s.dataset;
}
@@ -116,7 +116,7 @@ public class MapReducePlan extends Plan {
do {
s.dataset = ((MR_dataset)loop.eval(s)).dataset;
i++;
- System.out.println("Repeat #"+i+": "+(s.dataset.records-n)+" new records");
+ System.err.println("Repeat #"+i+": "+(s.dataset.records-n)+" new records");
old = n;
n = s.dataset.records;
} while (old < n && i < max_num);
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/mapreduce/src/test/java/org/apache/mrql/MapReduceEvaluatorInMemoryTest.java
----------------------------------------------------------------------
diff --git a/mapreduce/src/test/java/org/apache/mrql/MapReduceEvaluatorInMemoryTest.java b/mapreduce/src/test/java/org/apache/mrql/MapReduceEvaluatorInMemoryTest.java
new file mode 100644
index 0000000..fcb645c
--- /dev/null
+++ b/mapreduce/src/test/java/org/apache/mrql/MapReduceEvaluatorInMemoryTest.java
@@ -0,0 +1,44 @@
+/**
+ * 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.
+ */
+package org.apache.mrql;
+
+import org.apache.hadoop.conf.Configuration;
+
+public class MapReduceEvaluatorInMemoryTest extends EvaluatorTest {
+
+ @Override
+ protected Evaluator createEvaluator() throws Exception {
+ Configuration conf = null;
+
+ Config.bsp_mode = false;
+ Config.spark_mode = false;
+ Config.map_reduce_mode = true;
+
+ Evaluator.evaluator = new MapReduceEvaluator();
+
+ Config.quiet_execution = true;
+ Config.hadoop_mode = false;
+ Config.testing = true;
+
+ Config.parse_args(new String[] {}, conf);
+
+ Evaluator.evaluator.init(conf);
+
+ return Evaluator.evaluator;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/mapreduce/src/test/java/org/apache/mrql/MapReduceEvaluatorLocalModeTest.java
----------------------------------------------------------------------
diff --git a/mapreduce/src/test/java/org/apache/mrql/MapReduceEvaluatorLocalModeTest.java b/mapreduce/src/test/java/org/apache/mrql/MapReduceEvaluatorLocalModeTest.java
new file mode 100644
index 0000000..99187ea
--- /dev/null
+++ b/mapreduce/src/test/java/org/apache/mrql/MapReduceEvaluatorLocalModeTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+package org.apache.mrql;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.util.GenericOptionsParser;
+
+public class MapReduceEvaluatorLocalModeTest extends EvaluatorTest {
+
+ public void tearDown() throws IOException {
+ super.tearDown();
+ Plan.clean();
+ }
+
+ @Override
+ protected Evaluator createEvaluator() throws Exception {
+ Configuration conf = null;
+
+ Config.bsp_mode = false;
+ Config.spark_mode = false;
+ Config.map_reduce_mode = true;
+
+ Evaluator.evaluator = new MapReduceEvaluator();
+
+ Config.quiet_execution = true;
+
+ String[] args = new String[] { "-local" };
+
+ conf = Evaluator.evaluator.new_configuration();
+ GenericOptionsParser gop = new GenericOptionsParser(conf, args);
+ conf = gop.getConfiguration();
+
+ args = gop.getRemainingArgs();
+
+ Config.hadoop_mode = true;
+ Config.testing = true;
+ Config.parse_args(args, conf);
+
+ Evaluator.evaluator.init(conf);
+
+ return Evaluator.evaluator;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/mapreduce/src/test/java/org/apache/mrql/MapReduceQueryInMemoryTest.java
----------------------------------------------------------------------
diff --git a/mapreduce/src/test/java/org/apache/mrql/MapReduceQueryInMemoryTest.java b/mapreduce/src/test/java/org/apache/mrql/MapReduceQueryInMemoryTest.java
new file mode 100644
index 0000000..3fa583d
--- /dev/null
+++ b/mapreduce/src/test/java/org/apache/mrql/MapReduceQueryInMemoryTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.
+ */
+package org.apache.mrql;
+
+import org.apache.hadoop.conf.Configuration;
+
+public class MapReduceQueryInMemoryTest extends QueryTest {
+
+ @Override
+ protected Evaluator createEvaluator() throws Exception {
+ Configuration conf = null;
+
+ Config.bsp_mode = false;
+ Config.spark_mode = false;
+ Config.map_reduce_mode = true;
+
+ Evaluator.evaluator = new MapReduceEvaluator();
+
+ Config.quiet_execution = true;
+
+ Config.hadoop_mode = false;
+ Config.testing = true;
+
+ Config.parse_args(new String[] {}, conf);
+
+ Evaluator.evaluator.init(conf);
+
+ return Evaluator.evaluator;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/mapreduce/src/test/java/org/apache/mrql/MapReduceQueryLocalModeTest.java
----------------------------------------------------------------------
diff --git a/mapreduce/src/test/java/org/apache/mrql/MapReduceQueryLocalModeTest.java b/mapreduce/src/test/java/org/apache/mrql/MapReduceQueryLocalModeTest.java
new file mode 100644
index 0000000..1dd3855
--- /dev/null
+++ b/mapreduce/src/test/java/org/apache/mrql/MapReduceQueryLocalModeTest.java
@@ -0,0 +1,59 @@
+/**
+ * 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.
+ */
+package org.apache.mrql;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.util.GenericOptionsParser;
+
+public class MapReduceQueryLocalModeTest extends QueryTest {
+ public void tearDown() throws IOException {
+ super.tearDown();
+ Plan.clean();
+ }
+
+ @Override
+ protected Evaluator createEvaluator() throws Exception {
+ Configuration conf = new Configuration();
+
+ Config.bsp_mode = false;
+ Config.spark_mode = false;
+ Config.map_reduce_mode = true;
+
+ Evaluator.evaluator = new MapReduceEvaluator();
+
+ Config.quiet_execution = true;
+
+ String[] args = new String[] { "-local" };
+
+ conf = Evaluator.evaluator.new_configuration();
+ GenericOptionsParser gop = new GenericOptionsParser(conf, args);
+ conf = gop.getConfiguration();
+
+ args = gop.getRemainingArgs();
+
+ Config.hadoop_mode = true;
+ Config.testing = true;
+ Config.parse_args(args, conf);
+
+ Evaluator.evaluator.init(conf);
+
+ return Evaluator.evaluator;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5761c54..67b0395 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,6 +49,7 @@
<hama.version>0.6.3</hama.version>
<spark.version>0.9.0-incubating</spark.version>
<scala.version>2.10</scala.version>
+ <skipTests>true</skipTests>
</properties>
<modules>
@@ -78,6 +79,17 @@
</dependency>
</dependencies>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<build>
<plugins>
<plugin>
@@ -90,6 +102,16 @@
</configuration>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.14.1</version>
+ <configuration>
+ <argLine>-Xmx1024m</argLine>
+ <useSystemClassLoader>false</useSystemClassLoader>
+ <skipTests>${skipTests}</skipTests>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>2.1.1</version>
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/spark/pom.xml
----------------------------------------------------------------------
diff --git a/spark/pom.xml b/spark/pom.xml
index c0096e4..8284e5e 100644
--- a/spark/pom.xml
+++ b/spark/pom.xml
@@ -48,6 +48,18 @@
<artifactId>spark-core_${scala.version}</artifactId>
<version>${spark.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.mrql</groupId>
+ <artifactId>mrql-core</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -124,26 +136,6 @@
</target>
</configuration>
</execution>
- <execution>
- <id>validate</id>
- <phase>test</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target name="validate_spark" if="tests" description="Validate all test queries on Apache Spark">
- <property name="runtime_classpath" refid="maven.runtime.classpath" />
- <echo message="Evaluating test queries in Apache Spark local mode:" />
- <java classname="org.apache.mrql.Test" classpath="../lib/mrql-spark-${project.version}.jar:${runtime_classpath}" dir=".." fork="yes" error="/dev/null">
- <arg line="-local" />
- <arg line="-spark" />
- <arg file="../tests/queries" />
- <arg file="../tests/results/spark" />
- <arg file="../tests/error_log.txt" />
- </java>
- </target>
- </configuration>
- </execution>
</executions>
</plugin>
</plugins>
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/spark/src/main/java/org/apache/mrql/SparkEvaluator.gen
----------------------------------------------------------------------
diff --git a/spark/src/main/java/org/apache/mrql/SparkEvaluator.gen b/spark/src/main/java/org/apache/mrql/SparkEvaluator.gen
index dbfda4d..90cf59c 100644
--- a/spark/src/main/java/org/apache/mrql/SparkEvaluator.gen
+++ b/spark/src/main/java/org/apache/mrql/SparkEvaluator.gen
@@ -558,7 +558,7 @@ final public class SparkEvaluator extends Evaluator implements Serializable {
case GroupByJoin(`kx,`ky,`gx,`gy,`acc,`zero,`r,`x,`y,`o):
final int n = (int)Math.floor(Math.sqrt(4.0*Config.nodes));
final int m = n;
- System.out.println("Using a groupBy join on a "+n+"*"+m+" grid of partitions");
+ System.err.println("Using a groupBy join on a "+n+"*"+m+" grid of partitions");
final org.apache.mrql.Function fkx = evalF(kx,env);
final org.apache.mrql.Function fky = evalF(ky,env);
final org.apache.mrql.Function fgx = evalF(gx,env);
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/spark/src/test/java/org/apache/mrql/SparkEvaluatorInMemoryTest.java
----------------------------------------------------------------------
diff --git a/spark/src/test/java/org/apache/mrql/SparkEvaluatorInMemoryTest.java b/spark/src/test/java/org/apache/mrql/SparkEvaluatorInMemoryTest.java
new file mode 100644
index 0000000..39c4ad4
--- /dev/null
+++ b/spark/src/test/java/org/apache/mrql/SparkEvaluatorInMemoryTest.java
@@ -0,0 +1,43 @@
+/**
+ * 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.
+ */
+package org.apache.mrql;
+
+import org.apache.hadoop.conf.Configuration;
+
+public class SparkEvaluatorInMemoryTest extends EvaluatorTest {
+
+ @Override
+ protected Evaluator createEvaluator() throws Exception {
+ Configuration conf = null;
+
+ Config.bsp_mode = false;
+ Config.spark_mode = true;
+ Config.map_reduce_mode = false;
+
+ Evaluator.evaluator = new SparkEvaluator();
+
+ Config.quiet_execution = true;
+ Config.hadoop_mode = false;
+ Config.testing = true;
+ Config.parse_args(new String[] {"-spark"}, conf);
+
+ Evaluator.evaluator.init(conf);
+
+ return Evaluator.evaluator;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/spark/src/test/java/org/apache/mrql/SparkEvaluatorLocalModeTest.java
----------------------------------------------------------------------
diff --git a/spark/src/test/java/org/apache/mrql/SparkEvaluatorLocalModeTest.java b/spark/src/test/java/org/apache/mrql/SparkEvaluatorLocalModeTest.java
new file mode 100644
index 0000000..dfc3a00
--- /dev/null
+++ b/spark/src/test/java/org/apache/mrql/SparkEvaluatorLocalModeTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+package org.apache.mrql;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.util.GenericOptionsParser;
+
+public class SparkEvaluatorLocalModeTest extends EvaluatorTest {
+
+ public void tearDown() throws IOException {
+ super.tearDown();
+ Plan.clean();
+ }
+
+ @Override
+ protected Evaluator createEvaluator() throws Exception {
+ Configuration conf = null;
+
+ Config.bsp_mode = false;
+ Config.spark_mode = true;
+ Config.map_reduce_mode = false;
+
+ Evaluator.evaluator = new SparkEvaluator();
+
+ Config.quiet_execution = true;
+
+ String[] args = new String[] { "-local", "-spark" };
+
+ conf = Evaluator.evaluator.new_configuration();
+ GenericOptionsParser gop = new GenericOptionsParser(conf, args);
+ conf = gop.getConfiguration();
+
+ args = gop.getRemainingArgs();
+
+ Config.hadoop_mode = true;
+ Config.testing = true;
+ Config.parse_args(args, conf);
+
+ Evaluator.evaluator.init(conf);
+
+ return Evaluator.evaluator;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/spark/src/test/java/org/apache/mrql/SparkQueryInMemoryTest.java
----------------------------------------------------------------------
diff --git a/spark/src/test/java/org/apache/mrql/SparkQueryInMemoryTest.java b/spark/src/test/java/org/apache/mrql/SparkQueryInMemoryTest.java
new file mode 100644
index 0000000..b35365d
--- /dev/null
+++ b/spark/src/test/java/org/apache/mrql/SparkQueryInMemoryTest.java
@@ -0,0 +1,43 @@
+/**
+ * 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.
+ */
+package org.apache.mrql;
+
+import org.apache.hadoop.conf.Configuration;
+
+public class SparkQueryInMemoryTest extends QueryTest {
+
+ @Override
+ protected Evaluator createEvaluator() throws Exception {
+ Configuration conf = null;
+
+ Config.bsp_mode = false;
+ Config.spark_mode = true;
+ Config.map_reduce_mode = false;
+
+ Evaluator.evaluator = new SparkEvaluator();
+
+ Config.quiet_execution = true;
+ Config.hadoop_mode = false;
+ Config.testing = true;
+ Config.parse_args(new String[] { "-spark" }, conf);
+
+ Evaluator.evaluator.init(conf);
+
+ return Evaluator.evaluator;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/spark/src/test/java/org/apache/mrql/SparkQueryLocalModeTest.java
----------------------------------------------------------------------
diff --git a/spark/src/test/java/org/apache/mrql/SparkQueryLocalModeTest.java b/spark/src/test/java/org/apache/mrql/SparkQueryLocalModeTest.java
new file mode 100644
index 0000000..72b32e4
--- /dev/null
+++ b/spark/src/test/java/org/apache/mrql/SparkQueryLocalModeTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+package org.apache.mrql;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.util.GenericOptionsParser;
+
+public class SparkQueryLocalModeTest extends QueryTest {
+
+ public void tearDown() throws IOException {
+ super.tearDown();
+ Plan.clean();
+ }
+
+ @Override
+ protected Evaluator createEvaluator() throws Exception {
+ Configuration conf = new Configuration();
+
+ Config.bsp_mode = false;
+ Config.spark_mode = true;
+ Config.map_reduce_mode = false;
+
+ Evaluator.evaluator = new SparkEvaluator();
+
+ Config.quiet_execution = true;
+
+ String[] args = new String[] { "-local", "-spark" };
+
+ conf = Evaluator.evaluator.new_configuration();
+ GenericOptionsParser gop = new GenericOptionsParser(conf, args);
+ conf = gop.getConfiguration();
+
+ args = gop.getRemainingArgs();
+
+ Config.hadoop_mode = true;
+ Config.testing = true;
+ Config.parse_args(args, conf);
+
+ Evaluator.evaluator.init(conf);
+
+ return Evaluator.evaluator;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/distinct_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/distinct_1.mrql b/tests/queries/distinct_1.mrql
index 46a19c9..23555e8 100644
--- a/tests/queries/distinct_1.mrql
+++ b/tests/queries/distinct_1.mrql
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-C = source(line,"tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
-O = source(line,"tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
+C = source(line,"../tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
+O = source(line,"../tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
select distinct o.CUSTKEY from o in O;
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/factorization_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/factorization_1.mrql b/tests/queries/factorization_1.mrql
index 90aeb56..47414ef 100644
--- a/tests/queries/factorization_1.mrql
+++ b/tests/queries/factorization_1.mrql
@@ -16,9 +16,9 @@
* limitations under the License.
*/
-Mmatrix = source(line,"tests/data/Xmatrix.txt",",",type( (double,long,long) ));
-Hmatrix = source(line,"tests/data/Ymatrix.txt",",",type( (double,long,long) ));
-Wmatrix = source(line,"tests/data/Zmatrix.txt",",",type( (double,long,long) ));
+Mmatrix = source(line,"../tests/data/Xmatrix.txt",",",type( (double,long,long) ));
+Hmatrix = source(line,"../tests/data/Ymatrix.txt",",",type( (double,long,long) ));
+Wmatrix = source(line,"../tests/data/Zmatrix.txt",",",type( (double,long,long) ));
macro transpose ( X ) {
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/group_by_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/group_by_1.mrql b/tests/queries/group_by_1.mrql
index 119c260..a42d620 100644
--- a/tests/queries/group_by_1.mrql
+++ b/tests/queries/group_by_1.mrql
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-C = source(line,"tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
-O = source(line,"tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
+C = source(line,"../tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
+O = source(line,"../tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
select (k,sum(o.TOTALPRICE))
from o in O
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/group_by_having_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/group_by_having_1.mrql b/tests/queries/group_by_having_1.mrql
index 31f6fa4..82d94ec 100644
--- a/tests/queries/group_by_having_1.mrql
+++ b/tests/queries/group_by_having_1.mrql
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-C = source(line,"tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
-O = source(line,"tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
+C = source(line,"../tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
+O = source(line,"../tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
select (k,sum(o.TOTALPRICE))
from o in O
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/group_by_order_by_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/group_by_order_by_1.mrql b/tests/queries/group_by_order_by_1.mrql
index e72b463..d772028 100644
--- a/tests/queries/group_by_order_by_1.mrql
+++ b/tests/queries/group_by_order_by_1.mrql
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-C = source(line,"tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
-O = source(line,"tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
+C = source(line,"../tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
+O = source(line,"../tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
select (key,count(p),avg(p))
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/group_by_order_by_2.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/group_by_order_by_2.mrql b/tests/queries/group_by_order_by_2.mrql
index eda96f3..5549c4c 100644
--- a/tests/queries/group_by_order_by_2.mrql
+++ b/tests/queries/group_by_order_by_2.mrql
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-C = source(line,"tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
-O = source(line,"tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
+C = source(line,"../tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
+O = source(line,"../tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
select (key,avg(p))
from <CUSTKEY:k,TOTALPRICE:p> in O
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/join_group_by_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/join_group_by_1.mrql b/tests/queries/join_group_by_1.mrql
index 6d50c07..2c8558b 100644
--- a/tests/queries/join_group_by_1.mrql
+++ b/tests/queries/join_group_by_1.mrql
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-C = source(line,"tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
-O = source(line,"tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
+C = source(line,"../tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
+O = source(line,"../tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
select (k,sum(o.TOTALPRICE))
from o in O,
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/join_group_by_2.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/join_group_by_2.mrql b/tests/queries/join_group_by_2.mrql
index 0b886da..d286da6 100644
--- a/tests/queries/join_group_by_2.mrql
+++ b/tests/queries/join_group_by_2.mrql
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-C = source(line,"tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
-O = source(line,"tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
+C = source(line,"../tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
+O = source(line,"../tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
select (k,sum(o.TOTALPRICE))
from o in O,
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/join_group_by_3.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/join_group_by_3.mrql b/tests/queries/join_group_by_3.mrql
index bac8d54..545cae4 100644
--- a/tests/queries/join_group_by_3.mrql
+++ b/tests/queries/join_group_by_3.mrql
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-C = source(line,"tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
-O = source(line,"tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
+C = source(line,"../tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
+O = source(line,"../tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
select (k#1,avg(o.TOTALPRICE))
from o in O,
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/join_order_by_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/join_order_by_1.mrql b/tests/queries/join_order_by_1.mrql
index 0a1e2f7..7eb4a6a 100644
--- a/tests/queries/join_order_by_1.mrql
+++ b/tests/queries/join_order_by_1.mrql
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-C = source(line,"tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string,ADDRESS:string>));
-O = source(line,"tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
+C = source(line,"../tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string,ADDRESS:string>));
+O = source(line,"../tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
select <N: c.NAME, A: avg(select o.TOTALPRICE from o in O where o.CUSTKEY=c.CUSTKEY)>
from c in C
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/joins_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/joins_1.mrql b/tests/queries/joins_1.mrql
index 3230ce0..ecd3fe6 100644
--- a/tests/queries/joins_1.mrql
+++ b/tests/queries/joins_1.mrql
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-E = source(line,"tests/data/employee.txt",",",type(<name:string,dno:int,address:string>));
-D = source(line,"tests/data/department.txt",",",type(<name:string,dno:int>));
+E = source(line,"../tests/data/employee.txt",",",type(<name:string,dno:int,address:string>));
+D = source(line,"../tests/data/department.txt",",",type(<name:string,dno:int>));
select e.name from e in E where e.dno=10;
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/kmeans_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/kmeans_1.mrql b/tests/queries/kmeans_1.mrql
index fca9835..76fd239 100644
--- a/tests/queries/kmeans_1.mrql
+++ b/tests/queries/kmeans_1.mrql
@@ -40,6 +40,6 @@ repeat centroids = { < X: 0.0 as double, Y: 0.0 as double >,
< X: 0.0, Y: 10.0 >,
< X: 10.0, Y: 10.0 > }
step select ( centroid(new_centroid(select (p,1 as long) from p in s),k), true )
- from s in source(line,"tests/data/points.txt",",",type( < X: double, Y: double > ))
+ from s in source(line,"../tests/data/points.txt",",",type( < X: double, Y: double > ))
group by k: (select c from c in centroids order by distance(c,s))[0]
limit 2;
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/loop_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/loop_1.mrql b/tests/queries/loop_1.mrql
index 27d6680..adcb144 100644
--- a/tests/queries/loop_1.mrql
+++ b/tests/queries/loop_1.mrql
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-E = source(line,"tests/data/points.txt",",",type( < X: double, Y: double > ));
+E = source(line,"../tests/data/points.txt",",",type( < X: double, Y: double > ));
repeat xx = select x from <X:x,Y:y> in E
step select (n,true) from x in xx group by n: x
@@ -38,18 +38,18 @@ repeat xx = select x from <X:x,Y:y> in E
step select (x+1,true) from x in xx
limit 2;
+repeat (xx,yy) = ({1,2},{3,4})
+step ((select x+y from x in xx, y in yy),
+ (select x*y from x in xx, y in yy))
+limit 2;
+
repeat xx = {1,2}
step select (x+y as int) from x in xx, <X:*,Y:y> in E
-limit 2;
+limit 1;
repeat xx = {1,2}
step select (x+y as int,true) from x in xx, <X:*,Y:y> in E
-limit 2;
-
-repeat (xx,yy) = ({1,2},{3,4})
-step ((select x+y from x in xx, y in yy),
- (select x*y from x in xx, y in yy))
-limit 2;
+limit 1;
repeat (xx,yy) = ((select x from <X:x,Y:y> in E where y < 10),
(select y from <X:x,Y:y> in E where x < 10))
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/matrix_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/matrix_1.mrql b/tests/queries/matrix_1.mrql
index 43fecb6..a08cb1f 100644
--- a/tests/queries/matrix_1.mrql
+++ b/tests/queries/matrix_1.mrql
@@ -16,10 +16,10 @@
* limitations under the License.
*/
-Xvector = source(line,"tests/data/Xvector.txt",",",type( (double,long) ));
-Yvector = source(line,"tests/data/Yvector.txt",",",type( (double,long) ));
-Xmatrix = source(line,"tests/data/Xmatrix.txt",",",type( (double,long,long) ));
-Ymatrix = source(line,"tests/data/Ymatrix.txt",",",type( (double,long,long) ));
+Xvector = source(line,"../tests/data/Xvector.txt",",",type( (double,long) ));
+Yvector = source(line,"../tests/data/Yvector.txt",",",type( (double,long) ));
+Xmatrix = source(line,"../tests/data/Xmatrix.txt",",",type( (double,long,long) ));
+Ymatrix = source(line,"../tests/data/Ymatrix.txt",",",type( (double,long,long) ));
// inner product:
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/nested_select_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/nested_select_1.mrql b/tests/queries/nested_select_1.mrql
index ecd16b6..002b7fc 100644
--- a/tests/queries/nested_select_1.mrql
+++ b/tests/queries/nested_select_1.mrql
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-C = source(line,"tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
-O = source(line,"tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
+C = source(line,"../tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
+O = source(line,"../tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
select (c.NAME,avg(select o.TOTALPRICE
from o in O
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/order_by_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/order_by_1.mrql b/tests/queries/order_by_1.mrql
index 54b03b0..8cd4951 100644
--- a/tests/queries/order_by_1.mrql
+++ b/tests/queries/order_by_1.mrql
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-C = source(line,"tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
-O = source(line,"tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
+C = source(line,"../tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
+O = source(line,"../tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
select (o.CUSTKEY,o.TOTALPRICE)
from o in O
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/pagerank_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/pagerank_1.mrql b/tests/queries/pagerank_1.mrql
index ca0616d..7faea44 100644
--- a/tests/queries/pagerank_1.mrql
+++ b/tests/queries/pagerank_1.mrql
@@ -18,7 +18,7 @@
// preprocessing: for each node, group its outgoing links into a bag
graph = select (key,n#1)
- from n in source(line,"tests/data/graph.txt",",",type( (int,int) ))
+ from n in source(line,"../tests/data/graph.txt",",",type( (int,int) ))
group by key: n#0;
store graph_size := 100;
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/relational_join_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/relational_join_1.mrql b/tests/queries/relational_join_1.mrql
index c32e669..8dbd3a7 100644
--- a/tests/queries/relational_join_1.mrql
+++ b/tests/queries/relational_join_1.mrql
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-C = source(line,"tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
-O = source(line,"tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
+C = source(line,"../tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
+O = source(line,"../tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
select (c.NAME,o.TOTALPRICE)
from o in O,
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/total_aggregation_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/total_aggregation_1.mrql b/tests/queries/total_aggregation_1.mrql
index 311a568..cb45531 100644
--- a/tests/queries/total_aggregation_1.mrql
+++ b/tests/queries/total_aggregation_1.mrql
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-C = source(line,"tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
-O = source(line,"tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
+C = source(line,"../tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
+O = source(line,"../tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
count(O);
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/total_aggregation_2.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/total_aggregation_2.mrql b/tests/queries/total_aggregation_2.mrql
index 3fb4c74..a04e576 100644
--- a/tests/queries/total_aggregation_2.mrql
+++ b/tests/queries/total_aggregation_2.mrql
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-C = source(line,"tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
-O = source(line,"tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
+C = source(line,"../tests/data/customer.tbl","|",type(<CUSTKEY:int,NAME:string>));
+O = source(line,"../tests/data/orders.tbl","|",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));
avg(select o.TOTALPRICE from o in O);
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/user_aggregation_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/user_aggregation_1.mrql b/tests/queries/user_aggregation_1.mrql
index a3108c8..757cb7d 100644
--- a/tests/queries/user_aggregation_1.mrql
+++ b/tests/queries/user_aggregation_1.mrql
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-E = source(line,"tests/data/employee.txt",",",type(<name:string,dno:int,address:string>));
+E = source(line,"../tests/data/employee.txt",",",type(<name:string,dno:int,address:string>));
aggregation aggr(\(x:int,y:int):int.x+y,0):int;
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/xml_1.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/xml_1.mrql b/tests/queries/xml_1.mrql
index 7ce8e79..3f8087b 100644
--- a/tests/queries/xml_1.mrql
+++ b/tests/queries/xml_1.mrql
@@ -17,5 +17,5 @@
*/
select s.name
-from s in source(xml,"tests/data/cs.xml",{"gradstudent"})
+from s in source(xml,"../tests/data/cs.xml",{"gradstudent"})
where text(s.name.firstname)="Leonidas";
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/38627c38/tests/queries/xml_2.mrql
----------------------------------------------------------------------
diff --git a/tests/queries/xml_2.mrql b/tests/queries/xml_2.mrql
index f85befa..e0864dc 100644
--- a/tests/queries/xml_2.mrql
+++ b/tests/queries/xml_2.mrql
@@ -17,4 +17,4 @@
*/
select n.lastname
-from n in source(xml,"tests/data/cs.xml",{"gradstudent"},xpath(name[firstname="Leonidas"]));
+from n in source(xml,"../tests/data/cs.xml",{"gradstudent"},xpath(name[firstname="Leonidas"]));