You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu> on 2026/03/19 23:52:31 UTC

[L] Change in asterixdb[master]: [ASTERIXDB-3730] Handle missing/null inputs in geo evaluators

From Suryaa Charan Shivakumar <ss...@ucr.edu>:

Suryaa Charan Shivakumar has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21030?usp=email )


Change subject: [ASTERIXDB-3730] Handle missing/null inputs in geo evaluators
......................................................................

[ASTERIXDB-3730] Handle missing/null inputs in geo evaluators

Add missing/null guards to spatial evaluator functions using
PointableHelper.checkAndSetMissingOrNull() so correlated subqueries and
left-outer-join plans do not fail when an input is missing or null.
Fixed resultStorage.reset related bugs and stale test case results.
Fixed indices for TypeMismatchException, the new code returns the right index.
Add tests for the reported correlated subquery case and for
missing/null propagation in geo evaluators.

Some parts of this commit were Generated-by: Claude code
Change-Id: Ia6e37080a581292744ddc9020b216928414c18ac
---
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/GeoJSONQueries.xml
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.01.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.02.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.03.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.04.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.05.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.06.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.01.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.02.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.03.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.04.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.05.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.06.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/two-geometries/result.03.adm
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTDoubleGeometryDescriptor.java
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTGeometryNDescriptor.java
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTSingleGeometryDescriptor.java
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/ParseGeoJSONDescriptor.java
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STBufferDescriptor.java
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STDWithinDescriptor.java
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextDescriptor.java
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextSRIDDescriptor.java
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromWKBDescriptor.java
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakeEnvelopeDescriptorSRID.java
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePoint3DDescriptor.java
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePoint3DWithMDescriptor.java
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePointDescriptor.java
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STPolygonizeDescriptor.java
M asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STRelateDescriptor.java
29 files changed, 450 insertions(+), 6 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/30/21030/1

diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/GeoJSONQueries.xml b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/GeoJSONQueries.xml
index 310fade..8a1dfca 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/GeoJSONQueries.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/GeoJSONQueries.xml
@@ -37,4 +37,9 @@
             <output-dir compare="Text">two-geometries</output-dir>
         </compilation-unit>
     </test-case>
