drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jacq...@apache.org
Subject [09/38] DRILL-257: Move SQL parsing to server side. Switch to Avatica based JDBC driver. Update QuerySubmitter to support SQL queries. Update SqlAccesors to support getObject() Remove ref, clean up SQL packages some. Various performance fixes. Updating
Date Tue, 04 Mar 2014 08:07:36 GMT
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RSEBase.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RSEBase.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RSEBase.java
deleted file mode 100644
index bbebc12..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RSEBase.java
+++ /dev/null
@@ -1,71 +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.exec.ref.rse;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.drill.common.logical.data.Scan;
-import org.apache.drill.common.logical.data.Store;
-import org.apache.drill.common.util.PathScanner;
-import org.apache.drill.exec.ref.ExecRefConstants;
-import org.apache.drill.exec.ref.RecordIterator;
-import org.apache.drill.exec.ref.exceptions.MajorException;
-import org.apache.drill.exec.ref.rops.ROP;
-
-import com.typesafe.config.Config;
-
-public abstract class RSEBase implements ReferenceStorageEngine{
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RSEBase.class);
-  
-  @Override
-  public boolean supportsRead() {
-    return false;
-  }
-
-  @Override
-  public boolean supportsWrite() {
-    return false;
-  }
-
-  @Override
-  public Collection<ReadEntry> getReadEntries(Scan scan) throws IOException {
-    throw new UnsupportedOperationException(String.format("%s does not support reads.", this.getClass().getCanonicalName()));
-  }
-
-  @Override
-  public RecordReader getReader(ReadEntry readEntry, ROP parentROP) throws IOException {
-    throw new UnsupportedOperationException(String.format("%s does not support reads.", this.getClass().getCanonicalName()));
-  }
-
-  @Override
-  public RecordRecorder getWriter(Store store) throws IOException {
-    throw new UnsupportedOperationException(String.format("%s does not support writes.", this.getClass().getCanonicalName()));
-  }
-  
-  public static Class<?>[] getSubTypes(Config config){
-    Collection<Class<? extends ReferenceStorageEngine>> engines = PathScanner.scanForImplementations(ReferenceStorageEngine.class, config.getStringList(ExecRefConstants.STORAGE_ENGINE_SCAN_PACKAGES));
-    return engines.toArray(new Class<?>[engines.size()]);
-  }
-
-  @SuppressWarnings("unchecked")
-  protected <T extends ReadEntry> T getReadEntry(Class<T> c, ReadEntry entry){
-    if(!c.isAssignableFrom(entry.getClass())) throw new MajorException(String.format("Expected entry type was invalid.  Expected entry of type %s but received type of %s.", c.getCanonicalName(), entry.getClass().getCanonicalName()));
-    return (T) entry;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RSERegistry.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RSERegistry.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RSERegistry.java
deleted file mode 100644
index 6eb48e1..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RSERegistry.java
+++ /dev/null
@@ -1,87 +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.exec.ref.rse;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Queue;
-
-import org.apache.drill.common.config.DrillConfig;
-import org.apache.drill.common.logical.StorageEngineConfig;
-import org.apache.drill.common.util.PathScanner;
-import org.apache.drill.exec.ref.ExecRefConstants;
-import org.apache.drill.exec.ref.exceptions.SetupException;
-
-import com.typesafe.config.Config;
-
-public class RSERegistry {
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RSERegistry.class);
-  
-  private Map<Object, Constructor<? extends ReferenceStorageEngine>> availableEngines = new HashMap<Object, Constructor<? extends ReferenceStorageEngine>>();
-  private Map<StorageEngineConfig, ReferenceStorageEngine> activeEngines = new HashMap<StorageEngineConfig, ReferenceStorageEngine>();
-  private DrillConfig config;
-  
-  public RSERegistry(DrillConfig config){
-    this.config = config;
-    setup(config);
-  }
-  
-  @SuppressWarnings("unchecked")
-  public void setup(DrillConfig config){
-    Collection<Class<? extends ReferenceStorageEngine>> engines = PathScanner.scanForImplementations(ReferenceStorageEngine.class, config.getStringList(ExecRefConstants.STORAGE_ENGINE_SCAN_PACKAGES));
-    logger.debug("Loading storage engines {}", engines);
-    for(Class<? extends ReferenceStorageEngine> engine: engines){
-      int i =0;
-      for(Constructor<?> c : engine.getConstructors()){
-        Class<?>[] params = c.getParameterTypes();
-        if(params.length != 2 || params[1] == Config.class || !StorageEngineConfig.class.isAssignableFrom(params[0])){
-          logger.debug("Skipping ReferenceStorageEngine constructor {} for engine class {} since it doesn't implement a [constructor(StorageEngineConfig, Config)]", c, engine);
-          continue;
-        }
-        availableEngines.put(params[0], (Constructor<? extends ReferenceStorageEngine>) c);
-        i++;
-      }
-      if(i == 0){
-        logger.debug("Skipping registration of ReferenceStorageEngine {} as it doesn't have a constructor with the parameters of (StorangeEngineConfig, Config)", engine.getCanonicalName());
-      }
-    }
-  }
-  
-  public ReferenceStorageEngine getEngine(StorageEngineConfig engineConfig) throws SetupException{
-    ReferenceStorageEngine engine = activeEngines.get(engineConfig);
-    if(engine != null) return engine;
-    Constructor<? extends ReferenceStorageEngine> c = availableEngines.get(engineConfig.getClass());
-    if(c == null) throw new SetupException(String.format("Failure finding StorageEngine constructor for config %s", engineConfig));
-    try {
-      engine = c.newInstance(engineConfig, config);
-      activeEngines.put(engineConfig,engine);
-      return engine;
-    } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
-      Throwable t = e instanceof InvocationTargetException ? ((InvocationTargetException)e).getTargetException() : e;
-      if(t instanceof SetupException) throw ((SetupException) t);
-      throw new SetupException(String.format("Failure setting up new storage engine configuration for config %s", engineConfig), t);
-    }
-  }
-  
-
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RecordReader.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RecordReader.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RecordReader.java
deleted file mode 100644
index a441fc1..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RecordReader.java
+++ /dev/null
@@ -1,28 +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.exec.ref.rse;
-
-import org.apache.drill.exec.ref.RecordIterator;
-
-public interface RecordReader {
-
-  public abstract RecordIterator getIterator();
-  public abstract void setup();
-  public abstract void cleanup();
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RecordRecorder.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RecordRecorder.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RecordRecorder.java
deleted file mode 100644
index 848797e..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/RecordRecorder.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.exec.ref.rse;
-
-import java.io.IOException;
-
-import org.apache.drill.exec.ref.RecordPointer;
-import org.apache.drill.exec.ref.RunOutcome;
-
-public interface RecordRecorder {
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RecordRecorder.class);
-  
-  public void setup() throws IOException;
-  public long recordRecord(RecordPointer pointer) throws IOException;
-  public void finish(RunOutcome.OutcomeType outcome) throws IOException;
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/ReferenceStorageEngine.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/ReferenceStorageEngine.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/ReferenceStorageEngine.java
deleted file mode 100644
index 997d7d1..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/rse/ReferenceStorageEngine.java
+++ /dev/null
@@ -1,45 +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.exec.ref.rse;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.drill.common.logical.data.Scan;
-import org.apache.drill.common.logical.data.Store;
-import org.apache.drill.exec.ref.rops.ROP;
-
-
-public interface ReferenceStorageEngine {
-  public boolean supportsRead();
-  public boolean supportsWrite();
-
-  public enum PartitionCapabilities {
-    NONE, HASH, SORTED;
-  }
-
-  public enum MemoryFormat {
-    RECORD, FIELD;
-  }
-
-  public Collection<ReadEntry> getReadEntries(Scan scan) throws IOException;
-  public RecordReader getReader(ReadEntry readEntry, ROP parentROP) throws IOException;
-  public RecordRecorder getWriter(Store store) throws IOException;
-
-  public interface ReadEntry{}
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/util/BatchBreaker.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/util/BatchBreaker.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/util/BatchBreaker.java
deleted file mode 100644
index 4806327..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/util/BatchBreaker.java
+++ /dev/null
@@ -1,46 +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.exec.ref.util;
-
-import org.apache.drill.exec.ref.RecordPointer;
-
-public interface BatchBreaker {
-  public boolean shouldBreakAfter(RecordPointer record);
-  
-  public static class CountBreaker implements BatchBreaker{
-    private final int max;
-    private int count = 0;
-    
-    public CountBreaker(int max) {
-      super();
-      this.max = max;
-    }
-
-    @Override
-    public boolean shouldBreakAfter(RecordPointer record) {
-      count++;
-      if(count > max){
-        count = 0;
-        return true;
-      }{
-        return false;
-      }
-    }
-    
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/util/ByteRange.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/util/ByteRange.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/util/ByteRange.java
deleted file mode 100644
index 6f39759..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/util/ByteRange.java
+++ /dev/null
@@ -1,34 +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.exec.ref.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-
-
-/**
- * Facade interface for ByteBuffer and byte[]
- */
-public interface ByteRange {
-  public byte getByte(int index);
-  public int getLength();
-  public void copyTo(byte[] buffer, int offset);
-  public void copyTo(InputStream is) throws IOException;
-  public void copyTo(ByteBuffer bb);
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BaseArrayValue.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BaseArrayValue.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BaseArrayValue.java
deleted file mode 100644
index 7c42151..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BaseArrayValue.java
+++ /dev/null
@@ -1,86 +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.exec.ref.values;
-
-import org.apache.drill.common.expression.PathSegment;
-import org.apache.drill.common.types.TypeProtos.DataMode;
-import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.common.types.TypeProtos.MinorType;
-
-
-public abstract class BaseArrayValue extends BaseDataValue implements ContainerValue{
-
-  private MajorType initiatingType;
-  private MajorType runningType = MajorType.newBuilder().setMode(DataMode.REPEATED).setMinorType(MinorType.LATE).build();
-  
-  @Override
-  public void addValue(PathSegment segment, DataValue v) {
-    if(initiatingType == null){
-      initiatingType = v.getDataType();
-      runningType = initiatingType.toBuilder().setMode(DataMode.REPEATED).build();
-    }else{
-      if(!v.getDataType().equals(initiatingType)){
-        throw new RuntimeException("The reference interpreter doesn't support polymorphic types.");
-      }
-    }
-    
-    DataValue fullPathValue = ValueUtils.getIntermediateValues(segment.getChild(), v);
-    if(segment.isArray()){ // we need to place this object in the given position.
-      int index = segment.getArraySegment().getIndex();
-      DataValue mergedValue = ValueUtils.getMergedDataValue(segment.getCollisionBehavior(), getByArrayIndex(index), fullPathValue);
-      addToArray(index, mergedValue);
-    }else{ // add to end of array.
-     addToArray(getNextIndex(), fullPathValue);
-    }
-  }
-
-  protected abstract void addToArray(int index, DataValue v);
-  public abstract DataValue getByArrayIndex(int index);
-  protected abstract int getNextIndex();
-  public abstract void append(BaseArrayValue container);
-  public abstract int size();
-  
-  @Override
-  public DataValue getValue(PathSegment segment) {
-    if(segment == null){ // return entire array
-      return this;
-    }else if(!segment.isArray()){  // requesting a named value from within an array.  No value should be returned.
-      return DataValue.NULL_VALUE;
-    }else{
-      DataValue v = getByArrayIndex(segment.getArraySegment().getIndex());
-      if(v == null) return DataValue.NULL_VALUE;
-      return v.getValue(segment.getChild());
-    }
-  }
-
-  @Override
-  public ContainerValue getAsContainer() {
-    return this;
-  }
-
-  @Override
-  public MajorType getDataType() {
-    return runningType;
-  }
-  
-  
-  
-
-  
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BaseDataValue.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BaseDataValue.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BaseDataValue.java
deleted file mode 100644
index d979ed2..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BaseDataValue.java
+++ /dev/null
@@ -1,82 +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.exec.ref.values;
-
-import org.apache.drill.common.exceptions.DrillRuntimeException;
-import org.apache.drill.common.expression.PathSegment;
-
-public abstract class BaseDataValue implements DataValue{
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BaseDataValue.class);
-  
-  @Override
-  public DataValue getValue(PathSegment segment) {
-    if(segment == null){
-      return this;
-    }else{ // looking for a lower level value when there is none.
-      return DataValue.NULL_VALUE;
-    }
-  }
-  
-  public void addValue(PathSegment segment, DataValue v) {
-    throw new IllegalArgumentException("You can't add a value to a non-container type.");
-  }
-
-  public void removeValue(PathSegment segment) {
-    throw new IllegalArgumentException("You can't remove a value from a non-container type.");
-  }
-
-  @Override
-  public NumericValue getAsNumeric() {
-    throw new DrillRuntimeException(String.format("A %s value is not a NumericValue.", this.getClass().getCanonicalName()));
-  }
-
-  @Override
-  public ContainerValue getAsContainer() {
-    throw new DrillRuntimeException(String.format("A %s value is not a ContainerValue.", this.getClass().getCanonicalName()));
-  }
-
-  @Override
-  public StringValue getAsStringValue() {
-    throw new DrillRuntimeException(String.format("A %s value is not a StringValue.", this.getClass().getCanonicalName()));
-  }
-
-  public BytesValue getAsBytesValue(){
-    throw new DrillRuntimeException(String.format("A %s value is not a BytesValue.", this.getClass().getCanonicalName()));
-  }
-  
-  public BooleanValue getAsBooleanValue(){
-    throw new DrillRuntimeException(String.format("A %s value is not a BooleanValue.", this.getClass().getCanonicalName()));
-  }
-
-  @Override
-  public abstract int hashCode();
-
-  @Override
-  public boolean equals(Object obj) {
-    if(obj instanceof DataValue){
-      return this.equals((DataValue) obj);
-    }else{
-      return false;
-    }
-  }
-  
-
-  @Override
-  public abstract DataValue copy();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BaseMapValue.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BaseMapValue.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BaseMapValue.java
deleted file mode 100644
index b42390f..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BaseMapValue.java
+++ /dev/null
@@ -1,111 +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.exec.ref.values;
-
-import java.util.Map;
-
-import org.apache.drill.common.expression.PathSegment;
-import org.apache.drill.common.expression.ValueExpressions.CollisionBehavior;
-import org.apache.drill.common.types.TypeProtos.DataMode;
-import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.common.types.TypeProtos.MinorType;
-import org.apache.drill.exec.ref.exceptions.RecordException;
-
-public abstract class BaseMapValue extends BaseDataValue implements ContainerValue,
-    Iterable<Map.Entry<CharSequence, DataValue>> {
-
-  @Override
-  public void addValue(PathSegment segment, DataValue v) {
-    if(v == null) throw new RecordException("You attempted to add a null value to a map.", null);
-    if (segment.isArray())
-      throw new RecordException(
-          "You're attempted to save something at a particular array location while the location of that setting was a Map.", null);
-
-    CharSequence name = segment.getNameSegment().getPath();
-    DataValue current = getByNameNoNulls(name);
-    if (!segment.isLastPath() && current != DataValue.NULL_VALUE) {
-      current.addValue(segment.getChild(), v);
-      return;
-    } else {
-      DataValue fullPathValue = ValueUtils.getIntermediateValues(segment.getChild(), v);
-      DataValue mergedValue = ValueUtils.getMergedDataValue(segment.getCollisionBehavior(), getByNameNoNulls(name),
-          fullPathValue);
-      setByName(name, mergedValue);
-
-    }
-
-  }
-
-  @Override
-  public void removeValue(PathSegment segment) {
-    if (segment.isArray())
-      throw new RecordException(
-          "You're attempted to remove something at a particular array location while the location of that setting was a Map.", null);
-
-    CharSequence name = segment.getNameSegment().getPath();
-    DataValue current = getByNameNoNulls(name);
-    if (!segment.isLastPath() && current != DataValue.NULL_VALUE) {
-      current.removeValue(segment.getChild());
-      return;
-    } else {
-      removeByName(name);
-    }
-
-  }
-
-  protected abstract void setByName(CharSequence name, DataValue v);
-
-  protected abstract DataValue getByName(CharSequence name);
-
-  protected abstract void removeByName(CharSequence name);
-
-  private DataValue getByNameNoNulls(CharSequence name) {
-    DataValue v = getByName(name);
-    if (v == null) return NULL_VALUE;
-    return v;
-  }
-
-  @Override
-  public DataValue getValue(PathSegment segment) {
-    if (segment == null) return this;
-    if (segment.isArray()) return NULL_VALUE;
-    return getByNameNoNulls(segment.getNameSegment().getPath()).getValue(segment.getChild());
-  }
-
-  @Override
-  public ContainerValue getAsContainer() {
-    return this;
-  }
-
-  @Override
-  public MajorType getDataType() {
-    return MajorType.newBuilder().setMinorType(MinorType.REPEATMAP).setMode(DataMode.REPEATED).build();
-  }
-
-  public void merge(BaseMapValue otherMap) {
-    for (Map.Entry<CharSequence, DataValue> e : otherMap) {
-      final DataValue oldValue = getByName(e.getKey());
-      if (oldValue == DataValue.NULL_VALUE || oldValue == null) {
-        setByName(e.getKey(), e.getValue());
-      } else {
-        setByName(e.getKey(), ValueUtils.getMergedDataValue(CollisionBehavior.MERGE_OVERRIDE, oldValue, e.getValue()));
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BooleanValue.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BooleanValue.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BooleanValue.java
deleted file mode 100644
index 81288cb..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BooleanValue.java
+++ /dev/null
@@ -1,22 +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.exec.ref.values;
-
-public interface BooleanValue extends DataValue{
-  public boolean getBoolean();
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BytesValue.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BytesValue.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BytesValue.java
deleted file mode 100644
index 5635051..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/BytesValue.java
+++ /dev/null
@@ -1,28 +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.exec.ref.values;
-
-public interface BytesValue extends DataValue, ComparableValue{
-  
-  public byte[] getAsArray();
-  
-  // byteBuffer like
-  public int getLength();
-  public byte get(int pos);
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ComparableValue.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ComparableValue.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ComparableValue.java
deleted file mode 100644
index a87c929..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ComparableValue.java
+++ /dev/null
@@ -1,38 +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.exec.ref.values;
-
-public interface ComparableValue extends Comparable<DataValue>, DataValue {
-
-  /**
-   * Tells whether or not comparisons between the current ComparableValue and the provided DataValue are possible.
-   * @param dv2 The other DataValue
-   * @return True if comaprable.  False if not comparable.
-   */
-  public boolean supportsCompare(DataValue dv2);
-
-  /**
-   * Similar to standard comparable. However, the expectation is that supportsCompare should be called first. Likely
-   * will have unexpected outcome if you don't call supportsCompare first.
-   * 
-   * @param other
-   * @return
-   */
-  public int compareTo(DataValue other);
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ContainerValue.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ContainerValue.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ContainerValue.java
deleted file mode 100644
index 7e23872..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ContainerValue.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.exec.ref.values;
-
-
-
-public interface ContainerValue extends DataValue{
-  public BaseArrayValue getAsArray();
-  public BaseMapValue getAsMap();
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/DataValue.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/DataValue.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/DataValue.java
deleted file mode 100644
index b95897b..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/DataValue.java
+++ /dev/null
@@ -1,45 +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.exec.ref.values;
-
-import java.io.IOException;
-
-import org.apache.drill.common.expression.PathSegment;
-import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.exec.ref.rops.DataWriter;
-
-
-public interface DataValue {
-  
-  public static final DataValue NULL_VALUE = new ScalarValues.NullValue();
-
-  public DataValue getValue(PathSegment segment);
-  public void addValue(PathSegment segment, DataValue v);
-  public void removeValue(PathSegment segment);
-  public void write(DataWriter writer) throws IOException;
-  public MajorType getDataType();
-  public NumericValue getAsNumeric();
-  public ContainerValue getAsContainer();
-  public StringValue getAsStringValue();
-  public BooleanValue getAsBooleanValue();
-  public BytesValue getAsBytesValue();
-  public boolean equals(DataValue v);
-  public boolean equals(Object v);
-  public int hashCode();
-  public DataValue copy();
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/DataValueSet.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/DataValueSet.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/DataValueSet.java
deleted file mode 100644
index 6e592be..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/DataValueSet.java
+++ /dev/null
@@ -1,80 +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.exec.ref.values;
-
-import java.util.Arrays;
-
-import org.apache.drill.exec.ref.eval.EvaluatorTypes.BasicEvaluator;
-
-public class DataValueSet {
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DataValueSet.class);
-  
-  private final DataValue[] values;
-  private final BasicEvaluator[] evaluators;
-  
-  public DataValueSet(BasicEvaluator... evaluators){
-    this.values = new DataValue[evaluators.length];
-    this.evaluators = evaluators;
-  }
-  
-  private DataValueSet(DataValue[] values){
-    this.values = new DataValue[values.length];
-    System.arraycopy(values, 0, this.values, 0, values.length);
-    this.evaluators = null;
-  }
-  
-  public void grabValues(){
-    for(int i =0; i < values.length; i++){
-      values[i] = evaluators[i].eval();
-    }
-  }
-
-  public void copyFrom(DataValueSet set){
-    System.arraycopy(set.values, 0, values, 0, set.values.length);
-  }
-
-  @Override
-  public int hashCode() {
-    final int prime = 31;
-    int result = 1;
-    result = prime * result + Arrays.hashCode(values);
-    return result;
-  }
-
-  
-  @Override
-  public boolean equals(Object obj) {
-    if (this == obj) return true;
-    if (obj == null) return false;
-    if (getClass() != obj.getClass()) return false;
-    DataValueSet other = (DataValueSet) obj;
-    if (!Arrays.equals(values, other.values)) return false;
-    return true;
-  }
-
-  @Override
-  public String toString() {
-    return "DataValueSet [values=" + Arrays.toString(values) + "]";
-  }
-
-  public DataValueSet cloneValuesOnly(){
-    return new DataValueSet(this.values);
-  }
-  
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/NumericValue.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/NumericValue.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/NumericValue.java
deleted file mode 100644
index f32a80e..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/NumericValue.java
+++ /dev/null
@@ -1,175 +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.exec.ref.values;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.apache.drill.common.exceptions.DrillRuntimeException;
-import org.apache.drill.common.types.Types;
-import org.apache.drill.exec.ref.eval.EvaluatorTypes.BasicEvaluator;
-import org.apache.drill.exec.ref.values.ScalarValues.DoubleScalar;
-import org.apache.drill.exec.ref.values.ScalarValues.FloatScalar;
-import org.apache.drill.exec.ref.values.ScalarValues.IntegerScalar;
-import org.apache.drill.exec.ref.values.ScalarValues.LongScalar;
-
-public abstract class NumericValue extends BaseDataValue implements ComparableValue, BasicEvaluator{
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(NumericValue.class);
-  
-  
-  public static enum NumericType {
-    // order is important for conversion
-    INT, LONG, BIG_INTEGER, FLOAT, DOUBLE, BIG_DECIMAL;
-  }
-  
-  public abstract NumericType getNumericType();
-
-  @Override
-  public int compareTo(DataValue dv2) {
-    NumericValue other = dv2.getAsNumeric();
-    NumericType mutual = getMutualType(this, other);
-    switch(mutual){
-    case BIG_DECIMAL:
-      return this.getAsBigDecimal().compareTo(other.getAsBigDecimal());
-    case BIG_INTEGER:
-      return this.getAsBigInteger().compareTo(other.getAsBigInteger());
-    case DOUBLE:
-      return Double.compare(this.getAsDouble(), other.getAsDouble());
-    case FLOAT:
-      return Float.compare(this.getAsFloat(), other.getAsFloat());
-    case INT:
-      return Integer.compare(this.getAsInt(), other.getAsInt());
-    case LONG:
-      return Long.compare(this.getAsLong(), other.getAsLong());
-    default:
-      throw new UnsupportedOperationException();
-    }
-  }
-  
-  public int getHashCode(double d){
-    Long l = Double.doubleToLongBits(d);
-    return (int)(l ^ (l >>> 32));
-  }
-  
-  @Override
-  public DataValue eval() {
-    return this;
-  }
-
-  private static NumericType getMutualType(NumericValue... values){
-    int ord = 0;
-    for(int i =0; i < values.length; i++){
-      ord = Math.max(ord, values[i].getNumericType().ordinal());
-    }
-    return NumericType.values()[ord]; 
-  }
-  
-
-  
-  @Override
-  public boolean equals(DataValue v) {
-    if(v == null) return false;
-    if(Types.isNumericType(v.getDataType())){
-      return this.compareTo(v) == 0;
-    }else{
-      return false;
-    }
-  }
-
-  
-  public static NumericValue add(NumericValue... values){
-    NumericType mutual = getMutualType(values);
-    switch(mutual){
-    case BIG_DECIMAL:
-      throw new UnsupportedOperationException();
-//      BigDecimal bd = new BigDecimal(0);
-//      for(int i =0; i < values.length; i++){
-//        bd = bd.add(values[i].getAsBigDecimal());
-//      }
-//      return new BigDecimalScalar(bd);
-    case BIG_INTEGER:
-      throw new UnsupportedOperationException();
-//
-//      BigInteger bi = BigInteger.valueOf(0);
-//      for(int i =0; i < values.length; i++){
-//        bi = bi.add(values[i].getAsBigInteger());
-//      }
-//      return new BigIntegerScalar(bi);
-    case DOUBLE:
-      double d = 0d;
-      for(int i =0; i < values.length; i++){
-        d += values[i].getAsDouble();
-      }
-      return new DoubleScalar(d);
-    case FLOAT:
-      float f = 0f;
-      for(int i =0; i < values.length; i++){
-        f += values[i].getAsFloat();
-      }
-      return new FloatScalar(f);      
-    case INT:
-      int x = 0;
-      for(int i =0; i < values.length; i++){
-        x += values[i].getAsInt();
-      }
-      return new IntegerScalar(x);      
-    case LONG:
-      int l = 0;
-      for(int i =0; i < values.length; i++){
-        l += values[i].getAsLong();
-      }
-      return new LongScalar(l);      
-    default:
-      throw new UnsupportedOperationException();
-    }
-  }
-  
-  @Override
-  public boolean supportsCompare(DataValue dv2) {
-    return Types.isNumericType(dv2.getDataType());
-  }
-
-  
-  
-  
-  @Override
-  public NumericValue getAsNumeric() {
-    return this;
-  }
-
-  public long getAsLong(){
-    throw new DrillRuntimeException(String.format("A %s value can not be implicitly cast to a long.", this.getDataType()));
-  }
-  public int getAsInt(){
-    throw new DrillRuntimeException(String.format("A %s value can not be implicitly cast to an int.", this.getDataType()));
-  }
-  public float getAsFloat(){
-    throw new DrillRuntimeException(String.format("A %s value can not be implicitly cast to an float.", this.getDataType()));
-  }
-  public double getAsDouble(){
-    throw new DrillRuntimeException(String.format("A %s value can not be implicitly cast to a double.", this.getDataType()));
-  }
-  public BigDecimal getAsBigDecimal(){
-    throw new DrillRuntimeException(String.format("A %s value can not be implicitly cast to an big decimal.", this.getDataType()));
-  }
-  public BigInteger getAsBigInteger(){
-    throw new DrillRuntimeException(String.format("A %s value can not be implicitly cast to a big integer.", this.getDataType()));
-  }
-  
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ScalarValues.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ScalarValues.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ScalarValues.java
deleted file mode 100644
index 9226b94..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ScalarValues.java
+++ /dev/null
@@ -1,560 +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.exec.ref.values;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Arrays;
-
-import org.apache.drill.common.types.TypeProtos.DataMode;
-import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.common.types.TypeProtos.MinorType;
-import org.apache.drill.common.types.Types;
-import org.apache.drill.exec.ref.eval.EvaluatorTypes.BasicEvaluator;
-import org.apache.drill.exec.ref.rops.DataWriter;
-import org.apache.hadoop.io.BytesWritable;
-
-import com.google.common.hash.HashFunction;
-import com.google.common.hash.Hashing;
-
-
-public final class ScalarValues {
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ScalarValues.class);
-  
-  private ScalarValues(){}
-  
-  public static class StringScalar extends BaseDataValue implements StringValue, ComparableValue, BasicEvaluator {
-    private CharSequence seq;
-    private MajorType type = MajorType.newBuilder().setMinorType(MinorType.VARCHAR).setMode(DataMode.OPTIONAL).build();
-    
-    public StringScalar(CharSequence seq){
-      this.seq = seq;
-    }
-    
-    @Override
-    public int compareTo(DataValue o) {
-      CharSequence seq1 = seq;
-      CharSequence seq2 = o.getAsStringValue().getString();
-      final int len = Math.min(seq1.length(), seq2.length());
-      for(int i =0; i < len; i++){
-        char c1 = seq1.charAt(i);
-        char c2 = seq2.charAt(i);
-        if(c1 != c2){
-          return c1 - c2;
-        }
-      }
-      return seq1.length() - seq2.length();
-    }
-
-    @Override
-    public boolean supportsCompare(DataValue dv2) {
-      return Types.isStringScalarType(dv2.getDataType());
-    }
-
-    @Override
-    public void write(DataWriter writer) throws IOException {
-      writer.writeCharSequence(seq);
-    }
-
-    @Override
-    public MajorType getDataType() {
-      return type;
-    }
-
-    @Override
-    public StringValue getAsStringValue() {
-      return this;
-    }
-
-    @Override
-    public CharSequence getString() {
-      return seq;
-    }
-    
-    @Override
-    public boolean isConstant() {
-      return true;
-    }
-    
-    public DataValue eval(){
-      return this;
-    }
-
-    @Override
-    public String toString() {
-      return "StringScalar [seq=" + seq + "]";
-    }
-
-    @Override
-    public boolean equals(DataValue v) {
-      if(!v.getDataType().equals(this.getDataType())) return false;
-      return seq.equals(v.getAsStringValue().getString());
-    }
-
-    @Override
-    public int hashCode() {
-      return seq.hashCode();
-    }
-
-    @Override
-    public DataValue copy() {
-        return new StringScalar(seq.toString());
-    }
-  }
-  
- 
-  
-  public static class BooleanScalar extends BaseDataValue implements BooleanValue, BasicEvaluator{
-    private boolean b;
-    private MajorType type = MajorType.newBuilder().setMinorType(MinorType.BIT).setMode(DataMode.OPTIONAL).build();
-    
-    public BooleanScalar(boolean b){
-      this.b = b;
-    }
-
-    @Override
-    public void write(DataWriter writer) throws IOException {
-      writer.writeBoolean(b);
-    }
-    
-    @Override
-    public boolean getBoolean() {
-      return b;
-    }
-
-    @Override
-    public BooleanValue getAsBooleanValue() {
-      return this;
-    }
-
-    @Override
-    public MajorType getDataType() {
-      return type;
-    }
-
-    @Override
-    public boolean isConstant() {
-      return true;
-    }
-
-    @Override
-    public DataValue eval() {
-      return this;
-    }
-
-    @Override
-    public String toString() {
-      return "BooleanScalar [b=" + b + "]";
-    }
-    
-    @Override
-    public boolean equals(DataValue v) {
-      if(v.getDataType().equals(this.getDataType())) return false;
-      return b == v.getAsBooleanValue().getBoolean();
-    }
-
-
-    @Override
-    public int hashCode() {
-      return b ? 1 : 0;
-    }
-
-    @Override
-    public DataValue copy() {
-        return new BooleanScalar(b);
-    }
-  }
-  
-  public static class LongScalar extends NumericValue{
-    
-    private MajorType type = MajorType.newBuilder().setMinorType(MinorType.BIGINT).setMode(DataMode.OPTIONAL).build();
-    long l;
-    public LongScalar(long l) {
-      this.l = l;
-    }
-    
-    @Override
-    public long getAsLong() {
-      return l;
-    }
-
-    @Override
-    public float getAsFloat() {
-      return l;
-    }
-
-    @Override
-    public double getAsDouble() {
-      return l;
-    }
-
-    @Override
-    public BigInteger getAsBigInteger() {
-      return BigInteger.valueOf(l);
-    }
-
-    @Override
-    public BigDecimal getAsBigDecimal() {
-      return BigDecimal.valueOf(l);
-    }
-
-    @Override
-    public void write(DataWriter writer) throws IOException {
-      writer.writeSInt64(l);
-    }
-
-    @Override
-    public MajorType getDataType() {
-      return type;
-    }
-
-    @Override
-    public NumericType getNumericType() {
-      return NumericType.LONG;
-    }
-    
-    @Override
-    public boolean isConstant() {
-      return true;
-    }
-
-    @Override
-    public String toString() {
-      return "LongScalar [l=" + l + "]";
-    }
-    
-
-    @Override
-    public int hashCode() {
-      return getHashCode(l);
-    }
-
-    @Override
-    public DataValue copy() {
-        return new LongScalar(l);
-    }
-  }
-  
-  public static class IntegerScalar extends NumericValue{
-    private MajorType type = MajorType.newBuilder().setMinorType(MinorType.INT).setMode(DataMode.OPTIONAL).build();
-    int i;
-    
-    public IntegerScalar(int i){
-      this.i = i;
-    }
-    
-    @Override
-    public BigInteger getAsBigInteger() {
-      return BigInteger.valueOf(i);
-    }
-
-    @Override
-    public BigDecimal getAsBigDecimal() {
-      return BigDecimal.valueOf(i);
-    }
-    
-    @Override
-    public void write(DataWriter writer) throws IOException {
-      writer.writeSInt32(i);
-    }
-
-    @Override
-    public MajorType getDataType() {
-      return type;
-    }
-
-    @Override
-    public NumericType getNumericType() {
-      return NumericType.INT;
-    }
-
-    @Override
-    public long getAsLong() {
-      return i;
-    }
-
-    @Override
-    public int getAsInt() {
-      return i;
-    }
-
-    @Override
-    public float getAsFloat() {
-      return i;
-    }
-
-    @Override
-    public double getAsDouble() {
-      return i;
-    }
-    
-    @Override
-    public boolean isConstant() {
-      return true;
-    }
-
-    @Override
-    public String toString() {
-      return "IntegerScalar [i=" + i + "]";
-    }
-
-    
-    @Override
-    public int hashCode() {
-      return getHashCode(i);
-    }
-
-    @Override
-    public DataValue copy() {
-        return new IntegerScalar(i);
-    }
-  }
-  
-
-  
-  public static class FloatScalar extends NumericValue{
-    
-    private MajorType type = MajorType.newBuilder().setMinorType(MinorType.FLOAT4).setMode(DataMode.OPTIONAL).build();
-    float f;
-    public FloatScalar(float f){
-      this.f = f;
-    }
-
-    @Override
-    public BigDecimal getAsBigDecimal() {
-      return BigDecimal.valueOf(f);
-    }
-
-    @Override
-    public void write(DataWriter writer) throws IOException {
-      writer.writeSFloat32(f);
-    }
-
-    @Override
-    public MajorType getDataType() {
-      return type;
-    }
-
-    @Override
-    public NumericType getNumericType() {
-      return NumericType.FLOAT;
-    }
-
-    @Override
-    public double getAsDouble() {
-      return f;
-    }
-    
-    @Override
-    public boolean isConstant() {
-      return true;
-    }
-
-    @Override
-    public String toString() {
-      return "FloatScalar [f=" + f + "]";
-    }
-
-    @Override
-    public int hashCode() {
-      return getHashCode(f);
-    }
-
-    @Override
-    public DataValue copy() {
-      return new FloatScalar(f);
-    }
-  }
- 
-  
-  public static class DoubleScalar extends NumericValue{
-    private MajorType type = MajorType.newBuilder().setMinorType(MinorType.FLOAT8).setMode(DataMode.OPTIONAL).build();
-    private double d;
-    
-    public DoubleScalar(double d){
-      this.d = d;
-    }
-
-    @Override
-    public MajorType getDataType() {
-      return type;
-    }
-
-    @Override
-    public NumericType getNumericType() {
-      return NumericType.DOUBLE;
-    }
-
-
-    @Override
-    public double getAsDouble() {
-      return d;
-    }
-
-
-    @Override
-    public BigDecimal getAsBigDecimal() {
-      return BigDecimal.valueOf(d);
-    }
-
-    @Override
-    public void write(DataWriter writer) throws IOException {
-      writer.writeSFloat64(d);
-    }
-    
-    @Override
-    public boolean isConstant() {
-      return true;
-    }
-
-    @Override
-    public String toString() {
-      return "DoubleScalar [d=" + d + "]";
-    }
- 
-    @Override
-    public int hashCode() {
-      return getHashCode(d);
-    }
-
-    @Override
-    public DataValue copy() {
-      return new DoubleScalar(d);
-    }
-  }
-  
-  public static class BytesScalar extends BaseDataValue implements BytesValue{
-    private MajorType type = MajorType.newBuilder().setMinorType(MinorType.VARBINARY).setMode(DataMode.OPTIONAL).build();
-    private BytesWritable.Comparator comparator = new BytesWritable.Comparator();
-    private final static HashFunction HASH = Hashing.murmur3_32();
-
-    private byte[] bytes;
-    public BytesScalar(byte[] value){
-      this.bytes = value;
-    }
-
-    @Override
-    public void write(DataWriter writer) throws IOException {
-      writer.writeBytes(bytes);
-    }
-
-    @Override
-    public boolean supportsCompare(DataValue dv2) {
-      return Types.isBytesScalarType(dv2.getDataType());
-    }
-
-
-    @Override
-    public int compareTo(DataValue other) {
-      byte[] b1 = bytes;
-      byte[] b2 = other.getAsBytesValue().getAsArray();
-      return comparator.compare(b1, 0, bytes.length, b2, 0, bytes.length);
-    }
-
-    @Override
-    public MajorType getDataType() {
-      return type;
-    }
-
-    @Override
-    public byte[] getAsArray() {
-      return bytes;
-    }
-
-    @Override
-    public int getLength() {
-      return bytes.length;
-    }
-
-    @Override
-    public byte get(int pos) {
-      return bytes[pos];
-    }
-
-    @Override
-    public String toString() {
-      return "BytesScalar [bytes=" + Arrays.toString(bytes) + "]";
-    }
-
-    @Override
-    public boolean equals(DataValue v) {
-      if(!v.getDataType().equals(this.getDataType())) return false;
-      BytesValue other = v.getAsBytesValue();
-      if(this.getLength() != other.getLength()) return false;
-      for(int i =0; i < this.getLength(); i++){
-        if(this.get(i) !=  other.get(i)) return false;
-      }
-      return true;
-    }
-
-    @Override
-    public int hashCode() {
-      return HASH.hashBytes(bytes).asInt();
-    }
-
-    @Override
-    public DataValue copy() {
-      byte[] out = Arrays.copyOf(bytes, bytes.length);
-      return new BytesScalar(out);
-    }
-
-  }
- 
-  
-  
-  static class NullValue extends BaseDataValue{
-    
-    // not sure what to do here... 
-    MajorType type = MajorType.newBuilder().setMode(DataMode.OPTIONAL).setMinorType(MinorType.LATE).build();
-    
-    @Override
-    public void write(DataWriter writer) throws IOException {
-      writer.writeNullValue();
-    }
-
-    @Override
-    public MajorType getDataType() {
-      return type;
-    }
-
-    @Override
-    public String toString() {
-      return "NullValue";
-    }
-
-    @Override
-    public boolean equals(DataValue v) {
-      // identity since there should be only one.
-      return v == this;
-    }
-
-    @Override
-    public int hashCode() {
-      return 0;
-    }
-
-    @Override
-    public DataValue copy() {
-      return this;
-    }
-    
-  }
-
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/SimpleArrayValue.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/SimpleArrayValue.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/SimpleArrayValue.java
deleted file mode 100644
index 2df0779..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/SimpleArrayValue.java
+++ /dev/null
@@ -1,147 +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.exec.ref.values;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Objects;
-
-import org.apache.drill.common.types.TypeProtos.MinorType;
-import org.apache.drill.exec.ref.rops.DataWriter;
-
-
-public class SimpleArrayValue extends BaseArrayValue{
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SimpleArrayValue.class);
-
-  private static int padding = 5;
-  private DataValue[] items;
-  private int currentLast = -1;
-  
-  
-  public SimpleArrayValue(int size){
-    items  = new DataValue[size];
-  }
-  
-  public SimpleArrayValue(){
-    this(5);
-  }
-  
-  @Override
-  public void addToArray(int index, DataValue v) {
-    if( !(index < items.length)){
-      DataValue[] newItems = new DataValue[index + padding];
-      System.arraycopy(items, 0, newItems, 0, items.length);
-      this.items = newItems;
-    }
-    items[index] = v;
-    this.currentLast = Math.max(this.currentLast, index);
-  }
-
-  @Override
-  public DataValue getByArrayIndex(int index) {
-    if(index < items.length){
-      DataValue ret = items[index];
-      if(ret == null) return NULL_VALUE;
-      return ret;
-    }else{
-      return NULL_VALUE;
-    }
-  }
-
-  @Override
-  protected int getNextIndex() {
-    return currentLast+1;
-  }
-
-  public int size(){
-    return currentLast+1;
-  }
-  
-  @Override
-  public void write(DataWriter w) throws IOException {
-    w.writeArrayStart(currentLast+1);
-    for(int i = 0; i <= currentLast; i++){
-      w.writeArrayElementStart();
-      DataValue v = items[i];
-      if(v == null){
-        w.writeNullValue();
-      }else{
-        v.write(w);
-      }
-      w.writeArrayElementEnd();
-    }
-    w.writeArrayEnd();
-  }
-
-  
-  @Override
-  public void append(BaseArrayValue container) {
-    int curLen = size();
-    int otherLen = container.size();
-    
-    // go backwards so the array gets resized first.
-    for(int i = otherLen -1; i > -1; i--){
-      DataValue v = container.getByArrayIndex(otherLen);
-      this.addToArray(i + curLen, v);
-    }
-    
-  }
-
-  @Override
-  public BaseArrayValue getAsArray() {
-    return this;
-  }
-
-  @Override
-  public BaseMapValue getAsMap() {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public String toString() {
-    return "SimpleArrayValue [items=" + Arrays.toString(items) + ", currentLast=" + currentLast + "]";
-  }
-
-  @Override
-  public boolean equals(DataValue v) {
-    if(v.getDataType().getMinorType() == MinorType.REPEATMAP) return false;
-    BaseArrayValue other = v.getAsContainer().getAsArray();
-    if(this.size() != other.size()) return false;
-    for(int i =0; i < this.size(); i++){
-      DataValue v1 = this.getByArrayIndex(i);
-      DataValue v2 = other.getByArrayIndex(i);
-      if(!v1.equals(v2)) return false;
-    }
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hash((Object[]) items);
-  }
-  
-  @Override
-  public DataValue copy() {
-    SimpleArrayValue out = new SimpleArrayValue(this.size());
-    for(int i =0; i < this.size(); i++)
-      out.addToArray(i, this.getByArrayIndex(i));
-
-    return out;
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/SimpleMapValue.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/SimpleMapValue.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/SimpleMapValue.java
deleted file mode 100644
index 645862f..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/SimpleMapValue.java
+++ /dev/null
@@ -1,130 +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.exec.ref.values;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.drill.common.types.TypeProtos.DataMode;
-import org.apache.drill.exec.ref.exceptions.RecordException;
-import org.apache.drill.exec.ref.rops.DataWriter;
-
-public class SimpleMapValue extends BaseMapValue{
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SimpleMapValue.class);
-  
-  private HashMap<CharSequence, DataValue> map = new HashMap<CharSequence, DataValue>();
-
-  
-  @Override
-  public void setByName(CharSequence name, DataValue v) {
-    if( v== null) throw new RecordException(String.format("You attempted to write a null value with the map key of %s.", name), null);
-    map.put(name, v);
-  }
-
-  @Override
-  protected DataValue getByName(CharSequence name) {
-    return map.get(name);
-  }
-
-  @Override
-  protected void removeByName(CharSequence name) {
-    map.remove(name);
-  }
-
-  @Override
-  public void write(DataWriter w) throws IOException {
-    w.writeMapStart();
-    
-    for(Map.Entry<CharSequence, DataValue> e : map.entrySet()){
-      DataValue v = e.getValue();
-      // skip null values.
-      if(v == null) continue;
-//      logger.debug("Writing key {}", e.getKey());
-      w.writeMapKey(e.getKey());
-      w.writeMapValueStart();
-      v.write(w);
-      w.writeMapValueEnd();
-    }
-    
-    w.writeMapEnd();
-  }
-
-  @Override
-  public Iterator<Entry<CharSequence, DataValue>> iterator() {
-    return map.entrySet().iterator();
-  }
-  
-  @Override
-  public BaseArrayValue getAsArray() {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public BaseMapValue getAsMap() {
-    return this;
-  }
-
-  @Override
-  public boolean equals(DataValue v) {
-    if(v == null) return false;
-    if(v.getDataType().getMode() != DataMode.REPEATED) return false;
-    BaseMapValue other = v.getAsContainer().getAsMap();
-    for(Entry<CharSequence, DataValue> e : this){
-      DataValue v2 = other.getByName(e.getKey());
-      if(!e.getValue().equals(v2)) return false;
-    }
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    return map.hashCode();
-  }
-
-  public DataValue copy() {
-      SimpleMapValue out = new SimpleMapValue();
-      for(Map.Entry<CharSequence, DataValue> entry : map.entrySet()) {
-          out.setByName(entry.getKey().toString(), entry.getValue().copy());
-      }
-      return out;
-  }
-
-  @Override
-  public String toString() {
-    final int maxLen = 10;
-    return "SimpleMapValue [map=" + (map != null ? toString(map.entrySet(), maxLen) : null) + "]";
-  }
-
-  private String toString(Collection<?> collection, int maxLen) {
-    StringBuilder builder = new StringBuilder();
-    builder.append("[");
-    int i = 0;
-    for (Iterator<?> iterator = collection.iterator(); iterator.hasNext() && i < maxLen; i++) {
-      if (i > 0) builder.append(", ");
-      builder.append(iterator.next());
-    }
-    builder.append("]");
-    return builder.toString();
-  }
-  
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/StringValue.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/StringValue.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/StringValue.java
deleted file mode 100644
index 9fcee51..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/StringValue.java
+++ /dev/null
@@ -1,22 +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.exec.ref.values;
-
-public interface StringValue extends DataValue, ComparableValue{
-  public abstract CharSequence getString();
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ValueReader.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ValueReader.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ValueReader.java
deleted file mode 100644
index 3ddf2c6..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ValueReader.java
+++ /dev/null
@@ -1,62 +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.exec.ref.values;
-
-import org.apache.drill.common.exceptions.DrillRuntimeException;
-import org.apache.drill.common.types.TypeProtos.DataMode;
-import org.apache.drill.common.types.TypeProtos.MinorType;
-import org.apache.drill.common.types.Types;
-
-public class ValueReader {
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ValueReader.class);
-  
-  public static boolean getBoolean(DataValue v){
-    if(v.getDataType().getMinorType() == MinorType.BIT && v.getDataType().getMode() != DataMode.REPEATED){
-      return v.getAsBooleanValue().getBoolean();
-    }else{
-      throw new DrillRuntimeException(String.format("Unable to get boolean.  Type was a %s", v.getClass().getCanonicalName()));
-    }
-  }
-  
-  public static long getLong(DataValue v){
-    if(Types.isNumericType(v.getDataType())){
-      return v.getAsNumeric().getAsLong();
-    }else{
-      throw new DrillRuntimeException(String.format("Unable to get value.  %s is not a numeric type.", v.getClass().getCanonicalName()));
-    }
-  }
-  public static double getDouble(DataValue v){
-    if(Types.isNumericType(v.getDataType())){
-      return v.getAsNumeric().getAsDouble();
-    }else{
-      throw new DrillRuntimeException(String.format("Unable to get value.  %s is not a numeric type.", v.getClass().getCanonicalName()));
-    }
-  }
-  public static CharSequence getChars(DataValue v){
-    if(Types.isStringScalarType(v.getDataType())){
-      return v.getAsStringValue().getString();
-    }else{
-      throw new DrillRuntimeException(String.format("Unable to get value.  %s is not a StringValue type.", v.getClass().getCanonicalName()));
-    }
-  }
-  
-  public static String getString(DataValue v){
-    return getChars(v).toString();
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ValueUtils.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ValueUtils.java b/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ValueUtils.java
deleted file mode 100644
index ef1f30d..0000000
--- a/exec/ref/src/main/java/org/apache/drill/exec/ref/values/ValueUtils.java
+++ /dev/null
@@ -1,80 +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.exec.ref.values;
-
-import org.apache.drill.common.expression.PathSegment;
-import org.apache.drill.common.expression.ValueExpressions.CollisionBehavior;
-import org.apache.drill.common.types.TypeProtos.DataMode;
-import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.common.types.TypeProtos.MinorType;
-import org.apache.drill.exec.ref.exceptions.RecordException;
-
-public class ValueUtils {
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ValueUtils.class);
-  
-  public static DataValue getMergedDataValue(CollisionBehavior behavior, DataValue oldValue, DataValue newValue){
-//    logger.debug("Checking merged to see if merged value should be added.  Segment {}, oldValue: {}, new value: " + newValue, segment, oldValue);
-    if(oldValue == DataValue.NULL_VALUE) return newValue;
-    
-    switch(behavior){
-    case SKIP:
-      return oldValue;
-    case REPLACE: 
-      return newValue;
-    case FAIL:
-      throw new RecordException("Failure while doing query.  The destination specified already contains a value and no collision behavior was provdied.", null);
-    case OBJECTIFY:
-      SimpleMapValue n = new SimpleMapValue();
-      n.setByName("old", oldValue);
-      n.setByName("new",  newValue);
-      return n;
-    case ARRAYIFY:
-      SimpleArrayValue a = new SimpleArrayValue();
-      a.addToArray(0, oldValue);
-      a.addToArray(1, newValue);
-      return a;
-    case MERGE_OVERRIDE:
-      MajorType oldT = oldValue.getDataType();
-      MajorType newT = newValue.getDataType();
-      if(oldT.getMinorType() == MinorType.REPEATMAP && newT.getMinorType() == MinorType.REPEATMAP){
-        oldValue.getAsContainer().getAsMap().merge(newValue.getAsContainer().getAsMap());
-        return oldValue;
-      }else if(oldT.getMode() == DataMode.REPEATED && newT.getMode() == DataMode.REPEATED){
-        logger.debug("Merging two arrays. {} and {}", oldValue, newValue);
-        oldValue.getAsContainer().getAsArray().append(newValue.getAsContainer().getAsArray());
-        return oldValue;
-      }else if(oldT.getMode() == DataMode.REPEATED || newT.getMode() == DataMode.REPEATED || oldT.getMinorType() == MinorType.REPEATMAP || newT.getMinorType() == MinorType.REPEATMAP){
-        throw new RecordException(String.format("Failure while doing query.  You requested a merge of values that were incompatibile.  Examples include merging an array and a map or merging a map/array with a scalar.  Merge Types were %s and %s.", oldT, newT), null);
-      }else{
-        // scalar type, just override the value.
-        return newValue;
-      }
-    default:
-      throw new UnsupportedOperationException();
-      
-    }
-  }
-  
-  public static DataValue getIntermediateValues(PathSegment missing, DataValue value){
-    if(missing == null) return value;
-
-    DataValue current = missing.isArray() ? new SimpleArrayValue() : new SimpleMapValue();
-    current.addValue(missing, value);
-    return current;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/resources/drill-module.conf
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/resources/drill-module.conf b/exec/ref/src/main/resources/drill-module.conf
deleted file mode 100644
index c3b50e8..0000000
--- a/exec/ref/src/main/resources/drill-module.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-//  This file tells Drill to consider this module when class path scanning.  
-//  This file can also include any supplementary configuration information.  
-//  This file is in HOCON format, see https://github.com/typesafehub/config/blob/master/HOCON.md for more information.
-drill.storage.packages += "org.apache.drill.exec.ref.rse"

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/main/resources/logback-test.xml
----------------------------------------------------------------------
diff --git a/exec/ref/src/main/resources/logback-test.xml b/exec/ref/src/main/resources/logback-test.xml
deleted file mode 100644
index 3d970a1..0000000
--- a/exec/ref/src/main/resources/logback-test.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!-- 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. -->
-<configuration>
-
-  <appender name="SOCKET" class="de.huxhorn.lilith.logback.appender.ClassicMultiplexSocketAppender">
-    <Compressing>true</Compressing> 
-    <ReconnectionDelay>10000</ReconnectionDelay>
-    <IncludeCallerData>true</IncludeCallerData>
-    <RemoteHosts>localhost</RemoteHosts>
-  </appender>
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <!-- encoders are assigned the type
-         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
-    <encoder>
-      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
-    </encoder>
-  </appender>
-
-  
-  <logger name="org.apache.drill" additivity="false">
-    <level value="debug" />
-    <appender-ref ref="SOCKET" />
-    <appender-ref ref="STDOUT" />
-  </logger>
-
-  <root>
-    <level value="error" />
-    <appender-ref ref="SOCKET" />
-    <appender-ref ref="STDOUT" />
-  </root>
-
-        
-</configuration>

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/test/java/org/apache/drill/exec/ref/RSERegistryTest.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/test/java/org/apache/drill/exec/ref/RSERegistryTest.java b/exec/ref/src/test/java/org/apache/drill/exec/ref/RSERegistryTest.java
deleted file mode 100644
index 47db9ec..0000000
--- a/exec/ref/src/test/java/org/apache/drill/exec/ref/RSERegistryTest.java
+++ /dev/null
@@ -1,40 +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.exec.ref;
-
-import org.apache.drill.common.config.DrillConfig;
-import org.apache.drill.common.logical.StorageEngineConfig;
-import org.apache.drill.exec.ref.rse.ConsoleRSE;
-import org.apache.drill.exec.ref.rse.RSERegistry;
-import org.junit.Test;
-
-import static junit.framework.Assert.assertSame;
-
-
-public class RSERegistryTest {
-
-  @Test
-  public void testEnginesWithTheSameNameAreEqual() {
-    DrillConfig config = DrillConfig.create();
-    RSERegistry rses = new RSERegistry(config);
-    StorageEngineConfig hconfig = new ConsoleRSE.ConsoleRSEConfig();
-    ConsoleRSE engine = (ConsoleRSE) rses.getEngine(hconfig);
-    ConsoleRSE engine2 = (ConsoleRSE) rses.getEngine(hconfig);
-    assertSame(engine, engine2);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/b3460af8/exec/ref/src/test/java/org/apache/drill/exec/ref/RunSimplePlan.java
----------------------------------------------------------------------
diff --git a/exec/ref/src/test/java/org/apache/drill/exec/ref/RunSimplePlan.java b/exec/ref/src/test/java/org/apache/drill/exec/ref/RunSimplePlan.java
deleted file mode 100644
index f4992e0..0000000
--- a/exec/ref/src/test/java/org/apache/drill/exec/ref/RunSimplePlan.java
+++ /dev/null
@@ -1,77 +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.exec.ref;
-
-import static org.junit.Assert.*;
-
-import java.util.Collection;
-
-import org.apache.drill.common.config.DrillConfig;
-import org.apache.drill.common.logical.LogicalPlan;
-import org.apache.drill.common.util.FileUtils;
-import org.apache.drill.exec.ref.RunOutcome.OutcomeType;
-import org.apache.drill.exec.ref.eval.BasicEvaluatorFactory;
-import org.apache.drill.exec.ref.rse.RSERegistry;
-import org.junit.Test;
-
-import com.google.common.base.Charsets;
-import com.google.common.io.Files;
-
-public class RunSimplePlan{
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RunSimplePlan.class);
-  
-  
-  @Test
-  public void parseSimplePlan() throws Throwable{
-    DrillConfig config = DrillConfig.create();
-    LogicalPlan plan = LogicalPlan.parse(config, Files.toString(FileUtils.getResourceAsFile("/simple_plan.json"), Charsets.UTF_8));
-    IteratorRegistry ir = new IteratorRegistry();
-    ReferenceInterpreter i = new ReferenceInterpreter(plan, ir, new BasicEvaluatorFactory(ir), new RSERegistry(config));
-    i.setup();
-    Collection<RunOutcome> outcomes = i.run();
-    assertEquals(outcomes.size(), 1);
-    assertEquals(outcomes.iterator().next().records, 2);
-  }
-  
-  @Test
-  public void joinPlan() throws Throwable{
-    DrillConfig config = DrillConfig.create();
-    LogicalPlan plan = LogicalPlan.parse(config, Files.toString(FileUtils.getResourceAsFile("/simple_join.json"), Charsets.UTF_8));
-    IteratorRegistry ir = new IteratorRegistry();
-    ReferenceInterpreter i = new ReferenceInterpreter(plan, ir, new BasicEvaluatorFactory(ir), new RSERegistry(config));
-    i.setup();
-    Collection<RunOutcome> outcomes = i.run();
-    assertEquals(outcomes.size(), 1);
-    RunOutcome out = outcomes.iterator().next();
-    if(out.outcome != OutcomeType.FAILED && out.exception != null) logger.error("Failure while running {}", out.exception);
-  }
-  
-  @Test
-  public void flattenPlan() throws Throwable{
-    DrillConfig config = DrillConfig.create();
-    LogicalPlan plan = LogicalPlan.parse(config, Files.toString(FileUtils.getResourceAsFile("/simple_plan_flattened.json"), Charsets.UTF_8));
-    IteratorRegistry ir = new IteratorRegistry();
-    ReferenceInterpreter i = new ReferenceInterpreter(plan, ir, new BasicEvaluatorFactory(ir), new RSERegistry(config));
-    i.setup();
-    Collection<RunOutcome> outcomes = i.run();
-    assertEquals(outcomes.size(), 1);
-    RunOutcome out = outcomes.iterator().next();
-    if(out.outcome != OutcomeType.FAILED && out.exception != null) logger.error("Failure while running {}", out.exception);
-    assertEquals(out.outcome, RunOutcome.OutcomeType.SUCCESS);
-  }
-}


Mime
View raw message