You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by ji...@apache.org on 2013/12/03 11:48:14 UTC

git commit: TAJO-366: Implement trigonometric functions. (Jae Young Lee via jihoon)

Updated Branches:
  refs/heads/master 3e2a2636e -> abc08308f


TAJO-366: Implement trigonometric functions. (Jae Young Lee via jihoon)


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

Branch: refs/heads/master
Commit: abc08308f7fe54619c56c6dbba5e4c0e7b669aa8
Parents: 3e2a263
Author: Jihoon Son <ji...@apache.org>
Authored: Tue Dec 3 19:47:43 2013 +0900
Committer: Jihoon Son <ji...@apache.org>
Committed: Tue Dec 3 19:47:43 2013 +0900

----------------------------------------------------------------------
 CHANGES.txt                                     |   2 +
 .../apache/tajo/engine/function/math/Acos.java  |  50 +++++++++
 .../apache/tajo/engine/function/math/Asin.java  |  50 +++++++++
 .../apache/tajo/engine/function/math/Atan.java  |  50 +++++++++
 .../apache/tajo/engine/function/math/Atan2.java |  51 +++++++++
 .../apache/tajo/engine/function/math/Cos.java   |  50 +++++++++
 .../apache/tajo/engine/function/math/Sin.java   |  28 ++---
 .../apache/tajo/engine/function/math/Tan.java   |  51 +++++++++
 .../java/org/apache/tajo/master/TajoMaster.java |  62 +++++++++++
 .../tajo/engine/function/TestMathFunctions.java | 103 ++++++++++++++++++-
 10 files changed, 481 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/abc08308/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 8dd57d6..be5418c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -4,6 +4,8 @@ Release 0.8.0 - unreleased
 
   NEW FEATURES
 