+    <test-case FilePath="geojson">
+        <compilation-unit name="null-missing">
+            <output-dir compare="Text">null-missing</output-dir>
+        </compilation-unit>
+    </test-case>
 </test-group>
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.01.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.01.query.sqlpp
new file mode 100644
index 0000000..9118c5b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.01.query.sqlpp
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+/* All single-argument geo functions with NULL input — each must return NULL */
+{
+  "st_area":               st_area(null),
+  "st_as_binary":          st_as_binary(null),
+  "st_as_geojson":         st_as_geojson(null),
+  "st_as_text":            st_as_text(null),
+  "st_boundary":           st_boundary(null),
+  "st_centroid":           st_centroid(null),
+  "st_convex_hull":        st_convex_hull(null),
+  "st_coord_dim":          st_coord_dim(null),
+  "st_dimension":          st_dimension(null),
+  "st_end_point":          st_end_point(null),
+  "st_envelope":           st_envelope(null),
+  "st_exterior_ring":      st_exterior_ring(null),
+  "st_flip_coordinates":   st_flip_coordinates(null),
+  "geometry_type":         geometry_type(null),
+  "st_is_closed":          st_is_closed(null),
+  "st_is_collection":      st_is_collection(null),
+  "st_is_empty":           st_is_empty(null),
+  "st_is_ring":            st_is_ring(null),
+  "st_is_simple":          st_is_simple(null),
+  "st_is_valid":           st_is_valid(null),
+  "st_length":             st_length(null),
+  "st_line_from_multipoint": st_line_from_multipoint(null),
+  "st_m":                  st_m(null),
+  "st_n_points":           st_n_points(null),
+  "st_n_rings":            st_n_rings(null),
+  "st_num_geometries":     st_num_geometries(null),
+  "st_num_interior_rings": st_num_interior_rings(null),
+  "st_reverse":            st_reverse(null),
+  "st_srid":               st_srid(null),
+  "st_start_point":        st_start_point(null),
+  "st_x":                  st_x(null),
+  "st_x_max":              st_x_max(null),
+  "st_x_min":              st_x_min(null),
+  "st_y":                  st_y(null),
+  "st_y_max":              st_y_max(null),
+  "st_y_min":              st_y_min(null),
+  "st_z":                  st_z(null),
+  "st_z_max":              st_z_max(null),
+  "st_z_min":              st_z_min(null),
+  "st_geom_from_text":     st_geom_from_text(null),
+  "st_geom_from_wkb":      st_geom_from_wkb(null),
+  "st_polygonize":         st_polygonize(null)
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.02.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.02.query.sqlpp
new file mode 100644
index 0000000..3dcfba4
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.02.query.sqlpp
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+/* All single-argument geo functions with MISSING input — each must propagate MISSING.
+   is_missing() wraps the call so the boolean result appears in the record output. */
+{
+  "st_area":               is_missing(st_area(missing)),
+  "st_as_binary":          is_missing(st_as_binary(missing)),
+  "st_as_geojson":         is_missing(st_as_geojson(missing)),
+  "st_as_text":            is_missing(st_as_text(missing)),
+  "st_boundary":           is_missing(st_boundary(missing)),
+  "st_centroid":           is_missing(st_centroid(missing)),
+  "st_convex_hull":        is_missing(st_convex_hull(missing)),
+  "st_coord_dim":          is_missing(st_coord_dim(missing)),
+  "st_dimension":          is_missing(st_dimension(missing)),
+  "st_end_point":          is_missing(st_end_point(missing)),
+  "st_envelope":           is_missing(st_envelope(missing)),
+  "st_exterior_ring":      is_missing(st_exterior_ring(missing)),
+  "st_flip_coordinates":   is_missing(st_flip_coordinates(missing)),
+  "geometry_type":         is_missing(geometry_type(missing)),
+  "st_is_closed":          is_missing(st_is_closed(missing)),
+  "st_is_collection":      is_missing(st_is_collection(missing)),
+  "st_is_empty":           is_missing(st_is_empty(missing)),
+  "st_is_ring":            is_missing(st_is_ring(missing)),
+  "st_is_simple":          is_missing(st_is_simple(missing)),
+  "st_is_valid":           is_missing(st_is_valid(missing)),
+  "st_length":             is_missing(st_length(missing)),
+  "st_line_from_multipoint": is_missing(st_line_from_multipoint(missing)),
+  "st_m":                  is_missing(st_m(missing)),
+  "st_n_points":           is_missing(st_n_points(missing)),
+  "st_n_rings":            is_missing(st_n_rings(missing)),
+  "st_num_geometries":     is_missing(st_num_geometries(missing)),
+  "st_num_interior_rings": is_missing(st_num_interior_rings(missing)),
+  "st_reverse":            is_missing(st_reverse(missing)),
+  "st_srid":               is_missing(st_srid(missing)),
+  "st_start_point":        is_missing(st_start_point(missing)),
+  "st_x":                  is_missing(st_x(missing)),
+  "st_x_max":              is_missing(st_x_max(missing)),
+  "st_x_min":              is_missing(st_x_min(missing)),
+  "st_y":                  is_missing(st_y(missing)),
+  "st_y_max":              is_missing(st_y_max(missing)),
+  "st_y_min":              is_missing(st_y_min(missing)),
+  "st_z":                  is_missing(st_z(missing)),
+  "st_z_max":              is_missing(st_z_max(missing)),
+  "st_z_min":              is_missing(st_z_min(missing)),
+  "st_geom_from_text":     is_missing(st_geom_from_text(missing)),
+  "st_geom_from_wkb":      is_missing(st_geom_from_wkb(missing)),
+  "st_polygonize":         is_missing(st_polygonize(missing))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.03.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.03.query.sqlpp
new file mode 100644
index 0000000..1361e56
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.03.query.sqlpp
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+/* Two-argument and geometry-N functions with NULL in each argument position.
+   Suffix _0 = NULL in arg0, _1 = NULL in arg1. All must return NULL. */
+{
+  /* AbstractSTDoubleGeometryDescriptor subclasses */
+  "st_contains_0":         st_contains(null, st_geom_from_text("POINT(0 0)")),
+  "st_contains_1":         st_contains(st_geom_from_text("POINT(0 0)"), null),
+  "st_crosses_0":          st_crosses(null, st_geom_from_text("LINESTRING(0 0, 1 1)")),
+  "st_crosses_1":          st_crosses(st_geom_from_text("LINESTRING(0 0, 1 1)"), null),
+  "st_difference_0":       st_difference(null, st_geom_from_text("POINT(0 0)")),
+  "st_difference_1":       st_difference(st_geom_from_text("POINT(0 0)"), null),
+  "st_disjoint_0":         st_disjoint(null, st_geom_from_text("POINT(0 0)")),
+  "st_disjoint_1":         st_disjoint(st_geom_from_text("POINT(0 0)"), null),
+  "st_distance_0":         st_distance(null, st_geom_from_text("POINT(0 0)")),
+  "st_distance_1":         st_distance(st_geom_from_text("POINT(0 0)"), null),
+  "st_distance_sphere_0":  st_distance_sphere(null, st_geom_from_text("POINT(0 0)")),
+  "st_distance_sphere_1":  st_distance_sphere(st_geom_from_text("POINT(0 0)"), null),
+  "st_equals_0":           st_equals(null, st_geom_from_text("POINT(0 0)")),
+  "st_equals_1":           st_equals(st_geom_from_text("POINT(0 0)"), null),
+  "st_intersection_0":     st_intersection(null, st_geom_from_text("POINT(0 0)")),
+  "st_intersection_1":     st_intersection(st_geom_from_text("POINT(0 0)"), null),
+  "st_intersects_0":       st_intersects(null, st_geom_from_text("POINT(0 0)")),
+  "st_intersects_1":       st_intersects(st_geom_from_text("POINT(0 0)"), null),
+  "st_overlaps_0":         st_overlaps(null, st_geom_from_text("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))")),
+  "st_overlaps_1":         st_overlaps(st_geom_from_text("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))"), null),
+  "st_sym_difference_0":   st_sym_difference(null, st_geom_from_text("POINT(0 0)")),
+  "st_sym_difference_1":   st_sym_difference(st_geom_from_text("POINT(0 0)"), null),
+  "st_touches_0":          st_touches(null, st_geom_from_text("POINT(0 0)")),
+  "st_touches_1":          st_touches(st_geom_from_text("POINT(0 0)"), null),
+  "st_union_0":            st_union(null, st_geom_from_text("POINT(0 0)")),
+  "st_union_1":            st_union(st_geom_from_text("POINT(0 0)"), null),
+  "st_within_0":           st_within(null, st_geom_from_text("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))")),
+  "st_within_1":           st_within(st_geom_from_text("POINT(0 0)"), null),
+  /* AbstractSTGeometryNDescriptor subclasses (geom, int64) */
+  "st_geometry_n_0":       st_geometry_n(null, 1),
+  "st_geometry_n_1":       st_geometry_n(st_geom_from_text("GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0, 1 1))"), null),
+  "st_point_n_0":          st_point_n(null, 1),
+  "st_point_n_1":          st_point_n(st_geom_from_text("LINESTRING(0 0, 1 1)"), null),
+  "st_interior_ring_n_0":  st_interior_ring_n(null, 1),
+  "st_interior_ring_n_1":  st_interior_ring_n(st_geom_from_text("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))"), null)
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.04.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.04.query.sqlpp
new file mode 100644
index 0000000..6e284cc
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.04.query.sqlpp
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+/* Two-argument and geometry-N functions with MISSING in each argument position.
+   Suffix _0 = MISSING in arg0, _1 = MISSING in arg1. All must propagate MISSING. */
+{
+  /* AbstractSTDoubleGeometryDescriptor subclasses */
+  "st_contains_0":         is_missing(st_contains(missing, st_geom_from_text("POINT(0 0)"))),
+  "st_contains_1":         is_missing(st_contains(st_geom_from_text("POINT(0 0)"), missing)),
+  "st_crosses_0":          is_missing(st_crosses(missing, st_geom_from_text("LINESTRING(0 0, 1 1)"))),
+  "st_crosses_1":          is_missing(st_crosses(st_geom_from_text("LINESTRING(0 0, 1 1)"), missing)),
+  "st_difference_0":       is_missing(st_difference(missing, st_geom_from_text("POINT(0 0)"))),
+  "st_difference_1":       is_missing(st_difference(st_geom_from_text("POINT(0 0)"), missing)),
+  "st_disjoint_0":         is_missing(st_disjoint(missing, st_geom_from_text("POINT(0 0)"))),
+  "st_disjoint_1":         is_missing(st_disjoint(st_geom_from_text("POINT(0 0)"), missing)),
+  "st_distance_0":         is_missing(st_distance(missing, st_geom_from_text("POINT(0 0)"))),
+  "st_distance_1":         is_missing(st_distance(st_geom_from_text("POINT(0 0)"), missing)),
+  "st_distance_sphere_0":  is_missing(st_distance_sphere(missing, st_geom_from_text("POINT(0 0)"))),
+  "st_distance_sphere_1":  is_missing(st_distance_sphere(st_geom_from_text("POINT(0 0)"), missing)),
+  "st_equals_0":           is_missing(st_equals(missing, st_geom_from_text("POINT(0 0)"))),
+  "st_equals_1":           is_missing(st_equals(st_geom_from_text("POINT(0 0)"), missing)),
+  "st_intersection_0":     is_missing(st_intersection(missing, st_geom_from_text("POINT(0 0)"))),
+  "st_intersection_1":     is_missing(st_intersection(st_geom_from_text("POINT(0 0)"), missing)),
+  "st_intersects_0":       is_missing(st_intersects(missing, st_geom_from_text("POINT(0 0)"))),
+  "st_intersects_1":       is_missing(st_intersects(st_geom_from_text("POINT(0 0)"), missing)),
+  "st_overlaps_0":         is_missing(st_overlaps(missing, st_geom_from_text("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))"))),
+  "st_overlaps_1":         is_missing(st_overlaps(st_geom_from_text("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))"), missing)),
+  "st_sym_difference_0":   is_missing(st_sym_difference(missing, st_geom_from_text("POINT(0 0)"))),
+  "st_sym_difference_1":   is_missing(st_sym_difference(st_geom_from_text("POINT(0 0)"), missing)),
+  "st_touches_0":          is_missing(st_touches(missing, st_geom_from_text("POINT(0 0)"))),
+  "st_touches_1":          is_missing(st_touches(st_geom_from_text("POINT(0 0)"), missing)),
+  "st_union_0":            is_missing(st_union(missing, st_geom_from_text("POINT(0 0)"))),
+  "st_union_1":            is_missing(st_union(st_geom_from_text("POINT(0 0)"), missing)),
+  "st_within_0":           is_missing(st_within(missing, st_geom_from_text("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))"))),
+  "st_within_1":           is_missing(st_within(st_geom_from_text("POINT(0 0)"), missing)),
+  /* AbstractSTGeometryNDescriptor subclasses (geom, int64) */
+  "st_geometry_n_0":       is_missing(st_geometry_n(missing, 1)),
+  "st_geometry_n_1":       is_missing(st_geometry_n(st_geom_from_text("GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0, 1 1))"), missing)),
+  "st_point_n_0":          is_missing(st_point_n(missing, 1)),
+  "st_point_n_1":          is_missing(st_point_n(st_geom_from_text("LINESTRING(0 0, 1 1)"), missing)),
+  "st_interior_ring_n_0":  is_missing(st_interior_ring_n(missing, 1)),
+  "st_interior_ring_n_1":  is_missing(st_interior_ring_n(st_geom_from_text("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))"), missing))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.05.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.05.query.sqlpp
new file mode 100644
index 0000000..f9daff5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.05.query.sqlpp
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+/* Standalone concrete descriptor functions with NULL in every argument position.
+   All must return NULL. */
+{
+  /* STBufferDescriptor (geom, distance) */
+  "st_buffer_0":                  st_buffer(null, 1.0),
+  "st_buffer_1":                  st_buffer(st_geom_from_text("POINT(0 0)"), null),
+  /* STDWithinDescriptor (geom0, geom1, distance) */
+  "st_dwithin_0":                 st_dwithin(null, st_geom_from_text("POINT(1 0)"), 2.0),
+  "st_dwithin_1":                 st_dwithin(st_geom_from_text("POINT(0 0)"), null, 2.0),
+  "st_dwithin_2":                 st_dwithin(st_geom_from_text("POINT(0 0)"), st_geom_from_text("POINT(1 0)"), null),
+  /* STRelateDescriptor (geom0, geom1, matrix) */
+  "st_relate_0":                  st_relate(null, st_geom_from_text("POINT(1 0)"), "FF2FF1FF2"),
+  "st_relate_1":                  st_relate(st_geom_from_text("POINT(0 0)"), null, "FF2FF1FF2"),
+  "st_relate_2":                  st_relate(st_geom_from_text("POINT(0 0)"), st_geom_from_text("POINT(1 0)"), null),
+  /* STGeomFromTextSRIDDescriptor (wkt_string, srid) */
+  "st_geom_from_text_srid_0":     st_geom_from_text(null, 4326),
+  "st_geom_from_text_srid_1":     st_geom_from_text("POINT(0 0)", null),
+  /* STMakePointDescriptor (x, y) */
+  "st_make_point_0":              st_make_point(null, 0.0),
+  "st_make_point_1":              st_make_point(0.0, null),
+  /* STMakePoint3DDescriptor (x, y, z) */
+  "st_make_point3d_0":            st_make_point(null, 0.0, 0.0),
+  "st_make_point3d_1":            st_make_point(0.0, null, 0.0),
+  "st_make_point3d_2":            st_make_point(0.0, 0.0, null),
+  /* STMakePoint3DWithMDescriptor (x, y, z, m) */
+  "st_make_point3dm_0":           st_make_point(null, 0.0, 0.0, 0.0),
+  "st_make_point3dm_1":           st_make_point(0.0, null, 0.0, 0.0),
+  "st_make_point3dm_2":           st_make_point(0.0, 0.0, null, 0.0),
+  "st_make_point3dm_3":           st_make_point(0.0, 0.0, 0.0, null),
+  /* STMakeEnvelopeDescriptorSRID (xmin, ymin, xmax, ymax, srid) */
+  "st_make_envelope_0":           st_make_envelope(null, 0.0, 1.0, 1.0, 4326),
+  "st_make_envelope_1":           st_make_envelope(0.0, null, 1.0, 1.0, 4326),
+  "st_make_envelope_2":           st_make_envelope(0.0, 0.0, null, 1.0, 4326),
+  "st_make_envelope_3":           st_make_envelope(0.0, 0.0, 1.0, null, 4326),
+  "st_make_envelope_4":           st_make_envelope(0.0, 0.0, 1.0, 1.0, null)
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.06.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.06.query.sqlpp
new file mode 100644
index 0000000..14f70bb
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/null-missing/null-missing.06.query.sqlpp
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+/* Standalone concrete descriptor functions with MISSING in every argument position.
+   All must propagate MISSING. */
+{
+  /* STBufferDescriptor (geom, distance) */
+  "st_buffer_0":                  is_missing(st_buffer(missing, 1.0)),
+  "st_buffer_1":                  is_missing(st_buffer(st_geom_from_text("POINT(0 0)"), missing)),
+  /* STDWithinDescriptor (geom0, geom1, distance) */
+  "st_dwithin_0":                 is_missing(st_dwithin(missing, st_geom_from_text("POINT(1 0)"), 2.0)),
+  "st_dwithin_1":                 is_missing(st_dwithin(st_geom_from_text("POINT(0 0)"), missing, 2.0)),
+  "st_dwithin_2":                 is_missing(st_dwithin(st_geom_from_text("POINT(0 0)"), st_geom_from_text("POINT(1 0)"), missing)),
+  /* STRelateDescriptor (geom0, geom1, matrix) */
+  "st_relate_0":                  is_missing(st_relate(missing, st_geom_from_text("POINT(1 0)"), "FF2FF1FF2")),
+  "st_relate_1":                  is_missing(st_relate(st_geom_from_text("POINT(0 0)"), missing, "FF2FF1FF2")),
+  "st_relate_2":                  is_missing(st_relate(st_geom_from_text("POINT(0 0)"), st_geom_from_text("POINT(1 0)"), missing)),
+  /* STGeomFromTextSRIDDescriptor (wkt_string, srid) */
+  "st_geom_from_text_srid_0":     is_missing(st_geom_from_text(missing, 4326)),
+  "st_geom_from_text_srid_1":     is_missing(st_geom_from_text("POINT(0 0)", missing)),
+  /* STMakePointDescriptor (x, y) */
+  "st_make_point_0":              is_missing(st_make_point(missing, 0.0)),
+  "st_make_point_1":              is_missing(st_make_point(0.0, missing)),
+  /* STMakePoint3DDescriptor (x, y, z) */
+  "st_make_point3d_0":            is_missing(st_make_point(missing, 0.0, 0.0)),
+  "st_make_point3d_1":            is_missing(st_make_point(0.0, missing, 0.0)),
+  "st_make_point3d_2":            is_missing(st_make_point(0.0, 0.0, missing)),
+  /* STMakePoint3DWithMDescriptor (x, y, z, m) */
+  "st_make_point3dm_0":           is_missing(st_make_point(missing, 0.0, 0.0, 0.0)),
+  "st_make_point3dm_1":           is_missing(st_make_point(0.0, missing, 0.0, 0.0)),
+  "st_make_point3dm_2":           is_missing(st_make_point(0.0, 0.0, missing, 0.0)),
+  "st_make_point3dm_3":           is_missing(st_make_point(0.0, 0.0, 0.0, missing)),
+  /* STMakeEnvelopeDescriptorSRID (xmin, ymin, xmax, ymax, srid) */
+  "st_make_envelope_0":           is_missing(st_make_envelope(missing, 0.0, 1.0, 1.0, 4326)),
+  "st_make_envelope_1":           is_missing(st_make_envelope(0.0, missing, 1.0, 1.0, 4326)),
+  "st_make_envelope_2":           is_missing(st_make_envelope(0.0, 0.0, missing, 1.0, 4326)),
+  "st_make_envelope_3":           is_missing(st_make_envelope(0.0, 0.0, 1.0, missing, 4326)),
+  "st_make_envelope_4":           is_missing(st_make_envelope(0.0, 0.0, 1.0, 1.0, missing))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.01.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.01.adm
new file mode 100644
index 0000000..68c7ae7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.01.adm
@@ -0,0 +1 @@
+{ "st_area": null, "st_as_binary": null, "st_as_geojson": null, "st_as_text": null, "st_boundary": null, "st_centroid": null, "st_convex_hull": null, "st_coord_dim": null, "st_dimension": null, "st_end_point": null, "st_envelope": null, "st_exterior_ring": null, "st_flip_coordinates": null, "geometry_type": null, "st_is_closed": null, "st_is_collection": null, "st_is_empty": null, "st_is_ring": null, "st_is_simple": null, "st_is_valid": null, "st_length": null, "st_line_from_multipoint": null, "st_m": null, "st_n_points": null, "st_n_rings": null, "st_num_geometries": null, "st_num_interior_rings": null, "st_reverse": null, "st_srid": null, "st_start_point": null, "st_x": null, "st_x_max": null, "st_x_min": null, "st_y": null, "st_y_max": null, "st_y_min": null, "st_z": null, "st_z_max": null, "st_z_min": null, "st_geom_from_text": null, "st_geom_from_wkb": null, "st_polygonize": null }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.02.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.02.adm
new file mode 100644
index 0000000..8cd49be
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.02.adm
@@ -0,0 +1 @@
+{ "st_area": true, "st_as_binary": true, "st_as_geojson": true, "st_as_text": true, "st_boundary": true, "st_centroid": true, "st_convex_hull": true, "st_coord_dim": true, "st_dimension": true, "st_end_point": true, "st_envelope": true, "st_exterior_ring": true, "st_flip_coordinates": true, "geometry_type": true, "st_is_closed": true, "st_is_collection": true, "st_is_empty": true, "st_is_ring": true, "st_is_simple": true, "st_is_valid": true, "st_length": true, "st_line_from_multipoint": true, "st_m": true, "st_n_points": true, "st_n_rings": true, "st_num_geometries": true, "st_num_interior_rings": true, "st_reverse": true, "st_srid": true, "st_start_point": true, "st_x": true, "st_x_max": true, "st_x_min": true, "st_y": true, "st_y_max": true, "st_y_min": true, "st_z": true, "st_z_max": true, "st_z_min": true, "st_geom_from_text": true, "st_geom_from_wkb": true, "st_polygonize": true }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.03.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.03.adm
new file mode 100644
index 0000000..c5df689
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.03.adm
@@ -0,0 +1 @@
+{ "st_contains_0": null, "st_contains_1": null, "st_crosses_0": null, "st_crosses_1": null, "st_difference_0": null, "st_difference_1": null, "st_disjoint_0": null, "st_disjoint_1": null, "st_distance_0": null, "st_distance_1": null, "st_distance_sphere_0": null, "st_distance_sphere_1": null, "st_equals_0": null, "st_equals_1": null, "st_intersection_0": null, "st_intersection_1": null, "st_intersects_0": null, "st_intersects_1": null, "st_overlaps_0": null, "st_overlaps_1": null, "st_sym_difference_0": null, "st_sym_difference_1": null, "st_touches_0": null, "st_touches_1": null, "st_union_0": null, "st_union_1": null, "st_within_0": null, "st_within_1": null, "st_geometry_n_0": null, "st_geometry_n_1": null, "st_point_n_0": null, "st_point_n_1": null, "st_interior_ring_n_0": null, "st_interior_ring_n_1": null }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.04.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.04.adm
new file mode 100644
index 0000000..8ac0e42
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.04.adm
@@ -0,0 +1 @@
+{ "st_contains_0": true, "st_contains_1": true, "st_crosses_0": true, "st_crosses_1": true, "st_difference_0": true, "st_difference_1": true, "st_disjoint_0": true, "st_disjoint_1": true, "st_distance_0": true, "st_distance_1": true, "st_distance_sphere_0": true, "st_distance_sphere_1": true, "st_equals_0": true, "st_equals_1": true, "st_intersection_0": true, "st_intersection_1": true, "st_intersects_0": true, "st_intersects_1": true, "st_overlaps_0": true, "st_overlaps_1": true, "st_sym_difference_0": true, "st_sym_difference_1": true, "st_touches_0": true, "st_touches_1": true, "st_union_0": true, "st_union_1": true, "st_within_0": true, "st_within_1": true, "st_geometry_n_0": true, "st_geometry_n_1": true, "st_point_n_0": true, "st_point_n_1": true, "st_interior_ring_n_0": true, "st_interior_ring_n_1": true }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.05.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.05.adm
new file mode 100644
index 0000000..5ed250a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.05.adm
@@ -0,0 +1 @@
+{ "st_buffer_0": null, "st_buffer_1": null, "st_dwithin_0": null, "st_dwithin_1": null, "st_dwithin_2": null, "st_relate_0": null, "st_relate_1": null, "st_relate_2": null, "st_geom_from_text_srid_0": null, "st_geom_from_text_srid_1": null, "st_make_point_0": null, "st_make_point_1": null, "st_make_point3d_0": null, "st_make_point3d_1": null, "st_make_point3d_2": null, "st_make_point3dm_0": null, "st_make_point3dm_1": null, "st_make_point3dm_2": null, "st_make_point3dm_3": null, "st_make_envelope_0": null, "st_make_envelope_1": null, "st_make_envelope_2": null, "st_make_envelope_3": null, "st_make_envelope_4": null }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.06.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.06.adm
new file mode 100644
index 0000000..dd737d6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/null-missing/result.06.adm
@@ -0,0 +1 @@
+{ "st_buffer_0": true, "st_buffer_1": true, "st_dwithin_0": true, "st_dwithin_1": true, "st_dwithin_2": true, "st_relate_0": true, "st_relate_1": true, "st_relate_2": true, "st_geom_from_text_srid_0": true, "st_geom_from_text_srid_1": true, "st_make_point_0": true, "st_make_point_1": true, "st_make_point3d_0": true, "st_make_point3d_1": true, "st_make_point3d_2": true, "st_make_point3dm_0": true, "st_make_point3dm_1": true, "st_make_point3dm_2": true, "st_make_point3dm_3": true, "st_make_envelope_0": true, "st_make_envelope_1": true, "st_make_envelope_2": true, "st_make_envelope_3": true, "st_make_envelope_4": true }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/two-geometries/result.03.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/two-geometries/result.03.adm
index 5bb4c4e..d3843ff 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/two-geometries/result.03.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/two-geometries/result.03.adm
@@ -5,6 +5,6 @@
 { "Distance": 0.0, "Intersects": true, "Contains": false, "Crosses": true, "Disjoint": false, "Equals": false, "Overlaps": false, "Relate": false, "Touches": false, "Within": false }
 { "Distance": 1.4142135623730951, "Intersects": false, "Contains": false, "Crosses": false, "Disjoint": true, "Equals": false, "Overlaps": false, "Relate": false, "Touches": false, "Within": false }
 { "Distance": 0.0, "Intersects": true, "Contains": true, "Crosses": false, "Disjoint": false, "Equals": true, "Overlaps": false, "Relate": false, "Touches": false, "Within": true }
-{ "Distance": 2.8284271247461903, "Intersects": false, "Contains": false, "Crosses": false, "Disjoint": true, "Equals": false, "Overlaps": false, "Relate": false, "Touches": false, "Within": false }
+{ "Distance": 2.8284271247461903, "Intersects": false, "Contains": false, "Crosses": false, "Disjoint": true, "Equals": false, "Overlaps": false, "Relate": true, "Touches": false, "Within": false }
 { "Distance": 0.0, "Intersects": true, "Contains": false, "Crosses": false, "Disjoint": false, "Equals": false, "Overlaps": false, "Relate": false, "Touches": true, "Within": false }
 { "Distance": 0.0, "Intersects": true, "Contains": false, "Crosses": false, "Disjoint": false, "Equals": false, "Overlaps": false, "Relate": false, "Touches": false, "Within": true }
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTDoubleGeometryDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTDoubleGeometryDescriptor.java
index 6e9b766..8221c31 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTDoubleGeometryDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTDoubleGeometryDescriptor.java
@@ -30,6 +30,7 @@
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -84,6 +85,10 @@
             eval0.evaluate(tuple, argPtr0);
             eval1.evaluate(tuple, argPtr1);
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, argPtr0, argPtr1)) {
+                return;
+            }
+
             try {
                 byte[] bytes0 = argPtr0.getByteArray();
                 int offset0 = argPtr0.getStartOffset();
@@ -99,7 +104,7 @@
                 }
                 tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]);
                 if (tag != ATypeTag.GEOMETRY) {
-                    throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, bytes1[offset1],
+                    throw new TypeMismatchException(sourceLoc, getIdentifier(), 1, bytes1[offset1],
                             ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
                 }
 
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTGeometryNDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTGeometryNDescriptor.java
index a804631..59e4b1a 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTGeometryNDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTGeometryNDescriptor.java
@@ -27,6 +27,7 @@
 import org.apache.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.asterix.runtime.exceptions.InvalidDataFormatException;
 import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -89,12 +90,16 @@
             byte[] data0 = inputArg0.getByteArray();
             int offset0 = inputArg0.getStartOffset();
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, inputArg, inputArg0)) {
+                return;
+            }
+
             if (data[offset] != ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG) {
                 throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, data[offset],
                         ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
             }
             if (data0[offset0] != ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
-                throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, data0[offset0],
+                throw new TypeMismatchException(sourceLoc, getIdentifier(), 1, data0[offset0],
                         ATypeTag.SERIALIZED_INT64_TYPE_TAG);
             }
 
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTSingleGeometryDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTSingleGeometryDescriptor.java
index d97af58..5625ebb 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTSingleGeometryDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTSingleGeometryDescriptor.java
@@ -33,6 +33,7 @@
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -86,6 +87,10 @@
             resultStorage.reset();
             eval0.evaluate(tuple, argPtr0);
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, argPtr0)) {
+                return;
+            }
+
             try {
                 byte[] bytes0 = argPtr0.getByteArray();
                 int offset0 = argPtr0.getStartOffset();
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/ParseGeoJSONDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/ParseGeoJSONDescriptor.java
index 21a1c76..19782ec 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/ParseGeoJSONDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/ParseGeoJSONDescriptor.java
@@ -38,6 +38,7 @@
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.asterix.runtime.exceptions.InvalidDataFormatException;
 import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -112,11 +113,16 @@
 
         @Override
         public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
+            resultStorage.reset();
             eval.evaluate(tuple, inputArg);
             byte[] data = inputArg.getByteArray();
             int offset = inputArg.getStartOffset();
             int len = inputArg.getLength();
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, inputArg)) {
+                return;
+            }
+
             if (data[offset] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
                 throw new TypeMismatchException(sourceLoc, BuiltinFunctions.GEOMETRY_CONSTRUCTOR, 0, data[offset],
                         ATypeTag.SERIALIZED_RECORD_TYPE_TAG);
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STBufferDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STBufferDescriptor.java
index 9af28b8..3b4882e 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STBufferDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STBufferDescriptor.java
@@ -30,6 +30,7 @@
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.asterix.runtime.exceptions.InvalidDataFormatException;
 import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -95,6 +96,10 @@
             byte[] bytes1 = inputArg1.getByteArray();
             int offset1 = inputArg1.getStartOffset();
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, inputArg0, inputArg1)) {
+                return;
+            }
+
             ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]);
             if (tag != ATypeTag.GEOMETRY) {
                 throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, bytes0[offset0],
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STDWithinDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STDWithinDescriptor.java
index e623a51..93989de 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STDWithinDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STDWithinDescriptor.java
@@ -33,6 +33,7 @@
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.asterix.runtime.exceptions.InvalidDataFormatException;
 import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -108,6 +109,10 @@
             byte[] bytes2 = inputArg2.getByteArray();
             int offset2 = inputArg2.getStartOffset();
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, inputArg0, inputArg1, inputArg2)) {
+                return;
+            }
+
             ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]);
             if (tag != ATypeTag.GEOMETRY) {
                 throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, bytes0[offset0],
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextDescriptor.java
index e6f85e2..36d7b42 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextDescriptor.java
@@ -29,6 +29,7 @@
 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.functions.PointableHelper;
 import org.apache.asterix.runtime.exceptions.InvalidDataFormatException;
 import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -85,11 +86,16 @@
 
         @Override
         public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
+            resultStorage.reset();
             eval.evaluate(tuple, inputArg);
             byte[] data = inputArg.getByteArray();
             int offset = inputArg.getStartOffset();
             int len = inputArg.getLength();
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, inputArg)) {
+                return;
+            }
+
             if (data[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                 throw new TypeMismatchException(sourceLoc, BuiltinFunctions.ST_GEOM_FROM_TEXT, 0, data[offset],
                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextSRIDDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextSRIDDescriptor.java
index 63b34f0..ab302e1 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextSRIDDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextSRIDDescriptor.java
@@ -29,6 +29,7 @@
 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.functions.PointableHelper;
 import org.apache.asterix.runtime.exceptions.InvalidDataFormatException;
 import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -89,6 +90,7 @@
 
         @Override
         public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
+            resultStorage.reset();
             eval.evaluate(tuple, inputArg);
             byte[] data = inputArg.getByteArray();
             int offset = inputArg.getStartOffset();
@@ -98,12 +100,16 @@
             byte[] data0 = inputArg0.getByteArray();
             int offset0 = inputArg0.getStartOffset();
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, inputArg, inputArg0)) {
+                return;
+            }
+
             if (data[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                 throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, data[offset],
                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
             }
             if (data0[offset0] != ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
-                throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, data0[offset0],
+                throw new TypeMismatchException(sourceLoc, getIdentifier(), 1, data0[offset0],
                         ATypeTag.SERIALIZED_INT64_TYPE_TAG);
             }
 
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromWKBDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromWKBDescriptor.java
index e23bbab..972ed00 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromWKBDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromWKBDescriptor.java
@@ -27,6 +27,7 @@
 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.functions.PointableHelper;
 import org.apache.asterix.runtime.exceptions.InvalidDataFormatException;
 import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -81,11 +82,16 @@
 
         @Override
         public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
+            resultStorage.reset();
             eval.evaluate(tuple, inputArg);
             byte[] data = inputArg.getByteArray();
             int offset = inputArg.getStartOffset();
             int len = inputArg.getLength();
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, inputArg)) {
+                return;
+            }
+
             if (data[offset] != ATypeTag.SERIALIZED_BINARY_TYPE_TAG) {
                 throw new TypeMismatchException(sourceLoc, BuiltinFunctions.ST_GEOM_FROM_WKB, 0, data[offset],
                         ATypeTag.SERIALIZED_BINARY_TYPE_TAG);
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakeEnvelopeDescriptorSRID.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakeEnvelopeDescriptorSRID.java
index 6589b2f..8a2be50 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakeEnvelopeDescriptorSRID.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakeEnvelopeDescriptorSRID.java
@@ -25,6 +25,7 @@
 import org.apache.asterix.om.functions.BuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.asterix.runtime.exceptions.InvalidDataFormatException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -130,6 +131,11 @@
             byte[] data4 = inputArg4.getByteArray();
             int offset4 = inputArg4.getStartOffset();
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, inputArg0, inputArg1, inputArg2, inputArg3,
+                    inputArg4)) {
+                return;
+            }
+
             try {
                 double xmin = getVal(data0, offset0);
                 double ymin = getVal(data1, offset1);
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePoint3DDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePoint3DDescriptor.java
index c4efb96..2c8848c 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePoint3DDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePoint3DDescriptor.java
@@ -25,6 +25,7 @@
 import org.apache.asterix.om.functions.BuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 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;
@@ -92,6 +93,10 @@
             eval1.evaluate(tuple, inputArg1);
             eval2.evaluate(tuple, inputArg2);
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, inputArg0, inputArg1, inputArg2)) {
+                return;
+            }
+
             byte[] bytes0 = inputArg0.getByteArray();
             int offset0 = inputArg0.getStartOffset();
             byte[] bytes1 = inputArg1.getByteArray();
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePoint3DWithMDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePoint3DWithMDescriptor.java
index c88c6937..98f9791 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePoint3DWithMDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePoint3DWithMDescriptor.java
@@ -25,6 +25,7 @@
 import org.apache.asterix.om.functions.BuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 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;
