Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Drill >> mail # dev >> [36/52] [abbrv] [partial] DRILL-165: Reorganize directories (moves only)


Copy link to this message
-
[36/52] [abbrv] [partial] DRILL-165: Reorganize directories (moves only)
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/a593d908/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ComparisonFunctionsNullable.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ComparisonFunctionsNullable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ComparisonFunctionsNullable.java
new file mode 100644
index 0000000..976b759
--- /dev/null
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ComparisonFunctionsNullable.java
@@ -0,0 +1,232 @@
+package org.apache.drill.exec.expr.fn.impl;
+
+import org.apache.drill.exec.expr.DrillSimpleFunc;
+import org.apache.drill.exec.expr.annotations.FunctionTemplate;
+import org.apache.drill.exec.expr.annotations.Output;
+import org.apache.drill.exec.expr.annotations.Param;
+import org.apache.drill.exec.expr.holders.BitHolder;
+import org.apache.drill.exec.expr.holders.NullableBigIntHolder;
+import org.apache.drill.exec.expr.holders.NullableIntHolder;
+import org.apache.drill.exec.record.RecordBatch;
+
+public class ComparisonFunctionsNullable {
+    static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ComparisonFunctionsNullable.class);
+
+    private ComparisonFunctionsNullable() {}
+
+    @FunctionTemplate(name = "equal", scope = FunctionTemplate.FunctionScope.SIMPLE)
+    public static class NullableIntEqual implements DrillSimpleFunc {
+
+        @Param NullableIntHolder left;
+        @Param NullableIntHolder right;
+        @Output BitHolder out;
+
+        public void setup(RecordBatch b) {}
+
+        public void eval() {
+            if (left.isSet  == 0 || right.isSet == 0) {
+                out.value = 0;
+            } else {
+                out.value = (left.value == right.value) ? 1 : 0;
+            }
+        }
+    }
+
+    @FunctionTemplate(name = "equal", scope = FunctionTemplate.FunctionScope.SIMPLE)
+    public static class NullableBigIntEqual implements DrillSimpleFunc {
+
+        @Param NullableBigIntHolder left;
+        @Param NullableBigIntHolder right;
+        @Output BitHolder out;
+
+        public void setup(RecordBatch b) {}
+
+        public void eval() {
+            if (left.isSet  == 0 || right.isSet == 0) {
+                out.value = 0;
+            } else {
+                out.value = (left.value == right.value) ? 1 : 0;
+            }
+        }
+    }
+
+    @FunctionTemplate(name = "not equal", scope = FunctionTemplate.FunctionScope.SIMPLE)
+    public static class NullableIntNotEqual implements DrillSimpleFunc {
+
+        @Param NullableIntHolder left;
+        @Param NullableIntHolder right;
+        @Output BitHolder out;
+
+        public void setup(RecordBatch b) {}
+
+        public void eval() {
+            if (left.isSet  == 0 || right.isSet == 0) {
+                out.value = 0;
+            } else {
+                out.value = (left.value != right.value) ? 1 : 0;
+            }
+        }
+    }
+
+    @FunctionTemplate(name = "not equal", scope = FunctionTemplate.FunctionScope.SIMPLE)
+    public static class NullableBigIntNotEqual implements DrillSimpleFunc {
+
+        @Param NullableBigIntHolder left;
+        @Param NullableBigIntHolder right;
+        @Output BitHolder out;
+
+        public void setup(RecordBatch b) {}
+
+        public void eval() {
+            if (left.isSet  == 0 || right.isSet == 0) {
+                out.value = 0;
+            } else {
+                out.value = (left.value != right.value) ? 1 : 0;
+            }
+        }
+    }
+
+    @FunctionTemplate(name = "less than", scope = FunctionTemplate.FunctionScope.SIMPLE)
+    public static class NullableIntLessThan implements DrillSimpleFunc {
+
+        @Param NullableIntHolder left;
+        @Param NullableIntHolder right;
+        @Output BitHolder out;
+
+        public void setup(RecordBatch b) {}
+
+        public void eval() {
+            if (left.isSet  == 0 || right.isSet == 0) {
+                out.value = 0;
+            } else {
+                out.value = (left.value < right.value) ? 1 : 0;
+            }
+        }
+    }
+
+    @FunctionTemplate(name = "less than", scope = FunctionTemplate.FunctionScope.SIMPLE)
+    public static class NullableBigIntLessThan implements DrillSimpleFunc {
+
+        @Param NullableBigIntHolder left;
+        @Param NullableBigIntHolder right;
+        @Output BitHolder out;
+
+        public void setup(RecordBatch b) {}
+
+        public void eval() {
+            if (left.isSet  == 0 || right.isSet == 0) {
+                out.value = 0;
+            } else {
+                out.value = (left.value < right.value) ? 1 : 0;
+            }
+        }
+    }
+
+    @FunctionTemplate(name = "less than or equal to", scope = FunctionTemplate.FunctionScope.SIMPLE)
+    public static class NullableIntLessThanEqual implements DrillSimpleFunc {
+
+        @Param NullableIntHolder left;
+        @Param NullableIntHolder right;
+        @Output BitHolder out;
+
+        public void setup(RecordBatch b) {}
+
+        public void eval() {
+            if (left.isSet  == 0 || right.isSet == 0) {
+                out.value = 0;
+            } else {
+                out.value = (left.value <= right.value) ? 1 : 0;
+            }
+        }
+    }
+
+    @FunctionTemplate(name = "less than or equal to", scope = FunctionTemplate.FunctionScope.SIMPLE)
+    public static class NullableBigIntLessThanEqual implements DrillSimpleFunc {
+
+        @Param NullableBigIntHolder left;
+        @Param NullableBigIntHolder right;
+        @Output BitHolder out;
+
+        public void setup(RecordBatch b) {}
+
+        public void eval() {
+            if (left.isSet  == 0 || right.isSet == 0) {
+                out.value = 0;
+            } else {
+                out.value = (left.value <= right.value) ? 1 : 0;
+            }
+        }
+    }
+
+    @FunctionTemplate(name = "greater than", s