You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by ja...@apache.org on 2013/09/11 04:04:46 UTC
[03/29] DRILL-221 Add license header to all files
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/ScalarAggregate.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/ScalarAggregate.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/ScalarAggregate.java
deleted file mode 100644
index 0d6f4ad..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/ScalarAggregate.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.apache.drill.plan.json;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.gson.JsonObject;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-
-/**
- * Created with IntelliJ IDEA.
- * User: tdunning
- * Date: 11/20/12
- * Time: 4:16 PM
- * To change this template use File | Settings | File Templates.
- */
-public class ScalarAggregate extends Consumer {
- private static final Map<String, Class<? extends AggregationFunction>> aggregators = ImmutableMap.of("sum", Sum.class, "count", Count.class);
-
- private double result = 0;
- private AggregationFunction f;
- private final String sourceVariable;
-
-
- public ScalarAggregate(JsonObject spec) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
- f = aggregators.get(spec.get("update").getAsString()).newInstance();
- sourceVariable = spec.get("source").getAsString();
- }
-
- @Override
- public void push(Tuple t) throws InvocationTargetException, IOException {
- Object v = t.get(sourceVariable);
- if (v instanceof Double) {
- f.update((Double) v);
- } else if (v instanceof Integer) {
- f.update((Integer) v);
- } else {
- throw new IllegalArgumentException("Wanted a number in " + sourceVariable + " but got a " + v.getClass());
- }
- }
-
- @Override
- public Object getAggregate() {
- return f.value();
- }
-
- private static abstract class AggregationFunction {
- protected double value;
-
- abstract void update(double x);
-
- protected double value() {
- return value;
- }
- }
-
- private static class Sum extends AggregationFunction {
- @Override
- void update(double x) {
- value += x;
- }
- }
-
- private static class Count extends AggregationFunction {
- @Override
- void update(double x) {
- value += 1;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Scan.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Scan.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Scan.java
deleted file mode 100644
index 77dbc46..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Scan.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.apache.drill.plan.json;
-
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.google.common.base.CharMatcher;
-import com.google.common.base.Charsets;
-import com.google.common.base.Splitter;
-import com.google.common.io.*;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * Reads CSV data. Note that quotes are not handled correctly just yet.
- */
-@JsonTypeName("scan")
-public class Scan extends Consumer {
- private static Splitter onComma = Splitter.on(",").trimResults(CharMatcher.anyOf(" \"'"));
-
- private Consumer out;
- private File file;
- private String resource;
- private final InputSupplier<InputStreamReader> input;
-
- public Scan(JsonObject spec) {
- JsonElement filename = spec.get("file");
- if (filename != null) {
- file = new File(filename.getAsString());
- input = Files.newReaderSupplier(file, Charsets.UTF_8);
- } else {
- resource = spec.get("resource").getAsString();
- input = Resources.newReaderSupplier(Resources.getResource(resource), Charsets.UTF_8);
- }
- }
-
- @Override
- public void connect(Consumer out) {
- this.out = out;
- }
-
- public void start() throws IOException {
- CharStreams.readLines(input, new LineProcessor<Object>() {
- boolean first = true;
- Iterable<String> header;
-
- @Override
- public boolean processLine(String s) throws IOException {
- if (first) {
- header = onComma.split(s);
- first = false;
- } else {
- try {
- out.push(new MapTuple(header, onComma.split(s)));
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
- return true;
- }
-
- @Override
- public Object getResult() {
- return null;
- }
- });
- }
-
- @Override
- public void push(Tuple t) throws InvocationTargetException {
- throw new UnsupportedOperationException("Scanner can't process tuples");
- }
-
- public File getFile() {
- return file;
- }
-
- public String getResource() {
- return resource;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Sequence.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Sequence.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Sequence.java
deleted file mode 100644
index 33b43d6..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Sequence.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.apache.drill.plan.json;
-
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.google.common.collect.Lists;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-/**
- * Created with IntelliJ IDEA. User: tdunning Date: 11/15/12 Time: 5:36 PM To change this template
- * use File | Settings | File Templates.
- */
-@JsonTypeName("sequence")
-public class Sequence<R> extends Consumer {
- private List<Consumer> step = Lists.newArrayList();
- private Consumer lastStep;
- private Consumer out;
-
- public Sequence(JsonObject spec) throws InvocationTargetException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException {
- for (JsonElement element : spec.getAsJsonArray("do")) {
- step.add(Utils.create(element.getAsJsonObject()));
- }
- lastStep = step.get(step.size() - 1);
- }
-
- @Override
- public void connect(Consumer out) {
- this.out = out;
- for (int i = 1; i < step.size(); i++) {
- step.get(i - 1).connect(step.get(i));
- }
- step.get(step.size() - 1).connect(out);
- }
-
- @Override
- public void start() throws IOException {
- for (Consumer consumer : step) {
- consumer.start();
- }
- out.start();
- }
-
- @Override
- public void push(Tuple t) throws InvocationTargetException, IOException {
- step.get(0).push(t);
- }
-
- @Override
- public void end() throws InvocationTargetException, IOException {
- for (Consumer s : step) {
- s.end();
- }
- }
-
- @Override
- public Object getAggregate() {
- return lastStep.getAggregate();
- }
-
- public List<Consumer> getDo() {
- return step;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/SetValue.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/SetValue.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/SetValue.java
deleted file mode 100644
index 1f985c2..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/SetValue.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.drill.plan.json;
-
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.gson.JsonObject;
-import org.codehaus.janino.CompileException;
-import org.codehaus.janino.ExpressionEvaluator;
-import org.codehaus.janino.Parser;
-import org.codehaus.janino.Scanner;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-/**
- * Created with IntelliJ IDEA. User: tdunning Date: 11/15/12 Time: 6:10 PM To change this template
- * use File | Settings | File Templates.
- */
-
-@JsonTypeName("set")
-public class SetValue extends Consumer {
- private Consumer out;
- private String target;
- private Expression<Object> expression;
-
- public SetValue(JsonObject spec) throws Scanner.ScanException, CompileException, Parser.ParseException, ClassNotFoundException {
- Splitter onComma = Splitter.on(",");
-
- String targetTypeName = spec.get("targetType").getAsString();
- Class<?> targetType;
- if (targetTypeName != null) {
- targetType = Class.forName(targetTypeName).asSubclass(Object.class);
- } else {
- targetType = double.class;
- }
-
- expression = new Expression<Object>("value", spec, targetType);
-
- target = spec.get("as").getAsString();
- }
-
- @Override
- public void connect(Consumer out) {
- this.out = out;
- }
-
- @Override
- public void push(Tuple t) throws InvocationTargetException, IOException {
- t.put(target, expression.eval(t));
- out.push(t);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/SingleObjectCatcher.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/SingleObjectCatcher.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/SingleObjectCatcher.java
deleted file mode 100644
index a291d66..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/SingleObjectCatcher.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.apache.drill.plan.json;
-
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * Created with IntelliJ IDEA.
- * User: tdunning
- * Date: 11/16/12
- * Time: 3:56 PM
- * To change this template use File | Settings | File Templates.
- */
-public class SingleObjectCatcher extends Consumer {
- Tuple result = null;
- @Override
- public void push(Tuple t) throws InvocationTargetException {
- if (result == null) {
- result = t;
- } else {
- throw new RuntimeException("Flow produced more than one output");
- }
- }
-
- public Tuple getResult() {
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Tuple.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Tuple.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Tuple.java
deleted file mode 100644
index 171f641..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Tuple.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.apache.drill.plan.json;
-
-import java.util.Map;
-
-/**
- * Created with IntelliJ IDEA. User: tdunning Date: 11/15/12 Time: 5:44 PM To change this template
- * use File | Settings | File Templates.
- */
-public interface Tuple extends Map<String, Object> {
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Utils.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Utils.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Utils.java
deleted file mode 100644
index b3e8f2b..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/json/Utils.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.apache.drill.plan.json;
-
-import com.google.common.collect.Maps;
-import com.google.gson.JsonObject;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-
-/**
- * Created with IntelliJ IDEA. User: tdunning Date: 11/15/12 Time: 5:49 PM To change this template
- * use File | Settings | File Templates.
- */
-public class Utils {
- private static Map<String, Class<? extends Consumer>> builtin = Maps.newHashMap();
-
- static {
- builtin.put("sequence", Sequence.class);
- builtin.put("filter", Filter.class);
- builtin.put("set", SetValue.class);
- builtin.put("scan", Scan.class);
- builtin.put("group", GroupBy.class);
- }
-
- public static Consumer create(JsonObject spec) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
- String type = spec.get("type").getAsString();
- Class<? extends Consumer> tClass;
- if (type != null) {
- tClass = builtin.get(type);
- } else {
- tClass = Class.forName(spec.get("class").getAsString()).asSubclass(Consumer.class);
- }
-
- return tClass.getConstructor(JsonObject.class).newInstance(spec);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/ArithmeticOp.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/ArithmeticOp.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/ArithmeticOp.java
deleted file mode 100644
index fb65c10..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/ArithmeticOp.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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.drill.plan.physical.operators;
-
-import org.apache.drill.plan.ast.Arg;
-import org.apache.drill.plan.ast.Op;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Operator that works on two numbers.
- */
-public abstract class ArithmeticOp extends EvalOperator {
- public static void define() {
- Operator.defineOperator(">", GT.class);
- Operator.defineOperator("==", EQUALS.class);
- Operator.defineOperator("<", LT.class);
- Operator.defineOperator("+", PLUS.class);
- Operator.defineOperator("-", MINUS.class);
- Operator.defineOperator("*", TIMES.class);
- Operator.defineOperator("/", DIVIDE.class);
- }
-
- public EvalOperator left, right;
-
- public ArithmeticOp(Op op, Map<Integer, Operator> bindings) {
- super(op, bindings, 2, 1);
- }
-
- @Override
- public Object eval(Object data) {
- Object x = left.eval(data);
- Object y = right.eval(data);
-
- if (x instanceof Number) {
- if (y instanceof Number) {
- return eval(((Number) x).doubleValue(), ((Number) y).doubleValue());
- } else {
- throw new InvalidData("Expected number but got %s (a %s)", y, y.getClass());
- }
- } else {
- throw new InvalidData("Expected number but got %s (a %s)", x, x.getClass());
- }
- }
-
- @Override
- public void link(Op op, Map<Integer, Operator> bindings) {
- List<Arg> in = op.getInputs();
- left = extractOperand(in.get(0), bindings);
- right = extractOperand(in.get(1), bindings);
- }
-
- private EvalOperator extractOperand(Arg arg, Map<Integer, Operator> bindings) {
- if (arg instanceof Arg.Number) {
- return new ConstantOp(((Arg.Number) arg).doubleValue());
- } else if (arg instanceof Arg.Symbol) {
- return (EvalOperator) bindings.get(arg.asSymbol().getInt());
- } else {
- throw new IllegalArgumentException("Wanted constant or reference to another operator");
- }
- }
-
- public abstract Object eval(double x, double y);
-
- public static class GT extends ArithmeticOp {
- public GT(Op op, Map<Integer, Operator> bindings) {
- super(op, bindings);
- }
-
- @Override
- public Object eval(double x, double y) {
- return x > y;
- }
- }
-
- public static class LT extends ArithmeticOp {
- public LT(Op op, Map<Integer, Operator> bindings) {
- super(op, bindings);
- }
-
- @Override
- public Object eval(double x, double y) {
- return x < y;
- }
- }
-
- public static class EQUALS extends ArithmeticOp {
- public EQUALS(Op op, Map<Integer, Operator> bindings) {
- super(op, bindings);
- }
-
- @Override
- public Object eval(double x, double y) {
- return x == y;
- }
- }
-
- public static class PLUS extends ArithmeticOp {
- public PLUS(Op op, Map<Integer, Operator> bindings) {
- super(op, bindings);
- }
-
- @Override
- public Object eval(double x, double y) {
- return x + y;
- }
- }
-
-
- public static class MINUS extends ArithmeticOp {
- public MINUS(Op op, Map<Integer, Operator> bindings) {
- super(op, bindings);
- }
-
- @Override
- public Object eval(double x, double y) {
- return x - y;
- }
- }
-
-
- public static class TIMES extends ArithmeticOp {
- public TIMES(Op op, Map<Integer, Operator> bindings) {
- super(op, bindings);
- }
-
- @Override
- public Object eval(double x, double y) {
- return x * y;
- }
- }
-
-
- public static class DIVIDE extends ArithmeticOp {
- public DIVIDE(Op op, Map<Integer, Operator> bindings) {
- super(op, bindings);
- }
-
- @Override
- public Object eval(double x, double y) {
- return x / y;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/BatchListener.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/BatchListener.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/BatchListener.java
deleted file mode 100644
index a103ffc..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/BatchListener.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.apache.drill.plan.physical.operators;
-
-/**
- * Aggregate and Implode operators need to know when batches of records are finished and thus
- * they implement BatchListener. Note that the source of data is different from the source of
- * batch boundaries. This avoids the need for every data processor to propagate boundaries but
- * it also allows fancy structures to be constructed to do interesting things.
- */
-public interface BatchListener {
- public void endBatch(Object parent);
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Bind.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Bind.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Bind.java
deleted file mode 100644
index 4bd2b73..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Bind.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.drill.plan.physical.operators;
-
-import org.apache.drill.plan.ast.Op;
-
-import java.util.Map;
-
-/**
- * How to lookup a variable in an expression.
- */
-public class Bind extends EvalOperator {
- private Schema schema = null;
-
- public static void define() {
- Operator.defineOperator("bind", Bind.class);
- }
-
- private String name;
-
- public Bind(Op op, Map<Integer, Operator> bindings) {
- super(op, bindings, 2, 1);
- }
-
- @Override
- public void link(Op op, Map<Integer, Operator> bindings) {
- // connect to our inputs
- name = op.getInputs().get(0).asString();
- schema = bindings.get(op.getInputs().get(1).asSymbol().getInt()).getSchema();
- }
-
- @Override
- public Object eval(Object data) {
- return schema.get(name, data);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/ConstantOp.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/ConstantOp.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/ConstantOp.java
deleted file mode 100644
index 568ed67..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/ConstantOp.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.drill.plan.physical.operators;
-
-import org.apache.drill.plan.ast.Op;
-
-import java.util.Map;
-
-/**
- * Evaluates to a constant value.
- */
-public class ConstantOp extends EvalOperator {
- private Object value;
-
- public ConstantOp(double v) {
- value = v;
- }
-
- @Override
- public void link(Op op, Map<Integer, Operator> bindings) {
- // ignore
- }
-
- @Override
- public Object eval(Object data) {
- return value;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/DataListener.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/DataListener.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/DataListener.java
deleted file mode 100644
index 3648454..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/DataListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.drill.plan.physical.operators;
-
-/**
- * Describes a consumer of data.
- */
-public interface DataListener {
- public void notify(Object r);
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/EvalOperator.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/EvalOperator.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/EvalOperator.java
deleted file mode 100644
index d02cafe..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/EvalOperator.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.drill.plan.physical.operators;
-
-import org.apache.drill.plan.ast.Op;
-
-import java.util.Map;
-
-/**
- * Describes a scalar expression.
- */
-public abstract class EvalOperator extends Operator {
- public EvalOperator(Op op, Map<Integer, Operator> bindings, int inputArgs, int outputArgs) {
- super(op, bindings, inputArgs, outputArgs);
- }
-
- // only for Constants
- protected EvalOperator() {
- super();
- }
-
- public abstract Object eval(Object data);
-
- @Override
- public Schema getSchema() {
- throw new UnsupportedOperationException("Can't get schema from expression");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Explode.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Explode.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Explode.java
deleted file mode 100644
index 74bec49..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Explode.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.apache.drill.plan.physical.operators;
-
-import org.apache.drill.plan.ast.Arg;
-import org.apache.drill.plan.ast.Op;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Explode creates a secondary data flow that contains a batch of records for
- * each input record. Typically, Explode is paired with Implode which gathers
- * the results back together or with Aggregate which gathers results in a different
- * way. Cogroup, Explode, Aggregate gives a group by aggregate and
- * Explode, Filter, Implode gives sub-tree filtering.
- *
- * Explode has two outputs. One is a data source and one is a batch controller (source of batch
- * boundaries). Any downstream operator that delays emitting records should
- * listen to the batch boundaries to avoid having aggregate outputs that cross batch
- * boundaries.
- */
-public class Explode extends Operator implements DataListener {
- private String variableToExplode;
- private Schema schema;
- private Schema subSchema;
-
- public static void define() {
- Operator.defineOperator("explode", Explode.class);
- }
-
- public Explode(Op op, Map<Integer, Operator> bindings) {
- // exploded-data-stream, batch-controller := explode data-in, variable-name-to-explode
- super(op, bindings, 2, 1);
- }
-
- @Override
- public void link(Op op, Map<Integer, Operator> bindings) {
- List<Arg> in = op.getInputs();
- Operator data = bindings.get(in.get(0).asSymbol().getInt());
- data.addDataListener(this);
- schema = data.getSchema();
-
- variableToExplode = in.get(1).asString();
- subSchema = schema.getSubSchema(variableToExplode);
- }
-
- @Override
- public void notify(Object row) {
- // for each input we get, we iterate through our exploding variable
- for (Object value : schema.getIterable(variableToExplode, row)) {
- emit(value);
- }
- finishBatch(row);
- }
-
- @Override
- public Schema getSchema() {
- return subSchema;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Filter.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Filter.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Filter.java
deleted file mode 100644
index 423381b..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Filter.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.drill.plan.physical.operators;
-
-import org.apache.drill.plan.ast.Arg;
-import org.apache.drill.plan.ast.Op;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Selects records according to whether an expression evaluated on the records is true or non-zero.
- */
-public class Filter extends Operator implements DataListener {
-
- private Operator data;
-
- public static void define() {
- Operator.defineOperator("filter", Filter.class);
- }
-
- private EvalOperator filterExpression = null;
-
- public Filter(Op op, Map<Integer, Operator> bindings) {
- checkArity(op, 2, 1);
- List<Arg> outputs = op.getOutputs();
- if (outputs.size() != 1) {
- throw new IllegalArgumentException("filter operator should only have one output");
- }
- bindings.put(outputs.get(0).asSymbol().getInt(), this);
- }
-
- @Override
- public void link(Op op, Map<Integer, Operator> bindings) {
- List<Arg> inputs = op.getInputs();
- if (inputs.size() != 2) {
- throw new IllegalArgumentException("filter requires two inputs, a filter-expression and a data source. Got " + inputs.size());
- }
- filterExpression = (EvalOperator) bindings.get(inputs.get(0).asSymbol().getInt());
- data = bindings.get(inputs.get(1).asSymbol().getInt());
- data.addDataListener(this);
- }
-
- @Override
- public void notify(Object data) {
- Object r = filterExpression.eval(data);
- if (r instanceof Number) {
- if (((Number) r).doubleValue() != 0) {
- emit(data);
- }
- } else if (r instanceof Boolean) {
- if ((Boolean) r) {
- emit(data);
- }
- } else {
- throw new InvalidData(String.format("Invalid data type %s wanted number or boolean", data.getClass()));
- }
- }
-
- @Override
- public Schema getSchema() {
- return data.getSchema();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Implode.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Implode.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Implode.java
deleted file mode 100644
index 15f0f5b..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Implode.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.apache.drill.plan.physical.operators;
-
-import com.google.common.collect.Lists;
-import org.apache.drill.plan.ast.Arg;
-import org.apache.drill.plan.ast.Op;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Aggregate records into a list that is inserted into the parent record for the batch.
- */
-public class Implode extends Operator implements DataListener, BatchListener {
- private Operator data;
- private List<Object> accumulator = Lists.newArrayList();
- private Schema schema ;
- private String accumulatorVar;
-
- public static void define() {
- Operator.defineOperator("implode", Implode.class);
- }
-
- public Implode(Op op, Map<Integer, Operator> bindings) {
- // data-out, implode-var := implode data-in, batch-master
- super(op, bindings, 2, 2);
- }
-
- @Override
- public void link(Op op, Map<Integer, Operator> bindings) {
- List<Arg> in = op.getInputs();
- data = bindings.get(in.get(0).asSymbol().getInt());
- data.addDataListener(this);
-
-// schema = data.getSchema().overlay();
- schema = new JsonSchema();
- Operator batchController = bindings.get(in.get(1).asSymbol().getInt());
- batchController.addBatchListener(this);
-
- accumulatorVar = Operator.gensym();
- }
-
- @Override
- public Object eval() {
- return accumulatorVar;
- }
-
- @Override
- public Schema getSchema() {
- throw new UnsupportedOperationException("Default operation");
- }
-
- @Override
- public void notify(Object r) {
- accumulator.add(r);
- }
-
- @Override
- public void endBatch(Object parent) {
- schema.set(accumulatorVar, parent, accumulator);
- accumulator = Lists.newArrayList();
- emit(parent);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/InvalidData.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/InvalidData.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/InvalidData.java
deleted file mode 100644
index cf66f6e..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/InvalidData.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.drill.plan.physical.operators;
-
-/**
-* Thrown when data of the wrong type is encountered.
-*/
-class InvalidData extends RuntimeException {
- public InvalidData(String msg) {
- super(msg);
- }
-
- public InvalidData(String format, Object... args) {
- super(String.format(format, args));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/JsonSchema.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/JsonSchema.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/JsonSchema.java
deleted file mode 100644
index 19b750a..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/JsonSchema.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.apache.drill.plan.physical.operators;
-
-import com.google.common.base.Function;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Iterables;
-import com.google.gson.*;
-
-import javax.annotation.Nullable;
-import java.util.Collection;
-
-/**
-* Created with IntelliJ IDEA.
-* User: tdunning
-* Date: 10/19/12
-* Time: 5:01 PM
-* To change this template use File | Settings | File Templates.
-*/
-public class JsonSchema extends Schema {
- Splitter onDot = Splitter.on(".");
-
- @Override
- public Object get(String name, Object data) {
- JsonElement r = (JsonElement) data;
- Iterable<String> bits = onDot.split(name);
- for (String bit : bits) {
- r = ((JsonObject) data).get(bit);
- }
- return cleanupJsonisms(r);
- }
-
- @Override
- public <T> Iterable<T> getIterable(String name, Object data) {
- Object r = get(name, data);
- if (r instanceof JsonArray) {
- return Iterables.transform((JsonArray) r, new Function<JsonElement, T>() {
- @Override
- public T apply(@Nullable JsonElement jsonElement) {
- return (T) cleanupJsonisms(jsonElement);
- }
- });
- } else {
- throw new IllegalArgumentException("Looked for array but value was " + r.getClass());
- }
- }
-
- @Override
- public Schema getSubSchema(String name) {
- return new JsonSchema();
- }
-
- @Override
- public Schema overlay() {
- return this;
- }
-
- @Override
- public void set(String name, Object parent, Object value) {
- if (value instanceof Collection) {
- // input is likely to have been collected by Implode
- // TODO but what if something else built this? Do we need a general serialization framework?
- JsonArray r = new JsonArray();
- for (Object v : ((Collection) value)) {
- r.add((JsonElement) v);
- }
- ((JsonObject) parent).add(name, r);
- } else if (value instanceof Number) {
- ((JsonObject) parent).add(name, new JsonPrimitive((Number) value));
- } else {
- throw new IllegalArgumentException(String.format("Can't convert a %s to JSON by magic", value.getClass()));
- }
- }
-
- private Object cleanupJsonisms(JsonElement data) {
- if (data instanceof JsonPrimitive) {
- JsonPrimitive v = (JsonPrimitive) data;
- if (v.isNumber()) {
- return v.getAsDouble();
- } else if (v.isString()) {
- return v.getAsString();
- } else {
- return v.getAsBoolean();
- }
- } else {
- return data;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Operator.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Operator.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Operator.java
deleted file mode 100644
index 9c6c0cb..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Operator.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.drill.plan.physical.operators;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import org.apache.drill.plan.ast.Arg;
-import org.apache.drill.plan.ast.Op;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * Implements a function for an operator on a single line of the physical plan.
- * <p/>
- * The life cycle of an operator is
- * <nl>
- * <li>The operator's constructor is defined using Operator.defineOperator</li>
- * <li>The operator is constructed via Operator.create. It is expected that
- * the operator will fill in references to it's own outputs into the DAG bindings</li>
- * <li>The operator is linked by a call to its link() method. At this point, the
- * operator can look at its arguments and resolve references to its inputs.
- * This is when it should add itself as a data listener and when it should request
- * any schema that it needs from upstream Operator's.</li>
- * <li>The operator's run() method is called. Most operators should simply return at this
- * point, but data sources should start calling emit with data records.</li>
- * <li>The operator will be notified of incoming data. It should process this data
- * and emit the result.</li>
- * </nl>
- */
-public abstract class Operator {
- private static AtomicInteger genCount = new AtomicInteger(0);
- private static final Map<String, Class<? extends Operator>> operatorMap = Maps.newHashMap();
-
- public Operator(Op op, Map<Integer, Operator> bindings, int inputArgs, int outputArgs) {
- checkArity(op, inputArgs, outputArgs);
- for (Arg arg : op.getOutputs()) {
- bindings.put(arg.asSymbol().getInt(), this);
- }
- }
-
- // only for testing and constants
- protected Operator() {
- }
-
- static {
- ArithmeticOp.define();
- Bind.define();
- Filter.define();
- ScanJson.define();
- Explode.define();
- Implode.define();
- }
-
-
- public static void defineOperator(String name, Class<? extends Operator> clazz) {
- if (operatorMap.containsKey(name)) {
- throw new RuntimeException(String.format("Duplicate operator name for %s vs %s", clazz, operatorMap.get(name)));
- }
- operatorMap.put(name, clazz);
- }
-
- public static Operator create(Op op, Map<Integer, Operator> bindings) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
- Class<? extends Operator> c = operatorMap.get(op.getOp());
- if (c == null) {
- throw new IllegalArgumentException(String.format("No such operator as %s", op.getOp()));
- }
-
- Constructor<? extends Operator> con = c.getConstructor(Op.class, Map.class);
- return con.newInstance(op, bindings);
- }
-
-
- public static String gensym() {
- return String.format("__sym-%d", genCount.incrementAndGet());
- }
-
- private final List<DataListener> dataOut = Lists.newArrayList();
- private List<BatchListener> batchOut = Lists.newArrayList();
-
- public void addDataListener(DataListener listener) {
- this.dataOut.add(listener);
- }
-
- public void addBatchListener(BatchListener listener) {
- this.batchOut.add(listener);
- }
-
- protected void emit(Object r) {
- for (DataListener listener : dataOut) {
- listener.notify(r);
- }
- }
-
- protected void finishBatch(Object parent) {
- for (BatchListener listener : batchOut) {
- listener.endBatch(parent);
- }
- }
-
- public double evalAsDouble() {
- throw new UnsupportedOperationException("default no can do"); //To change body of created methods use File | Settings | File Templates.
- }
-
- public Object eval() {
- return null;
- }
-
- public abstract void link(Op op, Map<Integer, Operator> bindings);
-
- public void close() {
- // do nothing by default... over-ride for clever behavior
- }
-
- public abstract Schema getSchema();
-
- protected void checkArity(Op op, int inputArgs, int outputArgs) {
- List<Arg> in = op.getInputs();
- if (in.size() != inputArgs) {
- throw new IllegalArgumentException("bind should have exactly two arguments (an expression and a data source)");
- }
-
- List<Arg> out = op.getOutputs();
- if (out.size() != outputArgs) {
- throw new IllegalArgumentException(String.format("Operator should have exactly %d outputs, not %d", outputArgs, out.size()));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/ScanJson.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/ScanJson.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/ScanJson.java
deleted file mode 100644
index 0b699c3..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/ScanJson.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.drill.plan.physical.operators;
-
-import com.google.common.base.Charsets;
-import com.google.common.io.Files;
-import com.google.common.io.InputSupplier;
-import com.google.common.io.Resources;
-import com.google.gson.*;
-import org.apache.drill.plan.ast.Arg;
-import org.apache.drill.plan.ast.Op;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-
-/**
- * Reads JSON formatted records from a file.
- */
-public class ScanJson extends Operator implements Callable<Object> {
-
- public static void define() {
- Operator.defineOperator("scan-json", ScanJson.class);
- }
-
- private InputSupplier<InputStreamReader> input;
-
- public ScanJson(Op op, Map<Integer, Operator> bindings) {
- List<Arg> in = op.getInputs();
- if (in.size() != 1) {
- throw new IllegalArgumentException("scan-json should have exactly one argument (a file name)");
- }
- String inputName = in.get(0).asString();
- if (inputName.startsWith("resource:")) {
- input = Resources.newReaderSupplier(Resources.getResource(inputName.substring(inputName.indexOf(':') + 1)), Charsets.UTF_8);
- } else {
- input = Files.newReaderSupplier(new File(inputName), Charsets.UTF_8);
- }
-
- List<Arg> out = op.getOutputs();
- if (out.size() != 1) {
- throw new IllegalArgumentException("scan-json should have exactly one output");
- }
- bindings.put(out.get(0).asSymbol().getInt(), this);
- }
-
- public ScanJson(InputSupplier<InputStreamReader> input) throws IOException {
- this.input = input;
- }
-
- public static ScanJson create(InputSupplier<InputStreamReader> input) throws IOException {
- return new ScanJson(input);
- }
-
- @Override
- public void link(Op next, Map<Integer, Operator> bindings) {
- // nothing to look for
- }
-
- @Override
- public Object call() throws IOException {
- int count = 0;
- Reader in = input.getInput();
- JsonStreamParser jp = new JsonStreamParser(in);
- while (jp.hasNext()) {
- JsonElement r = jp.next();
- emit(r);
- count++;
- }
- in.close();
- // TODO what should the parent record be at the top-level?
- finishBatch(null);
-
- return count;
- }
-
- @Override
- public Schema getSchema() {
- return new JsonSchema();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Schema.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Schema.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Schema.java
deleted file mode 100644
index 424c715..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/Schema.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.drill.plan.physical.operators;
-
-/**
- * Describes a schema. In this context a schema is what understands how to get data
- * into and out of a record. For JSON, the schema is pretty dumb, but for other data types it
- * could be quite clever.
- */
-public abstract class Schema {
- public abstract Object get(String name, Object data);
-
- public abstract <T> Iterable<? extends T> getIterable(String name, Object data);
-
- public abstract Schema getSubSchema(String name);
-
- public abstract Schema overlay();
-
- public abstract void set(String name, Object parent, Object value);
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/SchemaListener.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/SchemaListener.java b/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/SchemaListener.java
deleted file mode 100644
index 719c065..0000000
--- a/sandbox/plan-parser/src/main/java/org/apache/drill/plan/physical/operators/SchemaListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.drill.plan.physical.operators;
-
-/**
- * Describes an object that accepts updates on schema's.
- */
-public interface SchemaListener {
- public void notify(Schema s);
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/java/org/apache/drill/plan/ParsePlanTest.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/ParsePlanTest.java b/sandbox/plan-parser/src/test/java/org/apache/drill/plan/ParsePlanTest.java
deleted file mode 100644
index 7c4d6c4..0000000
--- a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/ParsePlanTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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.drill.plan;
-
-import com.google.common.base.Charsets;
-import com.google.common.collect.Lists;
-import com.google.common.io.Resources;
-import org.antlr.runtime.ANTLRReaderStream;
-import org.antlr.runtime.MissingTokenException;
-import org.antlr.runtime.Token;
-import org.apache.drill.plan.ast.LogicalPlanParseException;
-import org.apache.drill.plan.ast.Plan;
-import org.apache.drill.plan.ast.PlanLexer;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Iterator;
-import java.util.List;
-
-import static junit.framework.Assert.*;
-
-public class ParsePlanTest {
- @Test
- public void testParse1() throws ParsePlan.ParseException {
- Plan r = ParsePlan.parseResource("plan1.drillx");
- assertEquals("Lines", 3, r.getStatements().size());
- }
-
- @Test
- public void testParse2() throws ParsePlan.ParseException {
- Plan r = ParsePlan.parseResource("plan2.drillx");
- assertEquals("Lines", 6, r.getStatements().size());
- }
-
- @Test
- public void testParse3() throws ParsePlan.ParseException {
- Plan r = ParsePlan.parseResource("plan3.drillx");
- assertEquals("Lines", 8, r.getStatements().size());
- }
-
- @Test
- public void testParseError1() throws ParsePlan.ParseException {
- try {
- ParsePlan.parseResource("bad-plan1.drillx");
- fail("Should have thrown exception");
- } catch (ParsePlan.ValidationException e) {
- assertTrue(e.getMessage().contains("%2 used more than once"));
- assertTrue(e.getMessage().contains("Undefined reference to %3"));
- }
- }
-
- @Test
- public void testParseError2() throws ParsePlan.ParseException {
- try {
- ParsePlan.parseResource("bad-plan2.drillx");
- fail("Should have thrown exception");
- } catch (LogicalPlanParseException e) {
- assertTrue(e.getCause() instanceof MissingTokenException);
- MissingTokenException ex = ((MissingTokenException) e.getCause());
- assertEquals(1, ex.line);
- assertEquals(6, ex.charPositionInLine);
- }
- }
-
-
- @Test
- public void testLexer() throws IOException {
- List<String> ref = Lists.newArrayList(
- "%3", ",", "%4", ":=", "explode", "\"data\"", ",", "\"var-to-explode\"", "\n",
- "%5", ":=", "modify", "%4", "\n",
- "%6", ",", "%7", ":=", "flatten", "%3", ",", "%5", "\n");
-
- InputStreamReader inStream = Resources.newReaderSupplier(Resources.getResource("plan1.drillx"), Charsets.UTF_8).getInput();
- PlanLexer lex = new PlanLexer(new ANTLRReaderStream(inStream));
- Token t = lex.nextToken();
- Iterator<String> i = ref.iterator();
- while (t != null && t.getType() != -1) {
- if (t.getChannel() != 99) {
- assertEquals(i.next(), t.getText());
- }
- t = lex.nextToken();
- }
- inStream.close();
-
- }
-
- @Test
- public void testLexer2() throws IOException {
- List<String> ref = Lists.newArrayList(
- "%1", ":=", "scan-json", "\"table-1\"", "EOL",
- "EOL",
- "%2", ":=", "bind", "\"x\"", ",", "%1", "EOL",
- "EOL",
- "EOL",
- "%3", ":=", "bind", "\"y\"", ",", "%2", "EOL",
- "%4", ":=", ">", "%2", ",", "3", "EOL",
- "%5", ":=", "filter", "%4", ",", "%1", "EOL",
- "%6", ":=", "project", "%5", ",", "%2", ",", "%3", "EOL");
-
- InputStreamReader inStream = Resources.newReaderSupplier(Resources.getResource("plan2.drillx"), Charsets.UTF_8).getInput();
- PlanLexer lex = new PlanLexer(new ANTLRReaderStream(inStream));
- Token t = lex.nextToken();
- Iterator<String> i = ref.iterator();
- while (t != null && t.getType() != -1) {
- if (t.getChannel() != 99) {
- String tokenText = t.getText();
- if (t.getText().equals("\n")) {
- tokenText = "EOL";
- }
- assertEquals(i.next(), tokenText);
- }
- t = lex.nextToken();
- }
- inStream.close();
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/java/org/apache/drill/plan/PhysicalInterpreterTest.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/PhysicalInterpreterTest.java b/sandbox/plan-parser/src/test/java/org/apache/drill/plan/PhysicalInterpreterTest.java
deleted file mode 100644
index 77a9e57..0000000
--- a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/PhysicalInterpreterTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.drill.plan;
-
-import org.apache.drill.plan.ast.Plan;
-import org.junit.Test;
-
-public class PhysicalInterpreterTest {
- @Test
- public void testTrivialPlan() throws PhysicalInterpreter.InterpreterException, ParsePlan.ParseException {
- run("physical-1.drillx");
- }
-
- @Test
- public void testExplodeFilter() throws PhysicalInterpreter.InterpreterException, ParsePlan.ParseException {
- run("physical-2.drillx");
- }
-
- private void run(String name) throws ParsePlan.ParseException, PhysicalInterpreter.SetupException, PhysicalInterpreter.QueryException {
- Plan p = ParsePlan.parseResource(name);
- PhysicalInterpreter pi = new PhysicalInterpreter(p);
- pi.run();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/ExplodeTest.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/ExplodeTest.java b/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/ExplodeTest.java
deleted file mode 100644
index ba7785d..0000000
--- a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/ExplodeTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.apache.drill.plan.json;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.base.Charsets;
-import com.google.common.base.Joiner;
-import com.google.common.io.Resources;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * Created with IntelliJ IDEA.
- * User: tdunning
- * Date: 11/20/12
- * Time: 4:40 PM
- * To change this template use File | Settings | File Templates.
- */
-public class ExplodeTest {
- @Test
- public void testSum() {
-
- }
-
- @Test
- public void testJackson() throws ClassNotFoundException, InvocationTargetException, IOException, NoSuchMethodException, IllegalAccessException, InstantiationException {
- Joiner withNewlines = Joiner.on("\n");
- JsonObject spec = new JsonParser().parse(withNewlines.join(Resources.readLines(Resources.getResource("explode-flow.json"), Charsets.UTF_8))).getAsJsonObject();
- Consumer scanner = Utils.create(spec);
-
- ObjectMapper mapper = new ObjectMapper();
- //ALLOW_UNQUOTED_FIELD_NAMES
-
- System.out.printf("%s\n", mapper.writeValueAsString(scanner));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/FilterTest.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/FilterTest.java b/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/FilterTest.java
deleted file mode 100644
index 5598ffc..0000000
--- a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/FilterTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.apache.drill.plan.json;
-
-import com.google.common.io.Resources;
-import junit.framework.Assert;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-import static junit.framework.Assert.assertEquals;
-
-/**
- * Created with IntelliJ IDEA.
- * User: tdunning
- * Date: 11/19/12
- * Time: 5:41 PM
- * To change this template use File | Settings | File Templates.
- */
-public class FilterTest {
- @Test
- public void integerTest() throws IOException, InvocationTargetException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException {
- List<Tuple> tuples = TestUtils.runFlow(Resources.getResource("filter-flow.json"));
- assertEquals(1, tuples.size());
- assertEquals(2, tuples.get(0).get("a"));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/ScanTest.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/ScanTest.java b/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/ScanTest.java
deleted file mode 100644
index f98091e..0000000
--- a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/ScanTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.apache.drill.plan.json;
-
-import org.junit.Test;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-import static junit.framework.Assert.assertEquals;
-
-public class ScanTest {
- @Test
- public void scan() throws InvocationTargetException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, IOException {
- List<Tuple> tuples = TestUtils.runFlow("{type='scan', resource='test1.csv'}");
- Tuple x = tuples.get(0);
- assertEquals(1, (Integer) x.get("a"), 0);
- assertEquals("xyz", x.get("b"));
- assertEquals(3.1, (Double) x.get("c"), 0);
-
- x = tuples.get(1);
- assertEquals(2, (Integer) x.get("a"), 0);
- assertEquals("qrtz", x.get("b"));
- assertEquals(21, (Integer) x.get("c"), 0);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/TestUtils.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/TestUtils.java b/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/TestUtils.java
deleted file mode 100644
index aca7b70..0000000
--- a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/TestUtils.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.apache.drill.plan.json;
-
-import com.google.common.base.Charsets;
-import com.google.common.base.Joiner;
-import com.google.common.io.Resources;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.util.List;
-
-/**
- * Created with IntelliJ IDEA.
- * User: tdunning
- * Date: 11/19/12
- * Time: 5:44 PM
- * To change this template use File | Settings | File Templates.
- */
-public class TestUtils {
- static List<Tuple> runFlow(String json) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException, IOException {
- JsonObject spec = new JsonParser().parse(json).getAsJsonObject();
- Consumer scanner = Utils.create(spec);
- TupleCollector tc = new TupleCollector();
- scanner.connect(tc);
- scanner.start();
- scanner.end();
-
- return tc.getTuples();
- }
-
- public static List<Tuple> runFlow(URL resource) throws IOException, InvocationTargetException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException {
- Joiner withNewlines = Joiner.on("\n");
- return runFlow(withNewlines.join(Resources.readLines(resource, Charsets.UTF_8)));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/TupleCollector.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/TupleCollector.java b/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/TupleCollector.java
deleted file mode 100644
index e188e6d..0000000
--- a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/json/TupleCollector.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.apache.drill.plan.json;
-
-import com.google.common.collect.Lists;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-/**
-* Created with IntelliJ IDEA.
-* User: tdunning
-* Date: 11/19/12
-* Time: 5:40 PM
-* To change this template use File | Settings | File Templates.
-*/
-public class TupleCollector extends Consumer {
- private List<Tuple> tuples = Lists.newArrayList();
-
- @Override
- public void push(Tuple t) throws InvocationTargetException {
- tuples.add(t);
- }
-
- public List<Tuple> getTuples() {
- return tuples;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/java/org/apache/drill/plan/physical/operators/ScanJsonTest.java
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/physical/operators/ScanJsonTest.java b/sandbox/plan-parser/src/test/java/org/apache/drill/plan/physical/operators/ScanJsonTest.java
deleted file mode 100644
index 7911a45..0000000
--- a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/physical/operators/ScanJsonTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.drill.plan.physical.operators;
-
-import com.google.common.base.Charsets;
-import com.google.common.io.Resources;
-import org.junit.Test;
-
-import java.io.IOException;
-
-public class ScanJsonTest {
- @Test
- public void test1() throws IOException {
- ScanJson in = ScanJson.create(Resources.newReaderSupplier(Resources.getResource("data1.json"), Charsets.UTF_8));
- in.call();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/resources/bad-plan1.drillx
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/resources/bad-plan1.drillx b/sandbox/plan-parser/src/test/resources/bad-plan1.drillx
deleted file mode 100644
index efa98e2..0000000
--- a/sandbox/plan-parser/src/test/resources/bad-plan1.drillx
+++ /dev/null
@@ -1,3 +0,0 @@
-%1 := scan-json "table-1" # normal
-%2 := bind "x", %3 # undefined reference
-%2 := bind "y", %2 # duplicate def
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/resources/bad-plan2.drillx
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/resources/bad-plan2.drillx b/sandbox/plan-parser/src/test/resources/bad-plan2.drillx
deleted file mode 100644
index db49ad7..0000000
--- a/sandbox/plan-parser/src/test/resources/bad-plan2.drillx
+++ /dev/null
@@ -1 +0,0 @@
-%3 := "bind" "y", %2 # Op in quotes
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/resources/data1.json
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/resources/data1.json b/sandbox/plan-parser/src/test/resources/data1.json
deleted file mode 100644
index faff8fd..0000000
--- a/sandbox/plan-parser/src/test/resources/data1.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{"a":1, "b":2}
-{"a":2, "b":2}
-{"a":3, "b":2}
-{"a":4, "b":2}
-
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/resources/data2.json
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/resources/data2.json b/sandbox/plan-parser/src/test/resources/data2.json
deleted file mode 100644
index ba3f74d..0000000
--- a/sandbox/plan-parser/src/test/resources/data2.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{"x":[{"a":1, "b":2}, {"a":2, "b":2}, {"a":3, "b":2}, {"a":4, "b":2}], "y":[{"a":4, "b":2}]}
-{"x":[{"a":5, "b":2}, {"a":4, "b":2}, {"a":3, "b":2}, {"a":2, "b":2}], "y":[{"a":5, "b":2}, {"a":4, "b":2}]}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/resources/explode-flow.json
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/resources/explode-flow.json b/sandbox/plan-parser/src/test/resources/explode-flow.json
deleted file mode 100644
index 74f93c2..0000000
--- a/sandbox/plan-parser/src/test/resources/explode-flow.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- type:"sequence",
- do:[
- {
- type:"scan",
- resource:"iris.csv"
- },
- {
- type:"group",
- by:"Species",
- as:"cnt",
- do:[
- {
- type:"sequence",
- do:[
- {
- type="filter",
- vars="Sepal.Length",
- types="double",
- if="Sepal.Length > 5"
- },
- {
- type:"aggregate",
- update:"count"
- }
- ]
- }
- ]
-
- }
- ]
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/resources/filter-flow.json
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/resources/filter-flow.json b/sandbox/plan-parser/src/test/resources/filter-flow.json
deleted file mode 100644
index e14669d..0000000
--- a/sandbox/plan-parser/src/test/resources/filter-flow.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- type:"sequence",
- do:[
- {
- type:"scan",
- resource:"test1.csv"
- },
- {
- type:"filter",
- vars:"a",
- types:"int",
- if:"a > 1"
- }
- ]
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/resources/iris.csv
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/resources/iris.csv b/sandbox/plan-parser/src/test/resources/iris.csv
deleted file mode 100644
index fc3f15e..0000000
--- a/sandbox/plan-parser/src/test/resources/iris.csv
+++ /dev/null
@@ -1,151 +0,0 @@
-Sepal.Length,Sepal.Width,Petal.Length,Petal.Width,Species
-5.1,3.5,1.4,0.2,setosa
-4.9,3.0,1.4,0.2,setosa
-4.7,3.2,1.3,0.2,setosa
-4.6,3.1,1.5,0.2,setosa
-5.0,3.6,1.4,0.2,setosa
-5.4,3.9,1.7,0.4,setosa
-4.6,3.4,1.4,0.3,setosa
-5.0,3.4,1.5,0.2,setosa
-4.4,2.9,1.4,0.2,setosa
-4.9,3.1,1.5,0.1,setosa
-5.4,3.7,1.5,0.2,setosa
-4.8,3.4,1.6,0.2,setosa
-4.8,3.0,1.4,0.1,setosa
-4.3,3.0,1.1,0.1,setosa
-5.8,4.0,1.2,0.2,setosa
-5.7,4.4,1.5,0.4,setosa
-5.4,3.9,1.3,0.4,setosa
-5.1,3.5,1.4,0.3,setosa
-5.7,3.8,1.7,0.3,setosa
-5.1,3.8,1.5,0.3,setosa
-5.4,3.4,1.7,0.2,setosa
-5.1,3.7,1.5,0.4,setosa
-4.6,3.6,1.0,0.2,setosa
-5.1,3.3,1.7,0.5,setosa
-4.8,3.4,1.9,0.2,setosa
-5.0,3.0,1.6,0.2,setosa
-5.0,3.4,1.6,0.4,setosa
-5.2,3.5,1.5,0.2,setosa
-5.2,3.4,1.4,0.2,setosa
-4.7,3.2,1.6,0.2,setosa
-4.8,3.1,1.6,0.2,setosa
-5.4,3.4,1.5,0.4,setosa
-5.2,4.1,1.5,0.1,setosa
-5.5,4.2,1.4,0.2,setosa
-4.9,3.1,1.5,0.2,setosa
-5.0,3.2,1.2,0.2,setosa
-5.5,3.5,1.3,0.2,setosa
-4.9,3.6,1.4,0.1,setosa
-4.4,3.0,1.3,0.2,setosa
-5.1,3.4,1.5,0.2,setosa
-5.0,3.5,1.3,0.3,setosa
-4.5,2.3,1.3,0.3,setosa
-4.4,3.2,1.3,0.2,setosa
-5.0,3.5,1.6,0.6,setosa
-5.1,3.8,1.9,0.4,setosa
-4.8,3.0,1.4,0.3,setosa
-5.1,3.8,1.6,0.2,setosa
-4.6,3.2,1.4,0.2,setosa
-5.3,3.7,1.5,0.2,setosa
-5.0,3.3,1.4,0.2,setosa
-7.0,3.2,4.7,1.4,versicolor
-6.4,3.2,4.5,1.5,versicolor
-6.9,3.1,4.9,1.5,versicolor
-5.5,2.3,4.0,1.3,versicolor
-6.5,2.8,4.6,1.5,versicolor
-5.7,2.8,4.5,1.3,versicolor
-6.3,3.3,4.7,1.6,versicolor
-4.9,2.4,3.3,1.0,versicolor
-6.6,2.9,4.6,1.3,versicolor
-5.2,2.7,3.9,1.4,versicolor
-5.0,2.0,3.5,1.0,versicolor
-5.9,3.0,4.2,1.5,versicolor
-6.0,2.2,4.0,1.0,versicolor
-6.1,2.9,4.7,1.4,versicolor
-5.6,2.9,3.6,1.3,versicolor
-6.7,3.1,4.4,1.4,versicolor
-5.6,3.0,4.5,1.5,versicolor
-5.8,2.7,4.1,1.0,versicolor
-6.2,2.2,4.5,1.5,versicolor
-5.6,2.5,3.9,1.1,versicolor
-5.9,3.2,4.8,1.8,versicolor
-6.1,2.8,4.0,1.3,versicolor
-6.3,2.5,4.9,1.5,versicolor
-6.1,2.8,4.7,1.2,versicolor
-6.4,2.9,4.3,1.3,versicolor
-6.6,3.0,4.4,1.4,versicolor
-6.8,2.8,4.8,1.4,versicolor
-6.7,3.0,5.0,1.7,versicolor
-6.0,2.9,4.5,1.5,versicolor
-5.7,2.6,3.5,1.0,versicolor
-5.5,2.4,3.8,1.1,versicolor
-5.5,2.4,3.7,1.0,versicolor
-5.8,2.7,3.9,1.2,versicolor
-6.0,2.7,5.1,1.6,versicolor
-5.4,3.0,4.5,1.5,versicolor
-6.0,3.4,4.5,1.6,versicolor
-6.7,3.1,4.7,1.5,versicolor
-6.3,2.3,4.4,1.3,versicolor
-5.6,3.0,4.1,1.3,versicolor
-5.5,2.5,4.0,1.3,versicolor
-5.5,2.6,4.4,1.2,versicolor
-6.1,3.0,4.6,1.4,versicolor
-5.8,2.6,4.0,1.2,versicolor
-5.0,2.3,3.3,1.0,versicolor
-5.6,2.7,4.2,1.3,versicolor
-5.7,3.0,4.2,1.2,versicolor
-5.7,2.9,4.2,1.3,versicolor
-6.2,2.9,4.3,1.3,versicolor
-5.1,2.5,3.0,1.1,versicolor
-5.7,2.8,4.1,1.3,versicolor
-6.3,3.3,6.0,2.5,virginica
-5.8,2.7,5.1,1.9,virginica
-7.1,3.0,5.9,2.1,virginica
-6.3,2.9,5.6,1.8,virginica
-6.5,3.0,5.8,2.2,virginica
-7.6,3.0,6.6,2.1,virginica
-4.9,2.5,4.5,1.7,virginica
-7.3,2.9,6.3,1.8,virginica
-6.7,2.5,5.8,1.8,virginica
-7.2,3.6,6.1,2.5,virginica
-6.5,3.2,5.1,2.0,virginica
-6.4,2.7,5.3,1.9,virginica
-6.8,3.0,5.5,2.1,virginica
-5.7,2.5,5.0,2.0,virginica
-5.8,2.8,5.1,2.4,virginica
-6.4,3.2,5.3,2.3,virginica
-6.5,3.0,5.5,1.8,virginica
-7.7,3.8,6.7,2.2,virginica
-7.7,2.6,6.9,2.3,virginica
-6.0,2.2,5.0,1.5,virginica
-6.9,3.2,5.7,2.3,virginica
-5.6,2.8,4.9,2.0,virginica
-7.7,2.8,6.7,2.0,virginica
-6.3,2.7,4.9,1.8,virginica
-6.7,3.3,5.7,2.1,virginica
-7.2,3.2,6.0,1.8,virginica
-6.2,2.8,4.8,1.8,virginica
-6.1,3.0,4.9,1.8,virginica
-6.4,2.8,5.6,2.1,virginica
-7.2,3.0,5.8,1.6,virginica
-7.4,2.8,6.1,1.9,virginica
-7.9,3.8,6.4,2.0,virginica
-6.4,2.8,5.6,2.2,virginica
-6.3,2.8,5.1,1.5,virginica
-6.1,2.6,5.6,1.4,virginica
-7.7,3.0,6.1,2.3,virginica
-6.3,3.4,5.6,2.4,virginica
-6.4,3.1,5.5,1.8,virginica
-6.0,3.0,4.8,1.8,virginica
-6.9,3.1,5.4,2.1,virginica
-6.7,3.1,5.6,2.4,virginica
-6.9,3.1,5.1,2.3,virginica
-5.8,2.7,5.1,1.9,virginica
-6.8,3.2,5.9,2.3,virginica
-6.7,3.3,5.7,2.5,virginica
-6.7,3.0,5.2,2.3,virginica
-6.3,2.5,5.0,1.9,virginica
-6.5,3.0,5.2,2.0,virginica
-6.2,3.4,5.4,2.3,virginica
-5.9,3.0,5.1,1.8,virginica
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/resources/physical-1.drillx
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/resources/physical-1.drillx b/sandbox/plan-parser/src/test/resources/physical-1.drillx
deleted file mode 100644
index 0d1707e..0000000
--- a/sandbox/plan-parser/src/test/resources/physical-1.drillx
+++ /dev/null
@@ -1,4 +0,0 @@
-%1 := scan-json "resource:data1.json"
-%2 := bind "a", %1
-%3 := < %2, 3
-%4 := filter %3, %1
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/resources/physical-2.drillx
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/resources/physical-2.drillx b/sandbox/plan-parser/src/test/resources/physical-2.drillx
deleted file mode 100644
index 14924c7..0000000
--- a/sandbox/plan-parser/src/test/resources/physical-2.drillx
+++ /dev/null
@@ -1,7 +0,0 @@
-# sub-tree filtering
-%1 := scan-json "resource:data2.json"
-%2 := explode %1, "x"
-%4 := bind "a", %2
-%5 := > %4, 3
-%6 := filter %5, %2
-%7,%8 := implode %6, %2
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/resources/plan1.drillx
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/resources/plan1.drillx b/sandbox/plan-parser/src/test/resources/plan1.drillx
deleted file mode 100644
index 2b35353..0000000
--- a/sandbox/plan-parser/src/test/resources/plan1.drillx
+++ /dev/null
@@ -1,3 +0,0 @@
-%3, %4 := explode "data", "var-to-explode"
-%5 := modify %4
-%6, %7 := flatten %3, %5
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/resources/plan2.drillx
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/resources/plan2.drillx b/sandbox/plan-parser/src/test/resources/plan2.drillx
deleted file mode 100644
index 49e7b5a..0000000
--- a/sandbox/plan-parser/src/test/resources/plan2.drillx
+++ /dev/null
@@ -1,9 +0,0 @@
-%1 := scan-json "table-1" # from table-1
-
-%2 := bind "x", %1 # variable x
-
-# full-line comment
-%3 := bind "y", %2 # and y
-%4 := > %2, 3 # where x > 3
-%5 := filter %4, %1 # apply the filter
-%6 := project %5, %2, %3 # select columns for final output
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/resources/plan3.drillx
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/resources/plan3.drillx b/sandbox/plan-parser/src/test/resources/plan3.drillx
deleted file mode 100644
index 7f3ae43..0000000
--- a/sandbox/plan-parser/src/test/resources/plan3.drillx
+++ /dev/null
@@ -1,11 +0,0 @@
-#comment taking up a full line
-
-# and then a blank line
-%1 := scan-json "table-1" # from table-1
-%2 := bind "a.x", %1 # we will sum a.x
-%3 := > %2, 3 # where x > 3
-%4 := filter %3, %1 # apply the filter
-%5 := aggregate "sum", %3, %2, %4
-%6 := as %5, "total", %4 # rename total
-%7 := bind "total", %6 # set up final select
-%9 := project %4, %6
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/resources/plan4.drillx
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/resources/plan4.drillx b/sandbox/plan-parser/src/test/resources/plan4.drillx
deleted file mode 100644
index b78e2fc..0000000
--- a/sandbox/plan-parser/src/test/resources/plan4.drillx
+++ /dev/null
@@ -1,13 +0,0 @@
-%1 := scan-json �table-1�
-%2 := bind �y�, %1
-%3 := bind �z�, %1
-%4,%5 := group %1, %2, %3 # group by y, z, group ref in %5
-%6 := explode %4, %5 # aggregate on group value
-%7 := bind �x�, %6 # sum(x), note where ref is bound
-%8 := aggregate �sum�, %6, %7
-%9,%10:= flatten %4, %8 # splice result back into data
-%11 := as %10, �s�, %9 # name the aggregated result
-%12 := bind �s�, %11
-%13 := bind �y�, %11
-%14 := bind �z�, %11
-%14 := project %11, %12, %13, %14 # select s,y,z
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/plan-parser/src/test/resources/test1.csv
----------------------------------------------------------------------
diff --git a/sandbox/plan-parser/src/test/resources/test1.csv b/sandbox/plan-parser/src/test/resources/test1.csv
deleted file mode 100644
index efe694c..0000000
--- a/sandbox/plan-parser/src/test/resources/test1.csv
+++ /dev/null
@@ -1,3 +0,0 @@
-a,b,c
-1,"xyz", 3.1
-2, 'qrtz', 21
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/479ddad7/sandbox/query-parser/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/query-parser/pom.xml b/sandbox/query-parser/pom.xml
deleted file mode 100644
index 22d6c59..0000000
--- a/sandbox/query-parser/pom.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>query-parser</groupId>
- <artifactId>query-parser</artifactId>
- <version>0.1-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>10.0.1</version>
- </dependency>
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr</artifactId>
- <version>3.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-io</artifactId>
- <version>1.3.2</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.2</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.antlr</groupId>
- <artifactId>antlr3-maven-plugin</artifactId>
- <version>3.4</version>
-
- <executions>
- <execution>
- <id>antlr-generate</id>
- <!-- this is used for inheritance merges -->
- <phase>generate-sources</phase>
- <!-- bind to the packaging phase -->
- <goals>
- <goal>antlr</goal>
- </goals>
- </execution>
- </executions>
-
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.5.1</version>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>