@@ -102,6 +103,10 @@
             eval2.evaluate(tuple, inputArg2);
             eval3.evaluate(tuple, inputArg3);
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, inputArg0, inputArg1, inputArg2, inputArg3)) {
+                return;
+            }
+
             byte[] bytes0 = inputArg0.getByteArray();
             int offset0 = inputArg0.getStartOffset();
             byte[] bytes1 = inputArg1.getByteArray();
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePointDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePointDescriptor.java
index 44e2bda..f04475b 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePointDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakePointDescriptor.java
@@ -25,6 +25,7 @@
 import org.apache.asterix.om.functions.BuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 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;
@@ -86,6 +87,10 @@
             eval0.evaluate(tuple, inputArg0);
             eval1.evaluate(tuple, inputArg1);
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, inputArg0, inputArg1)) {
+                return;
+            }
+
             byte[] bytes0 = inputArg0.getByteArray();
             int offset0 = inputArg0.getStartOffset();
             byte[] bytes1 = inputArg1.getByteArray();
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STPolygonizeDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STPolygonizeDescriptor.java
index b155762..7dc06d2 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STPolygonizeDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STPolygonizeDescriptor.java
@@ -37,6 +37,7 @@
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.asterix.runtime.exceptions.InvalidDataFormatException;
 import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -100,11 +101,16 @@
         @Override
         @SuppressWarnings("unchecked")
         public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
