From 6478129e1417227f289d51bba19f166e7db6596b Mon Sep 17 00:00:00 2001 From: Hannah Chi Date: Wed, 22 Nov 2023 11:45:19 -0600 Subject: [PATCH] [SEDONA-434] Improve reliability by resolve the nondeterministic of the order of the Map (#1130) --- .../java/org/apache/sedona/core/spatialRDD/SpatialRDD.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spark/common/src/main/java/org/apache/sedona/core/spatialRDD/SpatialRDD.java b/spark/common/src/main/java/org/apache/sedona/core/spatialRDD/SpatialRDD.java index 7954c75c7f..20cebe9500 100644 --- a/spark/common/src/main/java/org/apache/sedona/core/spatialRDD/SpatialRDD.java +++ b/spark/common/src/main/java/org/apache/sedona/core/spatialRDD/SpatialRDD.java @@ -52,7 +52,7 @@ import java.io.Serializable; import java.util.ArrayList; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -568,7 +568,7 @@ public void saveAsGeoJSON(String outputLocation) Geometry spatialObject = iterator.next(); Feature jsonFeature; if (spatialObject.getUserData() != null) { - Map fields = new HashMap(); + Map fields = new LinkedHashMap(); String[] fieldValues = spatialObject.getUserData().toString().split("\t"); if (fieldNames != null && fieldValues.length == fieldNames.size()) { for (int i = 0 ; i < fieldValues.length ; i++) {