asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yingyi Bu (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: Add type check functions and their docs, including:
Date Sat, 08 Oct 2016 03:19:50 GMT
Yingyi Bu has submitted this change and it was merged.

Change subject: Add type check functions and their docs, including:
......................................................................


Add type check functions and their docs, including:

-isboolean (isbool)
-isnumber (isnum)
-isstring (istr)
-isarray
-isobject (isobj)

Change-Id: Id12067dbd89f74a6c1248eb7ac6504400a67cbf6
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1257
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java
D asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.3.adm
D asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.4.adm
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isarray/isarray.1.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isboolean/isboolean.1.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isnumber/isnumber.1.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isobject/isobject.1.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isstring/isstring.1.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/results/types/isarray/isarray.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/types/isboolean/isboolean.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/types/isnumber/isnumber.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/types/isobject/isobject.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/types/isstring/isstring.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-doc/pom.xml
M asterixdb/asterix-doc/src/main/markdown/builtins/0_toc.md
A asterixdb/asterix-doc/src/main/markdown/builtins/11_type.md
R asterixdb/asterix-doc/src/main/markdown/builtins/12_misc.md
M asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/CommonFunctionMapUtil.java
M asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsArrayDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsBooleanDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsNumberDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsObjectDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsStringDescriptor.java
25 files changed, 835 insertions(+), 138 deletions(-)

Approvals:
  Till Westmann: Looks good to me, approved
  Jenkins: Verified; Verified

Objections:
  Jenkins: Violations found



diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java
index 2482121..dd45c86 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java
@@ -157,8 +157,13 @@
 import org.apache.asterix.runtime.evaluators.functions.HashedGramTokensDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.HashedWordTokensDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.InjectFailureDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.IsArrayDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.IsBooleanDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.IsMissingDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.IsNullDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.IsNumberDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.IsObjectDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.IsStringDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.IsSystemNullDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.IsUnknownDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.LenDescriptor;
@@ -666,6 +671,13 @@
         functionsToInjectUnkownHandling.add(GetOverlappingIntervalDescriptor.FACTORY);
         functionsToInjectUnkownHandling.add(DurationFromIntervalDescriptor.FACTORY);
 
+        // Type functions.
+        functionsToInjectUnkownHandling.add(IsBooleanDescriptor.FACTORY);
+        functionsToInjectUnkownHandling.add(IsNumberDescriptor.FACTORY);
+        functionsToInjectUnkownHandling.add(IsStringDescriptor.FACTORY);
+        functionsToInjectUnkownHandling.add(IsArrayDescriptor.FACTORY);
+        functionsToInjectUnkownHandling.add(IsObjectDescriptor.FACTORY);
+
         // Cast function
         functionsToInjectUnkownHandling.add(CastTypeDescriptor.FACTORY);
 
diff --git a/asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.3.adm b/asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.3.adm
deleted file mode 100644
index 4ecd143..0000000
--- a/asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.3.adm
+++ /dev/null
@@ -1,35 +0,0 @@
-{ "staff": "Alex", "student": "Charles" }
-{ "staff": "Alex", "student": "Frank" }
-{ "staff": "Alex", "student": "Karen" }
-{ "staff": "Alex", "student": "Mary" }
-{ "staff": "Alex", "student": "Steve" }
-{ "staff": "Elisabeth", "student": "Charles" }
-{ "staff": "Elisabeth", "student": "Frank" }
-{ "staff": "Elisabeth", "student": "Karen" }
-{ "staff": "Elisabeth", "student": "Mary" }
-{ "staff": "Elisabeth", "student": "Olga" }
-{ "staff": "Elisabeth", "student": "Steve" }
-{ "staff": "Elisabeth", "student": "Tess" }
-{ "staff": "Franklin", "student": "Karen" }
-{ "staff": "Franklin", "student": "Mary" }
-{ "staff": "Franklin", "student": "Steve" }
-{ "staff": "Franklin", "student": "Tess" }
-{ "staff": "Henry", "student": "Charles" }
-{ "staff": "Henry", "student": "Frank" }
-{ "staff": "Henry", "student": "Karen" }
-{ "staff": "Henry", "student": "Mary" }
-{ "staff": "Henry", "student": "Steve" }
-{ "staff": "Maryann", "student": "Karen" }
-{ "staff": "Maryann", "student": "Steve" }
-{ "staff": "Maryann", "student": "Tess" }
-{ "staff": "Vicky", "student": "Charles" }
-{ "staff": "Vicky", "student": "Frank" }
-{ "staff": "Vicky", "student": "Karen" }
-{ "staff": "Vicky", "student": "Mary" }
-{ "staff": "Vicky", "student": "Olga" }
-{ "staff": "Vicky", "student": "Steve" }
-{ "staff": "Vicky", "student": "Tess" }
-{ "staff": "Zack", "student": "Charles" }
-{ "staff": "Zack", "student": "Frank" }
-{ "staff": "Zack", "student": "Mary" }
-{ "staff": "Zack", "student": "Olga" }
diff --git a/asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.4.adm b/asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.4.adm
deleted file mode 100644
index 4ecd143..0000000
--- a/asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.4.adm
+++ /dev/null
@@ -1,35 +0,0 @@
-{ "staff": "Alex", "student": "Charles" }
-{ "staff": "Alex", "student": "Frank" }
-{ "staff": "Alex", "student": "Karen" }
-{ "staff": "Alex", "student": "Mary" }
-{ "staff": "Alex", "student": "Steve" }
-{ "staff": "Elisabeth", "student": "Charles" }
-{ "staff": "Elisabeth", "student": "Frank" }
-{ "staff": "Elisabeth", "student": "Karen" }
-{ "staff": "Elisabeth", "student": "Mary" }
-{ "staff": "Elisabeth", "student": "Olga" }
-{ "staff": "Elisabeth", "student": "Steve" }
-{ "staff": "Elisabeth", "student": "Tess" }
-{ "staff": "Franklin", "student": "Karen" }
-{ "staff": "Franklin", "student": "Mary" }
-{ "staff": "Franklin", "student": "Steve" }
-{ "staff": "Franklin", "student": "Tess" }
-{ "staff": "Henry", "student": "Charles" }
-{ "staff": "Henry", "student": "Frank" }
-{ "staff": "Henry", "student": "Karen" }
-{ "staff": "Henry", "student": "Mary" }
-{ "staff": "Henry", "student": "Steve" }
-{ "staff": "Maryann", "student": "Karen" }
-{ "staff": "Maryann", "student": "Steve" }
-{ "staff": "Maryann", "student": "Tess" }
-{ "staff": "Vicky", "student": "Charles" }
-{ "staff": "Vicky", "student": "Frank" }
-{ "staff": "Vicky", "student": "Karen" }
-{ "staff": "Vicky", "student": "Mary" }
-{ "staff": "Vicky", "student": "Olga" }
-{ "staff": "Vicky", "student": "Steve" }
-{ "staff": "Vicky", "student": "Tess" }
-{ "staff": "Zack", "student": "Charles" }
-{ "staff": "Zack", "student": "Frank" }
-{ "staff": "Zack", "student": "Mary" }
-{ "staff": "Zack", "student": "Olga" }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isarray/isarray.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isarray/isarray.1.query.sqlpp
new file mode 100644
index 0000000..ab87cb1
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isarray/isarray.1.query.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+{
+  "a": isarray(true),
+  "b": isarray(false),
+  "c": isarray(null),
+  "d": isarray(missing),
+  "e": is_array("d"),
+  "f": is_array(4.0),
+  "g": isarray(5),
+  "h": isarray(["1", 2]),
+  "i": isarray({"a":1})
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isboolean/isboolean.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isboolean/isboolean.1.query.sqlpp
new file mode 100644
index 0000000..de3c64e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isboolean/isboolean.1.query.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+{
+  "a": isboolean(true),
+  "b": isboolean(false),
+  "c": is_boolean(null),
+  "d": is_boolean(missing),
+  "e": isbool("d"),
+  "f": isbool(4.0),
+  "g": isbool(5),
+  "h": isbool(["1", 2]),
+  "i": isbool({"a":1})
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isnumber/isnumber.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isnumber/isnumber.1.query.sqlpp
new file mode 100644
index 0000000..1e153d3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isnumber/isnumber.1.query.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+{
+  "a": isnumber(true),
+  "b": isnumber(false),
+  "c": isnumber(null),
+  "d": is_number(missing),
+  "e": is_number("d"),
+  "f": isnumber(4.0),
+  "g": isnum(5),
+  "h": isnum(["1", 2]),
+  "i": isnum({"a":1})
+};
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isobject/isobject.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isobject/isobject.1.query.sqlpp
new file mode 100644
index 0000000..8305977
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isobject/isobject.1.query.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+{
+  "a": isobject(true),
+  "b": isobject(false),
+  "c": is_object(null),
+  "d": is_object(missing),
+  "e": isobj("d"),
+  "f": isobj(4.0),
+  "g": isobj(5),
+  "h": isobj(["1", 2]),
+  "i": isobj({"a":1})
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isstring/isstring.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isstring/isstring.1.query.sqlpp
new file mode 100644
index 0000000..a5caf3c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/isstring/isstring.1.query.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+{
+  "a": is_string(true),
+  "b": isstring(false),
+  "c": isstring(null),
+  "d": isstr(missing),
+  "e": isstr("d"),
+  "f": isstr(4.0),
+  "g": isstr(5),
+  "h": isstr(["1", 2]),
+  "i": isstr({"a":1})
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isarray/isarray.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isarray/isarray.1.adm
new file mode 100644
index 0000000..b97271c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isarray/isarray.1.adm
@@ -0,0 +1 @@
+{ "a": false, "b": false, "c": null, "e": false, "f": false, "g": false, "h": true, "i": false }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isboolean/isboolean.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isboolean/isboolean.1.adm
new file mode 100644
index 0000000..66ed941
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isboolean/isboolean.1.adm
@@ -0,0 +1 @@
+{ "a": true, "b": true, "c": null, "e": false, "f": false, "g": false, "h": false, "i": false }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isnumber/isnumber.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isnumber/isnumber.1.adm
new file mode 100644
index 0000000..fc8b4a8
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isnumber/isnumber.1.adm
@@ -0,0 +1 @@
+{ "a": false, "b": false, "c": null, "e": false, "f": true, "g": true, "h": false, "i": false }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isobject/isobject.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isobject/isobject.1.adm
new file mode 100644
index 0000000..00007d7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isobject/isobject.1.adm
@@ -0,0 +1 @@
+{ "a": false, "b": false, "c": null, "e": false, "f": false, "g": false, "h": false, "i": true }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isstring/isstring.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isstring/isstring.1.adm
new file mode 100644
index 0000000..6a8318f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/types/isstring/isstring.1.adm
@@ -0,0 +1 @@
+{ "a": false, "b": false, "c": null, "e": true, "f": false, "g": false, "h": false, "i": false }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 38ef4c2..48fa1cd 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -7921,6 +7921,31 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="types">
+      <compilation-unit name="isarray">
+        <output-dir compare="Text">isarray</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="types">
+      <compilation-unit name="isboolean">
+        <output-dir compare="Text">isboolean</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="types">
+      <compilation-unit name="isnumber">
+        <output-dir compare="Text">isnumber</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="types">
+      <compilation-unit name="isobject">
+        <output-dir compare="Text">isobject</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="types">
+      <compilation-unit name="isstring">
+        <output-dir compare="Text">isstring</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="types">
       <compilation-unit name="record01">
         <output-dir compare="Text">record01</output-dir>
       </compilation-unit>
diff --git a/asterixdb/asterix-doc/pom.xml b/asterixdb/asterix-doc/pom.xml
index f674f7f..a41bce2 100644
--- a/asterixdb/asterix-doc/pom.xml
+++ b/asterixdb/asterix-doc/pom.xml
@@ -58,11 +58,11 @@
                 </concat>
                 <concat destfile="${project.build.directory}/generated-site/markdown/sqlpp/builtins.md">
                   <filelist dir="${project.basedir}/src/main/markdown/builtins"
-                            files="0_toc.md,1_numeric.md,2_string.md,3_binary.md,4_spatial.md,5_similarity.md,6_tokenizing.md,7_temporal.md,7_allens.md,8_record.md,9_aggregate_sql.md,10_comparison.md,11_others.md"/>
+                            files="0_toc.md,1_numeric.md,2_string.md,3_binary.md,4_spatial.md,5_similarity.md,6_tokenizing.md,7_temporal.md,7_allens.md,8_record.md,9_aggregate_sql.md,10_comparison.md,11_type.md,12_misc.md"/>
                 </concat>
                 <concat destfile="${project.build.directory}/generated-site/markdown/aql/builtins.md">
                   <filelist dir="${project.basedir}/src/main/markdown/builtins"
-                            files="0_toc.md,1_numeric.md,2_string.md,3_binary.md,4_spatial.md,5_similarity.md,6_tokenizing.md,7_temporal.md,7_allens.md,8_record.md,9_aggregate_aql.md,10_comparison.md,11_others.md"/>
+                            files="0_toc.md,1_numeric.md,2_string.md,3_binary.md,4_spatial.md,5_similarity.md,6_tokenizing.md,7_temporal.md,7_allens.md,8_record.md,9_aggregate_aql.md,10_comparison.md,11_type.md,12_misc.md"/>
                 </concat>
               </target>
             </configuration>
diff --git a/asterixdb/asterix-doc/src/main/markdown/builtins/0_toc.md b/asterixdb/asterix-doc/src/main/markdown/builtins/0_toc.md
index 2c8dedf..2cab02c 100644
--- a/asterixdb/asterix-doc/src/main/markdown/builtins/0_toc.md
+++ b/asterixdb/asterix-doc/src/main/markdown/builtins/0_toc.md
@@ -31,7 +31,8 @@
 * [Record Functions](#RecordFunctions)
 * [Aggregate Functions (Array Functions)](#AggregateFunctions)
 * [Comparison Functions](#ComparisonFunctions)
-* [Other Functions](#OtherFunctions)
+* [Type Functions](#TypeFunctions)
+* [Miscellaneous Functions](#MiscFunctions)
 
 The system provides various classes of functions to support operations on numeric, string, spatial, and temporal data.
 This document explains how to use these functions.
diff --git a/asterixdb/asterix-doc/src/main/markdown/builtins/11_type.md b/asterixdb/asterix-doc/src/main/markdown/builtins/11_type.md
new file mode 100644
index 0000000..7d355b2
--- /dev/null
+++ b/asterixdb/asterix-doc/src/main/markdown/builtins/11_type.md
@@ -0,0 +1,263 @@
+<!--
+ ! 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.
+ !-->
+
+## <a id="TypeFunctions">Type Functions</a> <font size="4"><a href="#toc">[Back to TOC]</a></font> ##
+
+### is_array (isarray) ###
+ * Syntax:
+
+        is_array(expr)
+
+ * Checks whether the given expression is evaluated to be an `array` value.
+ * Arguments:
+    * `expr` : an expression (any type is allowed).
+ * Return Value:
+    * a `boolean` on whether the argument is an `array` value or not,
+    * a `missing` if the argument is a `missing` value,
+    * a `null` if the argument is a `null` value.
+
+ * Example:
+
+        {
+          "a": is_array(true),
+          "b": is_array(false),
+          "c": isarray(null),
+          "d": isarray(missing),
+          "e": isarray("d"),
+          "f": isarray(4.0),
+          "g": isarray(5),
+          "h": isarray(["1", 2]),
+          "i": isarray({"a":1})
+        };
+
+
+ * The expected result is:
+
+        { "a": false, "b": false, "c": null, "e": false, "f": false, "g": false, "h": true, "i": false }
+
+ The function has an alias `isarray`.
+
+
+### is_boolean (isboolean, isbool) ###
+ * Syntax:
+
+        is_boolean(expr)
+
+ * Checks whether the given expression is evaluated to be a `boolean` value.
+ * Arguments:
+    * `expr` : an expression (any type is allowed).
+ * Return Value:
+    * a `boolean` on whether the argument is a `boolean` value or not,
+    * a `missing` if the argument is a `missing` value,
+    * a `null` if the argument is a `null` value.
+
+ * Example:
+
+        {
+          "a": isboolean(true),
+          "b": isboolean(false),
+          "c": is_boolean(null),
+          "d": is_boolean(missing),
+          "e": isbool("d"),
+          "f": isbool(4.0),
+          "g": isbool(5),
+          "h": isbool(["1", 2]),
+          "i": isbool({"a":1})
+        };
+
+
+ * The expected result is:
+
+        { "a": true, "b": true, "c": null, "e": false, "f": false, "g": false, "h": false, "i": false }
+
+ The function has two aliases, `isboolean` or `isbool`.
+
+
+### is_number (isnumber, isnum) ###
+ * Syntax:
+
+        is_number(expr)
+
+ * Checks whether the given expression is evaluated to be a numeric value.
+ * Arguments:
+    * `expr` : an expression (any type is allowed).
+ * Return Value:
+    * a `boolean` on whether the argument is a `smallint`/`tinyint`/`integer`/`bigint`/`float`/`double`
+      value or not,
+    * a `missing` if the argument is a `missing` value,
+    * a `null` if the argument is a `null` value.
+
+ * Example:
+
+        {
+          "a": is_number(true),
+          "b": is_number(false),
+          "c": isnumber(null),
+          "d": isnumber(missing),
+          "e": isnumber("d"),
+          "f": isnum(4.0),
+          "g": isnum(5),
+          "h": isnum(["1", 2]),
+          "i": isnum({"a":1})
+        };
+
+
+ * The expected result is:
+
+        { "a": false, "b": false, "c": null, "e": false, "f": true, "g": true, "h": false, "i": false }
+
+ The function has two aliases, `isnumber` or `isnum`.
+
+### is_object (isobject, isobj) ###
+ * Syntax:
+
+        is_object(expr)
+
+ * Checks whether the given expression is evaluated to be a `record` value.
+ * Arguments:
+    * `expr` : an expression (any type is allowed).
+ * Return Value:
+    * a `boolean` on whether the argument is a `record` value or not,
+    * a `missing` if the argument is a `missing` value,
+    * a `null` if the argument is a `null` value.
+
+ * Example:
+
+        {
+          "a": is_object(true),
+          "b": is_object(false),
+          "c": isobject(null),
+          "d": isobject(missing),
+          "e": isobj("d"),
+          "f": isobj(4.0),
+          "g": isobj(5),
+          "h": isobj(["1", 2]),
+          "i": isobj({"a":1})
+        };
+
+
+ * The expected result is:
+
+       { "a": false, "b": false, "c": null, "e": false, "f": false, "g": false, "h": false, "i": true }
+
+ The function has two aliases, `isobject` or `isobj`.
+
+
+### is_string (isstring, isstr) ###
+ * Syntax:
+
+        is_string(expr)
+
+ * Checks whether the given expression is evaluated to be a `string` value.
+ * Arguments:
+    * `expr` : an expression (any type is allowed).
+ * Return Value:
+    * a `boolean` on whether the argument is a `string` value or not,
+    * a `missing` if the argument is a `missing` value,
+    * a `null` if the argument is a `null` value.
+
+ * Example:
+
+        {
+          "a": is_string(true),
+          "b": isstring(false),
+          "c": isstring(null),
+          "d": isstr(missing),
+          "e": isstr("d"),
+          "f": isstr(4.0),
+          "g": isstr(5),
+          "h": isstr(["1", 2]),
+          "i": isstr({"a":1})
+        };
+
+
+ * The expected result is:
+
+        { "a": false, "b": false, "c": null, "e": true, "f": false, "g": false, "h": false, "i": false }
+
+ The function has two aliases, `isstring` or `isstr`.
+
+
+### is_null ###
+ * Syntax:
+
+        is_null(expr)
+
+ * Checks whether the given expression is evaluated to be a `null` value.
+ * Arguments:
+    * `expr` : an expression (any type is allowed).
+ * Return Value:
+    * a `boolean` on whether the variable is a `null` or not,
+    * a `missing` if the input is `missing`.
+
+ * Example:
+
+        { "v1": is_null(null), "v2": is_null(1), "v3": is_null(missing) };
+
+
+ * The expected result is:
+
+        { "v1": true, "v2": false }
+
+ The function has an alias `isnull`.
+
+### is_missing ###
+ * Syntax:
+
+        is_missing(expr)
+
+ * Checks whether the given expression is evaluated to be a `missing` value.
+ * Arguments:
+    * `expr` : an expression (any type is allowed).
+ * Return Value:
+    * a `boolean` on whether the variable is a `missing` or not.
+
+ * Example:
+
+        { "v1": is_missing(null), "v2": is_missing(1), "v3": is_missing(missing) };
+
+
+ * The expected result is:
+
+        { "v1": false, "v2": false, "v3": true }
+
+ The function has an alias `ismissing`.
+
+### is_unknown ###
+ * Syntax:
+
+        is_unknown(expr)
+
+ * Checks whether the given variable is a `null` value or a `missing` value.
+ * Arguments:
+    * `expr` : an expression (any type is allowed).
+ * Return Value:
+    * a `boolean` on whether the variable is a `null`/``missing` value (`true`) or not (`false`).
+
+ * Example:
+
+        { "v1": is_unknown(null), "v2": is_unknown(1), "v3": is_unknown(missing) };
+
+
+ * The expected result is:
+
+        { "v1": true, "v2": false, "v3": true }
+
+ The function has an alias `isunknown`.
+
diff --git a/asterixdb/asterix-doc/src/main/markdown/builtins/11_others.md b/asterixdb/asterix-doc/src/main/markdown/builtins/12_misc.md
similarity index 76%
rename from asterixdb/asterix-doc/src/main/markdown/builtins/11_others.md
rename to asterixdb/asterix-doc/src/main/markdown/builtins/12_misc.md
index a20b8b3..ee5ca31 100644
--- a/asterixdb/asterix-doc/src/main/markdown/builtins/11_others.md
+++ b/asterixdb/asterix-doc/src/main/markdown/builtins/12_misc.md
@@ -17,7 +17,7 @@
  ! under the License.
  !-->
 
-## <a id="OtherFunctions">Other Functions</a> <font size="4"><a href="#toc">[Back to TOC]</a></font> ##
+## <a id="MiscFunctions">Miscellaneous Functions</a> <font size="4"><a href="#toc">[Back to TOC]</a></font> ##
 
 ### uuid ###
  * Syntax:
@@ -29,70 +29,6 @@
     * none
 * Return Value:
     * a generated, random `uuid`.
-
-
-### is_null ###
- * Syntax:
-
-        is_null(expr)
-
- * Checks whether the given expression is evaluated to be a `null` value.
- * Arguments:
-    * `expr` : an expression (any type is allowed).
- * Return Value:
-    * a `boolean` on whether the variable is a `null` or not,
-    * a `missing` if the input is `missing`.
-
- * Example:
-
-        { "v1": is_null(null), "v2": is_null(1), "v3": is_null(missing) };
-
-
- * The expected result is:
-
-        { "v1": true, "v2": false }
-
-
-### is_missing ###
- * Syntax:
-
-        is_missing(expr)
-
- * Checks whether the given expression is evaluated to be a `missing` value.
- * Arguments:
-    * `expr` : an expression (any type is allowed).
- * Return Value:
-    * a `boolean` on whether the variable is a `missing` or not.
-
- * Example:
-
-        { "v1": is_missing(null), "v2": is_missing(1), "v3": is_missing(missing) };
-
-
- * The expected result is:
-
-        { "v1": false, "v2": false, "v3": true }
-
-
-### is_unknown ###
- * Syntax:
-
-        is_unknown(expr)
-
- * Checks whether the given variable is a `null` value or a `missing` value.
- * Arguments:
-    * `expr` : an expression (any type is allowed).
- * Return Value:
-    * a `boolean` on whether the variable is a `null`/``missing` value (`true`) or not (`false`).
-
- * Example:
-
-        { "v1": is_unknown(null), "v2": is_unknown(1), "v3": is_unknown(missing) };
-
-
- * The expected result is:
-
-        { "v1": true, "v2": false, "v3": true }
 
 
 ### len ###
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/CommonFunctionMapUtil.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/CommonFunctionMapUtil.java
index 1f7e4b0..6e7349e 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/CommonFunctionMapUtil.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/CommonFunctionMapUtil.java
@@ -48,6 +48,20 @@
         FUNCTION_NAME_MAP.put("smallint", "int16"); // smallint, internal: int16
         FUNCTION_NAME_MAP.put("integer", "int32"); // integer, internal: int32
         FUNCTION_NAME_MAP.put("bigint", "int64"); // bigint, internal: int64
+
+        // Type functions.
+        FUNCTION_NAME_MAP.put("isnull", "is-null"); // isnull, internal: is-null
+        FUNCTION_NAME_MAP.put("ismissing", "is-missing"); // ismissing, internal: is-missing
+        FUNCTION_NAME_MAP.put("isunknown", "is-unknown"); // isunknown, internal: is-unknown
+        FUNCTION_NAME_MAP.put("isboolean", "is-boolean"); // isboolean, internal: is-boolean
+        FUNCTION_NAME_MAP.put("isbool", "is-boolean"); // isbool, internal: is-boolean
+        FUNCTION_NAME_MAP.put("isnumber", "is-number"); // isnumber, internal: is-number
+        FUNCTION_NAME_MAP.put("isnum", "is-number"); // isnum, internal: is-number
+        FUNCTION_NAME_MAP.put("isstring", "is-string"); // isstring, internal: is-string
+        FUNCTION_NAME_MAP.put("isstr", "is-string"); // isstr, internal: is-string
+        FUNCTION_NAME_MAP.put("isarray", "is-array"); // isarray, internal: is-array
+        FUNCTION_NAME_MAP.put("isobject", "is-object"); // isobject, internal: is-object
+        FUNCTION_NAME_MAP.put("isobj", "is-object"); // isobj, internal: is-object
     }
 
     private CommonFunctionMapUtil() {
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java
index a85d33b..80f13d6 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java
@@ -761,6 +761,16 @@
     public static final FunctionIdentifier IS_NULL = AlgebricksBuiltinFunctions.IS_NULL;
     public static final FunctionIdentifier IS_UNKOWN = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "is-unknown", 1);
+    public static final FunctionIdentifier IS_BOOLEAN = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "is-boolean", 1);
+    public static final FunctionIdentifier IS_NUMBER = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "is-number",
+            1);
+    public static final FunctionIdentifier IS_STRING = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "is-string",
+            1);
+    public static final FunctionIdentifier IS_ARRAY = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "is-array",
+            1);
+    public static final FunctionIdentifier IS_OBJECT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "is-object",
+            1);
 
     public static final FunctionIdentifier IS_SYSTEM_NULL = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "is-system-null", 1);
@@ -794,6 +804,11 @@
         addFunction(IS_NULL, BooleanOnlyTypeComputer.INSTANCE, true);
         addFunction(IS_UNKOWN, BooleanOnlyTypeComputer.INSTANCE, true);
         addFunction(IS_SYSTEM_NULL, BooleanOnlyTypeComputer.INSTANCE, true);
+        addFunction(IS_BOOLEAN, BooleanOnlyTypeComputer.INSTANCE, true);
+        addFunction(IS_NUMBER, BooleanOnlyTypeComputer.INSTANCE, true);
+        addFunction(IS_STRING, BooleanOnlyTypeComputer.INSTANCE, true);
+        addFunction(IS_ARRAY, BooleanOnlyTypeComputer.INSTANCE, true);
+        addFunction(IS_OBJECT, BooleanOnlyTypeComputer.INSTANCE, true);
         addFunction(NOT, BooleanFunctionTypeComputer.INSTANCE, true);
 
         addPrivateFunction(EQ, BooleanFunctionTypeComputer.INSTANCE, true);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsArrayDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsArrayDescriptor.java
new file mode 100644
index 0000000..c8cb313
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsArrayDescriptor.java
@@ -0,0 +1,68 @@
+/*
+ * 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.asterix.runtime.evaluators.functions;
+
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptor;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.common.AbstractTypeCheckEvaluator;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+
+public class IsArrayDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new IsArrayDescriptor();
+        }
+    };
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
+                return new AbstractTypeCheckEvaluator(eval) {
+
+                    @Override
+                    protected Value isMatch(byte typeTag) {
+                        return typeTag == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG ? Value.TRUE : Value.FALSE;
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.IS_ARRAY;
+    }
+
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsBooleanDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsBooleanDescriptor.java
new file mode 100644
index 0000000..89318bd
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsBooleanDescriptor.java
@@ -0,0 +1,68 @@
+/*
+ * 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.asterix.runtime.evaluators.functions;
+
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptor;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.common.AbstractTypeCheckEvaluator;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+
+public class IsBooleanDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new IsBooleanDescriptor();
+        }
+    };
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
+                return new AbstractTypeCheckEvaluator(eval) {
+
+                    @Override
+                    protected Value isMatch(byte typeTag) {
+                        return typeTag == ATypeTag.SERIALIZED_BOOLEAN_TYPE_TAG ? Value.TRUE : Value.FALSE;
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.IS_BOOLEAN;
+    }
+
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsNumberDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsNumberDescriptor.java
new file mode 100644
index 0000000..418d778
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsNumberDescriptor.java
@@ -0,0 +1,73 @@
+/*
+ * 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.asterix.runtime.evaluators.functions;
+
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptor;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.common.AbstractTypeCheckEvaluator;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+
+public class IsNumberDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new IsNumberDescriptor();
+        }
+    };
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
+                return new AbstractTypeCheckEvaluator(eval) {
+
+                    @Override
+                    protected Value isMatch(byte typeTag) {
+                        return typeTag == ATypeTag.SERIALIZED_INT8_TYPE_TAG
+                                || typeTag == ATypeTag.SERIALIZED_INT16_TYPE_TAG
+                                || typeTag == ATypeTag.SERIALIZED_INT32_TYPE_TAG
+                                || typeTag == ATypeTag.SERIALIZED_INT64_TYPE_TAG
+                                || typeTag == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG
+                                || typeTag == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG ? Value.TRUE : Value.FALSE;
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.IS_NUMBER;
+    }
+
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsObjectDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsObjectDescriptor.java
new file mode 100644
index 0000000..5a3f2d3
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsObjectDescriptor.java
@@ -0,0 +1,68 @@
+/*
+ * 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.asterix.runtime.evaluators.functions;
+
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptor;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.common.AbstractTypeCheckEvaluator;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+
+public class IsObjectDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new IsObjectDescriptor();
+        }
+    };
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
+                return new AbstractTypeCheckEvaluator(eval) {
+
+                    @Override
+                    protected Value isMatch(byte typeTag) {
+                        return typeTag == ATypeTag.SERIALIZED_RECORD_TYPE_TAG ? Value.TRUE : Value.FALSE;
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.IS_OBJECT;
+    }
+
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsStringDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsStringDescriptor.java
new file mode 100644
index 0000000..44c5a6c
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsStringDescriptor.java
@@ -0,0 +1,68 @@
+/*
+ * 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.asterix.runtime.evaluators.functions;
+
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptor;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.common.AbstractTypeCheckEvaluator;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+
+public class IsStringDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new IsStringDescriptor();
+        }
+    };
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
+                return new AbstractTypeCheckEvaluator(eval) {
+
+                    @Override
+                    protected Value isMatch(byte typeTag) {
+                        return typeTag == ATypeTag.SERIALIZED_STRING_TYPE_TAG ? Value.TRUE : Value.FALSE;
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.IS_STRING;
+    }
+
+}

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1257
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id12067dbd89f74a6c1248eb7ac6504400a67cbf6
Gerrit-PatchSet: 5
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <buyingyi@gmail.com>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <tillw@apache.org>
Gerrit-Reviewer: Yingyi Bu <buyingyi@gmail.com>

Mime
View raw message