+            resultStorage.reset();
             eval.evaluate(tuple, inputArg);
             byte[] bytes = inputArg.getByteArray();
             int offset = inputArg.getStartOffset();
             int len = inputArg.getLength();
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, inputArg)) {
+                return;
+            }
+
             AOrderedListType type = new AOrderedListType(BuiltinType.AGEOMETRY, null);
             byte typeTag = inputArg.getByteArray()[inputArg.getStartOffset()];
             ISerializerDeserializer serde;
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STRelateDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STRelateDescriptor.java
index ee9101c..62b9b1d 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STRelateDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STRelateDescriptor.java
@@ -33,6 +33,7 @@
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.asterix.runtime.exceptions.InvalidDataFormatException;
 import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -93,6 +94,7 @@
         @Override
         @SuppressWarnings("unchecked")
         public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
+            resultStorage.reset();
             eval.evaluate(tuple, inputArg);
             byte[] bytes = inputArg.getByteArray();
             int offset = inputArg.getStartOffset();
@@ -108,8 +110,12 @@
             int offset1 = inputArg1.getStartOffset();
             int len1 = inputArg1.getLength();
 
+            if (PointableHelper.checkAndSetMissingOrNull(result, inputArg, inputArg0, inputArg1)) {
+                return;
+            }
+
             if (bytes[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, bytes[offset],
+                throw new TypeMismatchException(sourceLoc, getIdentifier(), 2, bytes[offset],
                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
             }
             ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]);
@@ -119,7 +125,7 @@
             }
             tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]);
             if (tag != ATypeTag.GEOMETRY) {
-                throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, bytes1[offset1],
+                throw new TypeMismatchException(sourceLoc, getIdentifier(), 1, bytes1[offset1],
                         ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
             }
 

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21030?usp=email
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Ia6e37080a581292744ddc9020b216928414c18ac
Gerrit-Change-Number: 21030
Gerrit-PatchSet: 1
Gerrit-Owner: Suryaa Charan Shivakumar <ss...@ucr.edu>