Add support for Float8 functions
authorJacques Nadeau <jacques@apache.org>
Tue, 23 Jul 2013 19:35:41 +0000 (12:35 -0700)
committerJacques Nadeau <jacques@apache.org>
Tue, 23 Jul 2013 19:35:41 +0000 (12:35 -0700)
Move MockRecordReader to use AllocationHelper
Change pom.xml to exclude other eclipse incompatible plugins for m2eclipse

sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/CodeGenerator.java
sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/holders/Float8Holder.java [new file with mode: 0644]
sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/holders/NullableFloat8Holder.java [new file with mode: 0644]
sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/MockRecordReader.java
sandbox/prototype/pom.xml

index b99af19..b8dc2ce 100644 (file)
@@ -10,9 +10,11 @@ import org.apache.drill.exec.compile.TemplateClassDefinition;
 import org.apache.drill.exec.exception.SchemaChangeException;
 import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry;
 import org.apache.drill.exec.expr.holders.BooleanHolder;
+import org.apache.drill.exec.expr.holders.Float8Holder;
 import org.apache.drill.exec.expr.holders.IntHolder;
 import org.apache.drill.exec.expr.holders.LongHolder;
 import org.apache.drill.exec.expr.holders.NullableBooleanHolder;
+import org.apache.drill.exec.expr.holders.NullableFloat8Holder;
 import org.apache.drill.exec.expr.holders.NullableIntHolder;
 import org.apache.drill.exec.expr.holders.NullableLongHolder;
 import org.apache.drill.exec.ops.FragmentContext;
@@ -207,6 +209,8 @@ public class CodeGenerator<T> {
         return model._ref(IntHolder.class);
       case BIGINT:  
         return model._ref(LongHolder.class);
+      case FLOAT8:
+        return model._ref(Float8Holder.class);
       
       }
       
@@ -218,6 +222,8 @@ public class CodeGenerator<T> {
         return model._ref(NullableIntHolder.class);
       case BIGINT:  
         return model._ref(NullableLongHolder.class);
+      case FLOAT8:
+        return model._ref(NullableFloat8Holder.class);
       }
 
     }
diff --git a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/holders/Float8Holder.java b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/holders/Float8Holder.java
new file mode 100644 (file)
index 0000000..78e7cb8
--- /dev/null
@@ -0,0 +1,14 @@
+package org.apache.drill.exec.expr.holders;
+
+import org.apache.drill.common.types.TypeProtos.MajorType;
+import org.apache.drill.common.types.TypeProtos.MinorType;
+import org.apache.drill.common.types.Types;
+
+public class Float8Holder implements ValueHolder {
+  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Float8Holder.class);
+  
+  public static final MajorType TYPE = Types.required(MinorType.FLOAT8);
+  public double value;
+  public int isSet;
+  
+}
diff --git a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/holders/NullableFloat8Holder.java b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/holders/NullableFloat8Holder.java
new file mode 100644 (file)
index 0000000..f8fa224
--- /dev/null
@@ -0,0 +1,13 @@
+package org.apache.drill.exec.expr.holders;
+
+import org.apache.drill.common.types.TypeProtos.MajorType;
+import org.apache.drill.common.types.TypeProtos.MinorType;
+import org.apache.drill.common.types.Types;
+
+public class NullableFloat8Holder implements ValueHolder{
+  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(NullableFloat8Holder.class);
+  
+  public static final MajorType TYPE = Types.optional(MinorType.FLOAT8);
+  public double value;
+  
+}
index d710d78..687b28b 100644 (file)
@@ -29,6 +29,7 @@ import org.apache.drill.exec.physical.config.MockScanPOP.MockScanEntry;
 import org.apache.drill.exec.physical.impl.OutputMutator;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.store.RecordReader;
+import org.apache.drill.exec.vector.AllocationHelper;
 import org.apache.drill.exec.vector.FixedWidthVector;
 import org.apache.drill.exec.vector.NonRepeatedMutator;
 import org.apache.drill.exec.vector.TypeHelper;
@@ -65,13 +66,7 @@ public class MockRecordReader implements RecordReader {
     MaterializedField f = MaterializedField.create(new SchemaPath(name, ExpressionPosition.UNKNOWN), type);
     ValueVector v;
     v = TypeHelper.getNewVector(f, context.getAllocator());
-    if(v instanceof FixedWidthVector){
-      ((FixedWidthVector)v).allocateNew(length);  
-    }else if(v instanceof VariableWidthVector){
-      ((VariableWidthVector)v).allocateNew(50*length, length);
-    }else{
-      throw new UnsupportedOperationException(String.format("Unable to get allocate vector %s", v.getClass().getName()));
-    }
+    AllocationHelper.allocate(v, length, 50);
     
     return v;
 
index 2e5dd02..4d50916 100644 (file)
                     <versionRange>[1.0,)</versionRange>
                     <goals>
                       <goal>run</goal>
+                      <goal>generate</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore></ignore>
+                  </action>
+                </pluginExecution>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-enforcer-plugin</artifactId>
+                    <versionRange>[1.2,)</versionRange>
+                    <goals>
+                      <goal>enforce</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore></ignore>
+                  </action>
+                </pluginExecution>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>
+                      maven-remote-resources-plugin
+                    </artifactId>
+                    <versionRange>[1.1,)</versionRange>
+                    <goals>
+                      <goal>process</goal>
                     </goals>
                   </pluginExecutionFilter>
                   <action>