You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by td...@apache.org on 2012/12/02 00:47:45 UTC

[2/7] git commit: Add license headers. Updated operators to better match documentation, mostly immutable now.

Add license headers.  Updated operators to better match documentation, mostly immutable now.


Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/af71b127
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/af71b127
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/af71b127

Branch: refs/heads/DRILL-3
Commit: af71b1278d1ac55d9a4a40e2d2fe81568f0ccb50
Parents: eaa84d6
Author: Jacques Nadeau <ja...@gmail.com>
Authored: Thu Nov 29 19:04:21 2012 -0800
Committer: Jacques Nadeau <ja...@gmail.com>
Committed: Thu Nov 29 19:04:21 2012 -0800

----------------------------------------------------------------------
 .../drill/common/expression/parser/ExprLexer.g     |   20 +++-
 .../drill/common/expression/parser/ExprParser.g    |   17 +++
 .../drill/common/expression/BooleanFunctions.java  |   17 +++
 .../org/apache/drill/common/expression/Cast.java   |   17 +++
 .../apache/drill/common/expression/DataType.java   |   75 +++++++----
 .../common/expression/ExpressionFunction.java      |   20 +++-
 .../expression/ExpressionValidationError.java      |   17 +++
 .../drill/common/expression/FieldReference.java    |   23 +++-
 .../drill/common/expression/FunctionBase.java      |   17 +++
 .../common/expression/FunctionDefinition.java      |   44 ++++++
 .../drill/common/expression/FunctionName.java      |   17 +++
 .../drill/common/expression/IfExpression.java      |   17 +++
 .../drill/common/expression/LogicalExpression.java |   17 +++
 .../common/expression/LogicalExpressionBase.java   |   17 +++
 .../drill/common/expression/MathFunction.java      |   21 +++-
 .../drill/common/expression/StringFunctions.java   |   20 +++-
 .../drill/common/expression/TypeFunctions.java     |   17 +++
 .../drill/common/expression/UnaryFunctions.java    |   17 +++
 .../drill/common/expression/ValueExpressions.java  |   17 +++
 .../expression/aggregate/BasicAggregates.java      |   17 +++
 .../common/expression/visitors/BasicEvaluator.java |   17 +++
 .../expression/visitors/FunctionVisitor.java       |   17 +++
 .../common/expression/visitors/GetIdentifiers.java |   17 +++
 .../common/expression/visitors/OpVisitor.java      |   17 +++
 .../org/apache/drill/common/logical/FieldName.java |   17 +++
 .../org/apache/drill/common/logical/FlowInput.java |   17 +++
 .../apache/drill/common/logical/FlowOutput.java    |   17 +++
 .../apache/drill/common/logical/LogicalPlan.java   |   17 +++
 .../apache/drill/common/logical/OperatorGraph.java |   17 +++
 .../drill/common/logical/OperatorRegistry.java     |    5 -
 .../drill/common/logical/OperatorResolver.java     |    5 -
 .../drill/common/logical/PlanProperties.java       |   17 +++
 .../common/logical/UnexpectedOperatorType.java     |   17 +++
 .../drill/common/logical/ValidationError.java      |   17 +++
 .../drill/common/logical/data/Aggregate.java       |   56 ++++++++
 .../apache/drill/common/logical/data/Cogroup.java  |   38 +++++
 .../apache/drill/common/logical/data/Combine.java  |   38 -----
 .../apache/drill/common/logical/data/Explode.java  |   32 -----
 .../apache/drill/common/logical/data/Filter.java   |   33 +++++-
 .../apache/drill/common/logical/data/Flatten.java  |   52 +++++++-
 .../apache/drill/common/logical/data/Group.java    |   19 ---
 .../apache/drill/common/logical/data/Grouping.java |   46 ++++++
 .../org/apache/drill/common/logical/data/Join.java |   89 ++++++++----
 .../apache/drill/common/logical/data/Limit.java    |   46 ++++++
 .../drill/common/logical/data/LogicalOperator.java |   26 +++-
 .../common/logical/data/LogicalOperatorBase.java   |   33 ++++-
 .../drill/common/logical/data/NamedExpression.java |   47 ++++++
 .../org/apache/drill/common/logical/data/Nest.java |   21 ---
 .../logical/data/OperatorListDeserializer.java     |  109 ---------------
 .../apache/drill/common/logical/data/Order.java    |   85 ++++++++++--
 .../apache/drill/common/logical/data/Project.java  |   37 ++++--
 .../org/apache/drill/common/logical/data/Scan.java |   43 +++++-
 .../apache/drill/common/logical/data/Sequence.java |   18 +++-
 .../common/logical/data/SingleInputOperator.java   |   22 +++-
 .../drill/common/logical/data/SinkOperator.java    |   23 +++-
 .../drill/common/logical/data/SourceOperator.java  |   17 +++
 .../drill/common/logical/data/Transform.java       |   40 ++++--
 .../apache/drill/common/logical/data/Union.java    |   38 ++++-
 .../drill/common/logical/data/WindowFrame.java     |   89 ++++++++++++
 .../drill/common/logical/graph/AdjacencyList.java  |   19 +++-
 .../apache/drill/common/logical/graph/Edge.java    |   19 +++-
 .../drill/common/logical/graph/GraphAlgos.java     |   17 +++
 .../apache/drill/common/logical/graph/Node.java    |   19 +++-
 .../drill/common/logical/sources/DataSource.java   |   17 +++
 .../common/logical/sources/DataSourceBase.java     |   17 +++
 .../apache/drill/common/logical/sources/Mongo.java |   17 +++
 .../apache/drill/common/logical/sources/Mysql.java |   17 +++
 .../apache/drill/common/logical/sources/Text.java  |   17 +++
 .../logical/sources/record/FirstRowMaker.java      |   17 +++
 .../common/logical/sources/record/RecordMaker.java |   17 +++
 .../logical/sources/record/RecordMakerBase.java    |   17 +++
 .../apache/drill/common/physical/Partitioner.java  |   17 +++
 .../drill/common/physical/PhysicalOperator.java    |   17 +++
 .../apache/drill/common/physical/PhysicalPlan.java |   17 +++
 .../common/physical/RowBatchReceiverSource.java    |   17 +++
 .../drill/common/physical/RowBatchSenderSink.java  |   17 +++
 .../apache/drill/common/physical/StreamSink.java   |   17 +++
 .../apache/drill/common/physical/StreamSource.java |   17 +++
 .../drill/common/physical/operators/Dump.java      |   17 +++
 .../common/physical/operators/HashAggregate.java   |   17 +++
 .../drill/common/physical/operators/HashJoin.java  |   17 +++
 .../drill/common/physical/operators/Limit.java     |   17 +++
 .../drill/common/physical/operators/MergeJoin.java |   17 +++
 .../drill/common/physical/operators/RowRotate.java |   17 +++
 .../drill/common/physical/operators/Scan.java      |   17 +++
 .../drill/common/physical/operators/Sort.java      |   17 +++
 .../drill/common/physical/operators/Store.java     |   17 +++
 .../physical/operators/StreamingAggregate.java     |   17 +++
 .../common/physical/operators/StreamingSort.java   |   17 +++
 .../drill/common/physical/operators/Union.java     |   17 +++
 .../apache/drill/common/storage/FieldSchema.java   |   17 +++
 .../drill/common/storage/ReaderCapabilities.java   |   17 +++
 .../apache/drill/common/storage/StorageEngine.java |   17 +++
 .../apache/drill/common/storage/StorageReader.java |   17 +++
 .../apache/drill/common/storage/TreeHolder.java    |   17 +++
 .../apache/drill/common/storage/ValueCapturer.java |   17 +++
 .../apache/drill/common/storage/ValueHolder.java   |   17 +++
 .../apache/drill/common/storage/ValueModifier.java |   17 +++
 .../common/src/test/resources/example1.sql         |   77 ++++++++++-
 .../common/src/test/resources/example2.sql         |   45 ++++++-
 .../common/src/test/resources/example3.sql         |    3 +
 .../common/src/test/resources/simple_plan.json     |   20 ++--
 102 files changed, 2191 insertions(+), 378 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprLexer.g
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprLexer.g b/sandbox/prototype/common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprLexer.g
index 3eeeca3..aa97b31 100644
--- a/sandbox/prototype/common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprLexer.g
+++ b/sandbox/prototype/common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprLexer.g
@@ -5,7 +5,25 @@ options {
 }
 
 @header {
-  package org.apache.drill.common.expression.parser;
+/*
+ * 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.common.expression.parser;
 }
 
 If       : 'if';

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprParser.g
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprParser.g b/sandbox/prototype/common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprParser.g
index 4d4d24c..889243e 100644
--- a/sandbox/prototype/common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprParser.g
+++ b/sandbox/prototype/common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprParser.g
@@ -11,6 +11,23 @@ options{
 
 
 @header {
+/*
+ * 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.common.expression.parser;
   
   //Explicit import...

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/BooleanFunctions.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/BooleanFunctions.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/BooleanFunctions.java
index 847c714..937414c 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/BooleanFunctions.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/BooleanFunctions.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression;
 
 import java.util.List;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/Cast.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/Cast.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/Cast.java
index b2546df..594abbe 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/Cast.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/Cast.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/DataType.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/DataType.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/DataType.java
index d07e5b7..4cbbd27 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/DataType.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/DataType.java
@@ -1,30 +1,53 @@
+/*******************************************************************************
+ * 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.common.expression;
 
 import java.util.Arrays;
 
-public enum DataType{ // roughly taken from sql
-	INVALID, BOOLEAN, BYTES, NVARCHAR, INTEGER, SMALLINT, VARBIT, FLOAT, DOUBLE, DATE, TIME, DATETIME, UNKNOWN;
-	
-	private DataType[] castable;
-	DataType(DataType... castToDataTypes){
-		castable = castToDataTypes;
-		Arrays.sort(castable);
-	}
-	public boolean canCastTo(DataType dt){
-		if(dt == this) return true;
-		for(int i =0; i < castable.length; i++){
-			if(dt.equals(castable[i])) return true;
-		}
-		return false;
-	}
-	
-	public static DataType getCombinedCast(DataType a, DataType b){
-		if(a == b) return a;
-		
-		if(a.canCastTo(b)) return b;
-		if(b.canCastTo(a)) return a;
-		return null;
-	}
-	
-	
-}
\ No newline at end of file
+public enum DataType { // roughly taken from sql
+  INVALID, BOOLEAN, BYTES, NVARCHAR, INTEGER, SMALLINT, VARBIT, FLOAT, DOUBLE, DATE, TIME, DATETIME, UNKNOWN;
+
+  private DataType[] castable;
+
+  private DataType(DataType... castToDataTypes) {
+    castable = castToDataTypes;
+    Arrays.sort(castable);
+  }
+
+  public boolean canCastTo(DataType dt) {
+    if (dt == this)
+      return true;
+    for (int i = 0; i < castable.length; i++) {
+      if (dt.equals(castable[i]))
+        return true;
+    }
+    return false;
+  }
+
+  public static DataType getCombinedCast(DataType a, DataType b) {
+    if (a == b)
+      return a;
+
+    if (a.canCastTo(b))
+      return b;
+    if (b.canCastTo(a))
+      return a;
+    return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ExpressionFunction.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ExpressionFunction.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ExpressionFunction.java
index 70d855a..f6d0c61 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ExpressionFunction.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ExpressionFunction.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression;
 
 import java.lang.reflect.Constructor;
@@ -19,8 +36,7 @@ public class ExpressionFunction {
   final static Type EXPR_LIST = (new TypeToken<List<LogicalExpression>>() {
   }).getType();
 
-  private static final Class<?>[] FUNCTIONS = { BooleanFunctions.And.class, BooleanFunctions.Or.class,
-      StringFunctions.Regex.class, StringFunctions.StartsWith.class, IsNull.class };
+  private static final Class<?>[] FUNCTIONS = { StringFunctions.Regex.class, StringFunctions.StartsWith.class, IsNull.class };
 
   private static final ImmutableMap<String, Constructor<LogicalExpression>> FUNCTION_MAP;
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ExpressionValidationError.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ExpressionValidationError.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ExpressionValidationError.java
index 51ba2d2..9c71fe8 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ExpressionValidationError.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ExpressionValidationError.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FieldReference.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FieldReference.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FieldReference.java
index ec92110..29dbfb2 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FieldReference.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FieldReference.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression;
 
 import java.io.IOException;
@@ -16,11 +33,9 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
 import com.fasterxml.jackson.databind.ser.std.StdSerializer;
 
-@JsonSerialize(using=Se.class)
-@JsonDeserialize(using=De.class)
+@JsonSerialize(using = Se.class)
+@JsonDeserialize(using = De.class)
 public class FieldReference extends ValueExpressions.Identifier {
-  
-
 
   public FieldReference(String value) {
     super(value);

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FunctionBase.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FunctionBase.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FunctionBase.java
index f87c73c..2869701 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FunctionBase.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FunctionBase.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression;
 
 import java.util.Collection;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FunctionDefinition.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FunctionDefinition.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FunctionDefinition.java
new file mode 100644
index 0000000..07a9015
--- /dev/null
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FunctionDefinition.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.drill.common.expression;
+
+public class FunctionDefinition {
+
+  private final String name;
+  private final Arg[] args;
+
+  public FunctionDefinition(String name, Arg...args){
+    this.name = name;
+    this.args = args;
+  }
+  
+  public static class Arg {
+    private final String name;
+    private final DataType[] allowedTypes;
+    
+    public Arg(String name, DataType...allowedTypes){
+      this.name = name;
+      this.allowedTypes = allowedTypes;
+    }
+  }
+  
+  public Arg arg(String name, DataType...allowedTypes){
+    return new Arg(name, allowedTypes);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FunctionName.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FunctionName.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FunctionName.java
index 3cbca7d..d490edd 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FunctionName.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/FunctionName.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression;
 
 import java.lang.annotation.ElementType;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/IfExpression.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/IfExpression.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/IfExpression.java
index 52d45c2..91f14e7 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/IfExpression.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/IfExpression.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression;
 
 import java.util.ArrayList;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/LogicalExpression.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/LogicalExpression.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/LogicalExpression.java
index 3b0686b..ae7910e 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/LogicalExpression.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/LogicalExpression.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression;
 
 import java.io.IOException;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/LogicalExpressionBase.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/LogicalExpressionBase.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/LogicalExpressionBase.java
index e742d63..7841a59 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/LogicalExpressionBase.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/LogicalExpressionBase.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression;
 
 import java.util.Collection;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/MathFunction.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/MathFunction.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/MathFunction.java
index 31da768..f26a34d 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/MathFunction.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/MathFunction.java
@@ -1,14 +1,27 @@
+/*******************************************************************************
+ * 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.common.expression;
 
-import java.util.Collection;
 import java.util.List;
 
-import org.apache.drill.common.logical.ValidationError;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
 
 
 public class MathFunction extends LogicalExpressionBase{

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/StringFunctions.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/StringFunctions.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/StringFunctions.java
index 7f29e27..c7cad53 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/StringFunctions.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/StringFunctions.java
@@ -1,10 +1,24 @@
+/*******************************************************************************
+ * 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.common.expression;
 
-import java.util.Collection;
 import java.util.List;
 
-import org.apache.drill.common.logical.ValidationError;
-
 public class StringFunctions {
 
 	public static final Class<?>[] SUB_TYPES = {Regex.class, StartsWith.class};

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/TypeFunctions.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/TypeFunctions.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/TypeFunctions.java
index 0476533..6716a3a 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/TypeFunctions.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/TypeFunctions.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression;
 
 import java.util.List;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/UnaryFunctions.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/UnaryFunctions.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/UnaryFunctions.java
index f3a0a17..84cc9da 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/UnaryFunctions.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/UnaryFunctions.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ValueExpressions.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ValueExpressions.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ValueExpressions.java
index 6df2782..812d938 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ValueExpressions.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/ValueExpressions.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/aggregate/BasicAggregates.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/aggregate/BasicAggregates.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/aggregate/BasicAggregates.java
index f336772..0321371 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/aggregate/BasicAggregates.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/aggregate/BasicAggregates.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression.aggregate;
 
 public class BasicAggregates {

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/BasicEvaluator.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/BasicEvaluator.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/BasicEvaluator.java
index e0ce4d2..a7a0056 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/BasicEvaluator.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/BasicEvaluator.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression.visitors;
 
 public class BasicEvaluator extends FunctionVisitor{

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/FunctionVisitor.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/FunctionVisitor.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/FunctionVisitor.java
index e65244e..75b0a18 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/FunctionVisitor.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/FunctionVisitor.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression.visitors;
 
 import org.apache.drill.common.expression.LogicalExpression;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/GetIdentifiers.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/GetIdentifiers.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/GetIdentifiers.java
index 7f3ebee..df2c2bf 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/GetIdentifiers.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/GetIdentifiers.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression.visitors;
 
 import java.util.HashSet;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/OpVisitor.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/OpVisitor.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/OpVisitor.java
index 203b041..ac65acf 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/OpVisitor.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/expression/visitors/OpVisitor.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.expression.visitors;
 
 import org.apache.drill.common.logical.data.LogicalOperator;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FieldName.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FieldName.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FieldName.java
index 86fa403..7e98a8b 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FieldName.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FieldName.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.logical;
 
 public class FieldName {

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FlowInput.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FlowInput.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FlowInput.java
index 386807f..b76e8eb 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FlowInput.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FlowInput.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.logical;
 
 public class FlowInput {

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FlowOutput.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FlowOutput.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FlowOutput.java
index 7844a30..cd8c4ca 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FlowOutput.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/FlowOutput.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.logical;
 
 public class FlowOutput {

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/LogicalPlan.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/LogicalPlan.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/LogicalPlan.java
index cfdc19c..8074e28 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/LogicalPlan.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/LogicalPlan.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.logical;
 
 import java.io.File;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/OperatorGraph.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/OperatorGraph.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/OperatorGraph.java
index 6ff8184..e1d95ab 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/OperatorGraph.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/OperatorGraph.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.logical;
 
 import java.util.ArrayList;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/OperatorRegistry.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/OperatorRegistry.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/OperatorRegistry.java
deleted file mode 100644
index 85eda7f..0000000
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/OperatorRegistry.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.drill.common.logical;
-
-public class OperatorRegistry {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/OperatorResolver.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/OperatorResolver.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/OperatorResolver.java
deleted file mode 100644
index 36d7193..0000000
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/OperatorResolver.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.drill.common.logical;
-
-public class OperatorResolver {
-	
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java
index 7a224d6..a63ea96 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.logical;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/UnexpectedOperatorType.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/UnexpectedOperatorType.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/UnexpectedOperatorType.java
index b1190ad..e2af21d 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/UnexpectedOperatorType.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/UnexpectedOperatorType.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.logical;
 
 import org.apache.drill.common.logical.data.LogicalOperator;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/ValidationError.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/ValidationError.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/ValidationError.java
index e9f0374..06e20e7 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/ValidationError.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/ValidationError.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * 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.common.logical;
 
 public class ValidationError extends RuntimeException{

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Aggregate.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Aggregate.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Aggregate.java
new file mode 100644
index 0000000..3c1e61a
--- /dev/null
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Aggregate.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.common.logical.data;
+
+import org.apache.drill.common.expression.FieldReference;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+
+@JsonTypeName("aggregate")
+public class Aggregate {
+  
+  public static final String ALL = "all";
+  public static final String HERE = "here";
+  
+  private final String aggregateType;
+  private final FieldReference[] keys;
+  private final NamedExpression[]  aggregations;
+
+  @JsonCreator
+  public Aggregate(@JsonProperty("type") String aggregateType, @JsonProperty("keys") FieldReference[] keys, @JsonProperty("aggregations") NamedExpression[] aggregations) {
+    super();
+    this.aggregateType = aggregateType;
+    this.keys = keys;
+    this.aggregations = aggregations;
+  }
+
+  public String getAggregateType() {
+    return aggregateType;
+  }
+
+  public FieldReference[] getKeys() {
+    return keys;
+  }
+
+  public NamedExpression[] getAggregations() {
+    return aggregations;
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Cogroup.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Cogroup.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Cogroup.java
new file mode 100644
index 0000000..816ec07
--- /dev/null
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Cogroup.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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.common.logical.data;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+
+@JsonTypeName("cogroup")
+public class Cogroup {
+  private final Grouping[] groupings;
+
+  @JsonCreator
+  public Cogroup(@JsonProperty("groupings") Grouping[] groupings) {
+    super();
+    this.groupings = groupings;
+  }
+
+  public Grouping[] getGroupings() {
+    return groupings;
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Combine.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Combine.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Combine.java
deleted file mode 100644
index 15ea1c2..0000000
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Combine.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.apache.drill.common.logical.data;
-
-import org.apache.drill.common.expression.FieldReference;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-
-@JsonTypeName("combine")
-public class Combine extends SingleInputOperator{
-  private final FieldReference ref;
-
-  @JsonCreator
-  public Combine(@JsonProperty("ref") FieldReference ref) {
-    this.ref = ref;
-  }
-  
-  @JsonCreator
-  public Combine(@JsonProperty("input") LogicalOperator input, @JsonProperty("ref") FieldReference ref) {
-    this.ref = ref;
-    this.setInput(input);
-  }
-
-  @JsonProperty("ref")
-  public FieldReference getRef() {
-    return ref;
-  }
-
-  @Override
-  public int getNestLevel() {
-    return super.getNestLevel()-1;
-  }
-  
-  
-  
-   
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Explode.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Explode.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Explode.java
deleted file mode 100644
index 09c72c6..0000000
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Explode.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.apache.drill.common.logical.data;
-
-import org.apache.drill.common.expression.FieldReference;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-/**
- * The explode operator 
- */
-@JsonTypeName("explode")
-public class Explode extends SingleInputOperator{
-		
-	private final FieldReference ref;
-
-  @JsonCreator
-  public Explode(@JsonProperty(value="ref", required=true) FieldReference ref) {
-    this.ref = ref;
-  }
-  
-	@JsonCreator
-  public Explode(@JsonProperty("input") LogicalOperator input, @JsonProperty("ref") FieldReference ref) {
-    this.ref = ref;
-    this.setInput(input);
-  }
-	
-  @Override
-  public int getNestLevel() {
-    return super.getNestLevel()+1;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Filter.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Filter.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Filter.java
index 8d923fd..21422d2 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Filter.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Filter.java
@@ -1,10 +1,41 @@
+/*******************************************************************************
+ * 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.common.logical.data;
 
 import org.apache.drill.common.expression.LogicalExpression;
 
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonTypeName;
 
 @JsonTypeName("filter")
 public class Filter extends SingleInputOperator{
-	public LogicalExpression expr;
+	private final LogicalExpression expr;
+
+	@JsonCreator
+  public Filter(@JsonProperty("expr") LogicalExpression expr) {
+    this.expr = expr;
+  }
+
+  public LogicalExpression getExpr() {
+    return expr;
+  }
+
+  
+	
 }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Flatten.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Flatten.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Flatten.java
index cba73e7..e66835b 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Flatten.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Flatten.java
@@ -1,14 +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.drill.common.logical.data;
 
-import java.util.List;
-
+import org.apache.drill.common.expression.FieldReference;
 import org.apache.drill.common.expression.LogicalExpression;
 
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonTypeName;
 
 @JsonTypeName("flatten")
 public class Flatten extends SingleInputOperator{
+  private final FieldReference name;
+  private final LogicalExpression expr;
+  private final boolean drop;
+  
+  @JsonCreator
+  public Flatten(@JsonProperty("name") FieldReference name, @JsonProperty("expr") LogicalExpression expr) {
+    this(name, expr, true);
+  }
+  
+  @JsonCreator
+  public Flatten(@JsonProperty("name") FieldReference name, @JsonProperty("expr") LogicalExpression expr, @JsonProperty("drop") boolean drop) {
+    this.name = name;
+    this.expr = expr;
+    this.drop = drop;
+  }
+
+  public FieldReference getName() {
+    return name;
+  }
+
+  public LogicalExpression getExpr() {
+    return expr;
+  }
+
+  public boolean isDrop() {
+    return drop;
+  }
   
-	public List<LogicalExpression> exprs;
+  
+
 	
 }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Group.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Group.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Group.java
deleted file mode 100644
index b03a5b3..0000000
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Group.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.apache.drill.common.logical.data;
-
-import java.util.List;
-
-import org.apache.drill.common.expression.LogicalExpression;
-
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-@JsonTypeName("group")
-public class Group extends SingleInputOperator{
-	public List<LogicalExpression> exprs;
-
-  @Override
-  public int getNestLevel() {
-    return super.getNestLevel() + exprs.size();
-  }
-	
-	
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Grouping.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Grouping.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Grouping.java
new file mode 100644
index 0000000..6521971
--- /dev/null
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Grouping.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.drill.common.logical.data;
+
+import org.apache.drill.common.expression.FieldReference;
+import org.apache.drill.common.expression.LogicalExpression;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+
+public class Grouping {
+  private final FieldReference name;
+  private final LogicalExpression expr;
+  
+  @JsonCreator
+  public Grouping(@JsonProperty("name") FieldReference name, @JsonProperty("expr") LogicalExpression expr) {
+    super();
+    this.name = name;
+    this.expr = expr;
+  }
+
+  public FieldReference getName() {
+    return name;
+  }
+
+  public LogicalExpression getExpr() {
+    return expr;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/af71b127/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Join.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Join.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Join.java
index 22c1183..88a0327 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Join.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Join.java
@@ -1,49 +1,82 @@
+/*******************************************************************************
+ * 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.common.logical.data;
 
-import java.util.List;
-
 import org.apache.drill.common.expression.LogicalExpression;
-import org.apache.drill.common.expression.visitors.OpVisitor;
 
+import com.fasterxml.jackson.annotation.JsonCreator;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonTypeName;
 
 @JsonTypeName("join")
-public class Join extends LogicalOperatorBase{
-	private LogicalOperator left;
-	private LogicalOperator right;
-	public List<JoinCondition> conditions;
-	
-	public static class JoinCondition{
-		public String relationship;
-		@JsonProperty("left") public LogicalExpression leftExpression;
-		@JsonProperty("right") public LogicalExpression rightExpression;
-	}
-
-  public LogicalOperator getLeft() {
-    return left;
-  }
+public class Join extends LogicalOperatorBase {
+  private final LogicalOperator left;
+  private final LogicalOperator right;
+  private final JoinCondition[] conditions;
 
-  public void setLeft(LogicalOperator left) {
+  @JsonCreator
+  public Join(@JsonProperty("left") LogicalOperator left, @JsonProperty("right") LogicalOperator right, @JsonProperty("conditions") JoinCondition[] conditions) {
+    super();
+    this.conditions = conditions;
     this.left = left;
+    this.right = right;
     left.registerAsSubscriber(this);
+    right.registerAsSubscriber(this);
+
+  }
+
+  public LogicalOperator getLeft() {
+    return left;
   }
 
   public LogicalOperator getRight() {
     return right;
   }
 
-  public void setRight(LogicalOperator right) {
-    this.right = right;
-    right.registerAsSubscriber(this);
+  public JoinCondition[] getConditions() {
+    return conditions;
   }
 
-  @Override
-  public int getNestLevel() {
-    return -5;
-  }
+  public static class JoinCondition {
+    private final String relationship;
+    private final LogicalExpression left;
+    private final LogicalExpression right;
 
-	
-  
-	
+    @JsonCreator
+    public JoinCondition(@JsonProperty("relationship") String relationship,
+        @JsonProperty("left") LogicalExpression left, @JsonProperty("right") LogicalExpression right) {
+      super();
+      this.relationship = relationship;
+      this.left = left;
+      this.right = right;
+    }
+
+    public String getRelationship() {
+      return relationship;
+    }
+
+    public LogicalExpression getLeft() {
+      return left;
+    }
+
+    public LogicalExpression getRight() {
+      return right;
+    }
+
+  }
 }