+    TAJO-366: Implement trigonometric functions. (Jae Young Lee via jihoon)
+
     TAJO-358: Implement initcap(string) function. (Seungun Choe via hyunsik)
 
     TAJO-355: Implement repeat(text,int) function. (DaeMyung Kang via jaehwa)

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/abc08308/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Acos.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Acos.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Acos.java
new file mode 100644
index 0000000..3c12bfb
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Acos.java
@@ -0,0 +1,50 @@
+/**
+ * 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.tajo.engine.function.math;
+
+import org.apache.tajo.catalog.Column;
+import org.apache.tajo.common.TajoDataTypes;
+import org.apache.tajo.datum.Datum;
+import org.apache.tajo.datum.DatumFactory;
+import org.apache.tajo.datum.NullDatum;
+import org.apache.tajo.engine.function.GeneralFunction;
+import org.apache.tajo.storage.Tuple;
+
+/**
+ * Function definition
+ *
+ * Float8 acos(value FLOAT8)
+ */
+public class Acos extends GeneralFunction {
+  public Acos() {
+    super(new Column[] {
+        new Column("value", TajoDataTypes.Type.FLOAT8)
+    });
+  }
+
+  @Override
+  public Datum eval(Tuple params) {
+    Datum valueDatum = params.get(0);
+    if(valueDatum instanceof NullDatum) {
+      return NullDatum.get();
+    }
+
+    return DatumFactory.createFloat8(Math.acos(valueDatum.asFloat8()));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/abc08308/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Asin.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Asin.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Asin.java
new file mode 100644
index 0000000..9357a1a
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Asin.java
@@ -0,0 +1,50 @@
+/**
+ * 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.tajo.engine.function.math;
+
+import org.apache.tajo.catalog.Column;
+import org.apache.tajo.common.TajoDataTypes;
+import org.apache.tajo.datum.Datum;
+import org.apache.tajo.datum.DatumFactory;
+import org.apache.tajo.datum.NullDatum;
+import org.apache.tajo.engine.function.GeneralFunction;
+import org.apache.tajo.storage.Tuple;
+
+/**
+ * Function definition
+ *
+ * Float8 asin(value FLOAT8)
+ */
+public class Asin extends GeneralFunction {
+  public Asin() {
+    super(new Column[] {
+        new Column("value", TajoDataTypes.Type.FLOAT8)
+    });
+  }
+
+  @Override
+  public Datum eval(Tuple params) {
+    Datum valueDatum = params.get(0);
+    if(valueDatum instanceof NullDatum) {
+      return NullDatum.get();
+    }
+
+    return DatumFactory.createFloat8(Math.asin(valueDatum.asFloat8()));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/abc08308/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Atan.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Atan.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Atan.java
new file mode 100644
index 0000000..c628a26
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Atan.java
@@ -0,0 +1,50 @@
+/**
+ * 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.tajo.engine.function.math;
+
+import org.apache.tajo.catalog.Column;
+import org.apache.tajo.common.TajoDataTypes;
+import org.apache.tajo.datum.Datum;
+import org.apache.tajo.datum.DatumFactory;
+import org.apache.tajo.datum.NullDatum;
+import org.apache.tajo.engine.function.GeneralFunction;
+import org.apache.tajo.storage.Tuple;
+
+/**
+ * Function definition
+ *
+ * Float8 atan(value FLOAT8)
+ */
+public class Atan extends GeneralFunction {
+  public Atan() {
+    super(new Column[] {
+        new Column("value", TajoDataTypes.Type.FLOAT8)
+    });
+  }
+
+  @Override
+  public Datum eval(Tuple params) {
+    Datum valueDatum = params.get(0);
+    if(valueDatum instanceof NullDatum) {
+      return NullDatum.get();
+    }
+
+    return DatumFactory.createFloat8(Math.atan(valueDatum.asFloat8()));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/abc08308/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Atan2.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Atan2.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Atan2.java
new file mode 100644
index 0000000..99908e7
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Atan2.java
@@ -0,0 +1,51 @@
+/**
+ * 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.tajo.engine.function.math;
+
+import org.apache.tajo.catalog.Column;
+import org.apache.tajo.common.TajoDataTypes;
+import org.apache.tajo.datum.Datum;
+import org.apache.tajo.datum.DatumFactory;
+import org.apache.tajo.datum.NullDatum;
+import org.apache.tajo.engine.function.GeneralFunction;
+import org.apache.tajo.storage.Tuple;
+
+/**
+ * Function definition
+ *
+ * Float8 atan2(value FLOAT8, value FLOAT8)
+ */
+public class Atan2 extends GeneralFunction {
+  public Atan2() {
+    super(new Column[] {
+        new Column("value", TajoDataTypes.Type.FLOAT8)
+    });
+  }
+
+  @Override
+  public Datum eval(Tuple params) {
+    Datum valueDatumx = params.get(0);
+    Datum valueDatumy = params.get(1);
+    if(valueDatumx instanceof NullDatum || valueDatumy instanceof NullDatum) {
+      return NullDatum.get();
+    }
+
+    return DatumFactory.createFloat8(Math.atan2(valueDatumx.asFloat8(), valueDatumy.asFloat8()));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/abc08308/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Cos.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Cos.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Cos.java
new file mode 100644
index 0000000..44194b2
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Cos.java
@@ -0,0 +1,50 @@
+/**
+ * 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.tajo.engine.function.math;
+
+import org.apache.tajo.catalog.Column;
+import org.apache.tajo.common.TajoDataTypes;
+import org.apache.tajo.datum.Datum;
+import org.apache.tajo.datum.DatumFactory;
+import org.apache.tajo.datum.NullDatum;
+import org.apache.tajo.engine.function.GeneralFunction;
+import org.apache.tajo.storage.Tuple;
+
+/**
+ * Function definition
+ *
+ * Float8 cos(value FLOAT8)
+ */
+public class Cos extends GeneralFunction {
+  public Cos() {
+    super(new Column[] {
+        new Column("value", TajoDataTypes.Type.FLOAT8)
+    });
+  }
+
+  @Override
+  public Datum eval(Tuple params) {
+    Datum valueDatum = params.get(0);
+    if(valueDatum instanceof NullDatum) {
+      return NullDatum.get();
+    }
+
+    return DatumFactory.createFloat8(Math.cos(valueDatum.asFloat8()));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/abc08308/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Sin.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Sin.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Sin.java
index 158fad2..928625c 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Sin.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Sin.java
@@ -29,22 +29,22 @@ import org.apache.tajo.storage.Tuple;
 /**
  * Function definition
  *
- * INT8 sin(value FLOAT8)
+ * Float8 sin(value FLOAT8)
  */
 public class Sin extends GeneralFunction {
-    public Sin() {
-        super(new Column[] {
-                new Column("value", TajoDataTypes.Type.FLOAT8)
-        });
-    }
-
-    @Override
-    public Datum eval(Tuple params) {
-        Datum valueDatum = params.get(0);
-        if(valueDatum instanceof NullDatum) {
-            return NullDatum.get();
-        }
+  public Sin() {
+    super(new Column[] {
+        new Column("value", TajoDataTypes.Type.FLOAT8)
+    });
+  }
 
-        return DatumFactory.createFloat8(Math.sin(valueDatum.asFloat8()));
+  @Override
+  public Datum eval(Tuple params) {
+    Datum valueDatum = params.get(0);
+    if(valueDatum instanceof NullDatum) {
+      return NullDatum.get();
     }
+
+    return DatumFactory.createFloat8(Math.sin(valueDatum.asFloat8()));
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/abc08308/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Tan.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Tan.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Tan.java
new file mode 100644
index 0000000..d06461b
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/math/Tan.java
@@ -0,0 +1,51 @@
+/**
+ * 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.tajo.engine.function.math;
+
+import org.apache.tajo.catalog.Column;
+import org.apache.tajo.common.TajoDataTypes;
+import org.apache.tajo.datum.Datum;
+import org.apache.tajo.datum.DatumFactory;
+import org.apache.tajo.datum.NullDatum;
+import org.apache.tajo.engine.function.GeneralFunction;
+import org.apache.tajo.storage.Tuple;
+
+/**
+ * Function definition
+ *
+ * Float8 tan(value FLOAT8)
+ */
+
+public class Tan extends GeneralFunction {
+  public Tan() {
+    super(new Column[] {
+        new Column("value", TajoDataTypes.Type.FLOAT8)
+    });
+  }
+
+  @Override
+  public Datum eval(Tuple params) {
+    Datum valueDatum = params.get(0);
+    if(valueDatum instanceof NullDatum) {
+      return NullDatum.get();
+    }
+
+    return DatumFactory.createFloat8(Math.tan(valueDatum.asFloat8()));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/abc08308/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java
index 37ace1f..f783a0f 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java
@@ -494,6 +494,68 @@ public class TajoMaster extends CompositeService {
             CatalogUtil.newSimpleDataTypeArray(Type.FLOAT4)));
 
     sqlFuncs.add(
+        new FunctionDesc("cos", Cos.class, FunctionType.GENERAL,
+            CatalogUtil.newSimpleDataType(Type.FLOAT8),
+            CatalogUtil.newSimpleDataTypeArray(Type.FLOAT8)));
+
+    sqlFuncs.add(
+        new FunctionDesc("cos", Cos.class, FunctionType.GENERAL,
+            CatalogUtil.newSimpleDataType(Type.FLOAT8),
+            CatalogUtil.newSimpleDataTypeArray(Type.FLOAT4)));
+
+    sqlFuncs.add(
+        new FunctionDesc("tan", Tan.class, FunctionType.GENERAL,
+            CatalogUtil.newSimpleDataType(Type.FLOAT8),
+            CatalogUtil.newSimpleDataTypeArray(Type.FLOAT8)));
+
+    sqlFuncs.add(
+        new FunctionDesc("tan", Tan.class, FunctionType.GENERAL,
+            CatalogUtil.newSimpleDataType(Type.FLOAT8),
+            CatalogUtil.newSimpleDataTypeArray(Type.FLOAT4)));
+
+    sqlFuncs.add(
+        new FunctionDesc("asin", Asin.class, FunctionType.GENERAL,
+            CatalogUtil.newSimpleDataType(Type.FLOAT8),
+            CatalogUtil.newSimpleDataTypeArray(Type.FLOAT8)));
+
+    sqlFuncs.add(
+        new FunctionDesc("asin", Asin.class, FunctionType.GENERAL,
+            CatalogUtil.newSimpleDataType(Type.FLOAT8),
+            CatalogUtil.newSimpleDataTypeArray(Type.FLOAT4)));
+
+    sqlFuncs.add(
+        new FunctionDesc("acos", Acos.class, FunctionType.GENERAL,
+            CatalogUtil.newSimpleDataType(Type.FLOAT8),
+            CatalogUtil.newSimpleDataTypeArray(Type.FLOAT8)));
+
+    sqlFuncs.add(
+        new FunctionDesc("acos", Acos.class, FunctionType.GENERAL,
+            CatalogUtil.newSimpleDataType(Type.FLOAT8),
+            CatalogUtil.newSimpleDataTypeArray(Type.FLOAT4)));
+
+    sqlFuncs.add(
+        new FunctionDesc("atan", Atan.class, FunctionType.GENERAL,
+            CatalogUtil.newSimpleDataType(Type.FLOAT8),
+            CatalogUtil.newSimpleDataTypeArray(Type.FLOAT8)));
+
+    sqlFuncs.add(
+        new FunctionDesc("atan", Atan.class, FunctionType.GENERAL,
+            CatalogUtil.newSimpleDataType(Type.FLOAT8),
+            CatalogUtil.newSimpleDataTypeArray(Type.FLOAT4)));
+
+    sqlFuncs.add(
+        new FunctionDesc("atan2", Atan2.class, FunctionType.GENERAL,
+            CatalogUtil.newSimpleDataType(Type.FLOAT8),
+            CatalogUtil.newSimpleDataTypeArray(Type.FLOAT8, Type.FLOAT8)));
+
+    sqlFuncs.add(
+        new FunctionDesc("atan2", Atan2.class, FunctionType.GENERAL,
+            CatalogUtil.newSimpleDataType(Type.FLOAT8),
+            CatalogUtil.newSimpleDataTypeArray(Type.FLOAT4, Type.FLOAT4)));
+
+
+
+    sqlFuncs.add(
         new FunctionDesc("initcap", InitCap.class, FunctionType.GENERAL,
             CatalogUtil.newSimpleDataType(Type.TEXT),
             CatalogUtil.newSimpleDataTypeArray(Type.TEXT)));

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/abc08308/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java
index 2c95043..703d49d 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java
@@ -94,7 +94,106 @@ public class TestMathFunctions extends ExprTestBase {
     schema.addColumn("col3", FLOAT8);
 
     testEval(schema, "table1", "1.0, 0.2, 0.1", "select sin(col1 + col2 + col3) from table1",
-       new String[]{"0.963558185417193"});
-}
+        new String[]{"0.963558185417193"});
+  }
+
+
+  @Test
+  public void testCos() throws IOException {
+    testSimpleEval("select cos(0.0) as col1 ", new String[]{"1.0"});
+    testSimpleEval("select cos(0.7) as col1 ", new String[]{"0.7648421949641616"});
+    testSimpleEval("select cos(1.2) as col1 ", new String[]{"0.36235771003358624"});
+//    testSimpleEval("select cos(-0.5) as col1 ", new String[]{"0.8775825618903728"});
+
+    Schema schema = new Schema();
+    schema.addColumn("col1", FLOAT8);
+    schema.addColumn("col2", FLOAT8);
+    schema.addColumn("col3", FLOAT8);
+
+    testEval(schema, "table1", "1.0, 0.2, 0.1", "select cos(col1 + col2 + col3) from table1",
+        new String[]{"0.26749882862458735"});
+  }
+
+  @Test
+  public void testTan() throws IOException {
+    testSimpleEval("select tan(0.0) as col1 ", new String[]{"0.0"});
+    testSimpleEval("select tan(0.3) as col1 ", new String[]{"0.30933626267125297"});
+    testSimpleEval("select tan(0.8) as col1 ", new String[]{"1.0296385816093323"});
+//    testSimpleEval("select tan(-0.5) as col1 ", new String[]{"-0.5463024898437905"});
+
+    Schema schema = new Schema();
+    schema.addColumn("col1", FLOAT8);
+    schema.addColumn("col2", FLOAT8);
+    schema.addColumn("col3", FLOAT8);
+
+    testEval(schema, "table1", "1.0, 0.2, 0.1", "select tan(col1 - col2 - col3) from table1",
+        new String[]{"0.8422883804630795"});
+  }
+
+  @Test
+  public void testAsin() throws IOException {
+    testSimpleEval("select asin(0.0) as col1 ", new String[]{"0.0"});
+    testSimpleEval("select asin(0.3) as col1 ", new String[]{"0.3046926665119266"});
+    testSimpleEval("select asin(0.8) as col1 ", new String[]{"0.9272952378698274"});
+//    testSimpleEval("select asin(-0.5) as col1 ", new String[]{"-0.5235987755982989"});
+
+    Schema schema = new Schema();
+    schema.addColumn("col1", FLOAT8);
+    schema.addColumn("col2", FLOAT8);
+    schema.addColumn("col3", FLOAT8);
+
+    testEval(schema, "table1", "1.0, 0.2, 0.1", "select asin(col1 - col2 - col3) from table1",
+        new String[]{"0.7753974966107532"});
+  }
+
+  @Test
+  public void testAcos() throws IOException {
+    testSimpleEval("select acos(0.0) as col1 ", new String[]{"1.5707963267948966"});
+    testSimpleEval("select acos(0.3) as col1 ", new String[]{"1.26610366028297"});
+    testSimpleEval("select acos(0.8) as col1 ", new String[]{"0.6435010889250692"});
+//    testSimpleEval("select acos(-0.5) as col1 ", new String[]{"2.0943951023931957"});
+
+    Schema schema = new Schema();
+    schema.addColumn("col1", FLOAT8);
+    schema.addColumn("col2", FLOAT8);
+    schema.addColumn("col3", FLOAT8);
+
+    testEval(schema, "table1", "1.0, 0.2, 0.1", "select acos(col1 - col2 - col3) from table1",
+        new String[]{"0.7953988301841435"});
+  }
+
+  @Test
+  public void testAtan() throws IOException {
+    testSimpleEval("select atan(0.0) as col1 ", new String[]{"0.0"});
+    testSimpleEval("select atan(0.8) as col1 ", new String[]{"0.6747409494924117"});
+    testSimpleEval("select atan(1.2) as col1 ", new String[]{"0.8760580701406995"});
+//    testSimpleEval("select atan(-0.5) as col1 ", new String[]{"-0.4636476090008061"});
+
+    Schema schema = new Schema();
+    schema.addColumn("col1", FLOAT8);
+    schema.addColumn("col2", FLOAT8);
+    schema.addColumn("col3", FLOAT8);
+
+    testEval(schema, "table1", "1.0, 0.2, 0.1", "select atan(col1 + col2 + col3) from table1",
+        new String[]{"0.9151007005533605"});
+  }
+
+  @Test
+  public void testAtan2() throws IOException {
+    testSimpleEval("select atan2(0.8, 0.0) as col1 ", new String[]{"1.5707963267948966"});
+    testSimpleEval("select atan2(0.8, 1.1) as col1 ", new String[]{"0.6287962831935603"});
+    testSimpleEval("select atan2(2.7, 0.3) as col1 ", new String[]{"1.460139103198048"});
+//    testSimpleEval("select atan(-0.5, 0.3) as col1 ", new String[]{"-1.0303768265243125"});
+//    testSimpleEval("select atan(-0.2, -1.3) as col1 ", new String[]{"-2.988943325194528"});
+
+    Schema schema = new Schema();
+    schema.addColumn("col1", FLOAT8);
+    schema.addColumn("col2", FLOAT8);
+    schema.addColumn("col3", FLOAT8);
+
+    testEval(schema, "table1", "1.0, 0.2, 0.1", "select atan2(col1 + col2, col3) from table1",
+        new String[]{"1.4876550949064553"});
+  }
+
 
 }