diff --git a/spatial/src/spatial/core/functions/scalar/st_points.cpp b/spatial/src/spatial/core/functions/scalar/st_points.cpp index 75b91856..7d654ae6 100644 --- a/spatial/src/spatial/core/functions/scalar/st_points.cpp +++ b/spatial/src/spatial/core/functions/scalar/st_points.cpp @@ -47,15 +47,16 @@ static void GeometryPointsFunction(DataChunk &args, ExpressionState &state, Vect vector vertex_ptr_buffer; UnaryExecutor::Execute(geom_vec, result, count, [&](geometry_t input) { + const auto geom = Geometry::Deserialize(arena, input); + const auto has_z = geom.GetProperties().HasZ(); + const auto has_m = geom.GetProperties().HasM(); + // Reset the vertex pointer buffer vertex_ptr_buffer.clear(); - auto geom = Geometry::Deserialize(arena, input); + // Collect the vertex pointers Geometry::Match(geom, vertex_ptr_buffer); - const auto has_z = geom.GetProperties().HasZ(); - const auto has_m = geom.GetProperties().HasM(); - if (vertex_ptr_buffer.empty()) { const auto mpoint = MultiPoint::CreateEmpty(has_z, has_m); return Geometry::Serialize(mpoint, result);