You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by ja...@apache.org on 2014/04/20 03:18:30 UTC

[22/51] [abbrv] git commit: not function implementation

not function implementation


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

Branch: refs/heads/master
Commit: ca58de14810c7556c507dd1013aa488f0cafb6bb
Parents: 8e2b950
Author: Steven Phillips <sp...@maprtech.com>
Authored: Wed Apr 2 15:02:01 2014 -0700
Committer: Jacques Nadeau <ja...@apache.org>
Committed: Sat Apr 19 18:07:10 2014 -0700

----------------------------------------------------------------------
 .../org/apache/drill/exec/expr/fn/impl/Not.java | 57 ++++++++++++++++++++
 1 file changed, 57 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/ca58de14/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Not.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Not.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Not.java
new file mode 100644
index 0000000..db33247
--- /dev/null
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Not.java
@@ -0,0 +1,57 @@
+/**
+ * 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.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.FunctionTemplate.NullHandling;
+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.NullableBitHolder;
+import org.apache.drill.exec.record.RecordBatch;
+
+public class Not {
+
+  @FunctionTemplate(names = {"not"}, scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL)
+  public static class Optional implements DrillSimpleFunc {
+
+    @Param NullableBitHolder in;
+    @Output BitHolder out;
+
+    public void setup(RecordBatch incoming) { }
+
+    public void eval() {
+      out.value = (in.value == 0 ? 1 : 0);
+    }
+  }
+
+  @FunctionTemplate(names = {"not"}, scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL)
+  public static class Required implements DrillSimpleFunc {
+
+    @Param BitHolder in;
+    @Output BitHolder out;
+
+    public void setup(RecordBatch incoming) { }
+
+    public void eval() {
+      out.value = in.value == 0 ? 1 : 0;
+    }
+  }
+}
\ No newline at end of file