[NO ISSUE][COMP] Avoid Sorting Splits Locations

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Maintain a sorted copy of the locations to use for comparison
  inside AlgebricksAbsolutePartitionConstraint rather than sorting
  the locations that are aligned with storage.

Change-Id: I9120b225916acc3e0e9717bd18c128d345d47b61
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2878
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Tested-by: Michael Blow <mblow@apache.org>
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StoragePathUtil.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StoragePathUtil.java
index 63e29ce..05ea5c2 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StoragePathUtil.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StoragePathUtil.java
@@ -41,15 +41,12 @@
 public class StoragePathUtil {
 
     private static final Logger LOGGER = LogManager.getLogger();
-    private static final Comparator<FileSplit> FILE_SPLIT_COMPARATOR =
-            Comparator.comparing(FileSplit::getNodeName).thenComparing(FileSplit::getPath);
 
     private StoragePathUtil() {
     }
 
     public static Pair<IFileSplitProvider, AlgebricksPartitionConstraint> splitProviderAndPartitionConstraints(
             FileSplit[] splits) {
-        Arrays.sort(splits, FILE_SPLIT_COMPARATOR);
         IFileSplitProvider splitProvider = new ConstantFileSplitProvider(splits);
         String[] loc = new String[splits.length];
         for (int p = 0; p < splits.length; p++) {
diff --git a/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java b/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
index 7a1bb28..fa4a707 100644
--- a/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
+++ b/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
@@ -25,9 +25,12 @@
 
 public class AlgebricksAbsolutePartitionConstraint extends AlgebricksPartitionConstraint {
     private final String[] locations;
+    private final String[] sortedLocations;
 
     public AlgebricksAbsolutePartitionConstraint(String[] locations) {
         this.locations = locations;
+        sortedLocations = locations.clone();
+        Arrays.sort(sortedLocations);
     }
 
     @Override
@@ -55,7 +58,7 @@
                 break;
             case ABSOLUTE:
                 AlgebricksAbsolutePartitionConstraint thatAbsolute = (AlgebricksAbsolutePartitionConstraint) that;
-                if (Arrays.equals(locations, thatAbsolute.locations)) {
+                if (Arrays.equals(sortedLocations, thatAbsolute.sortedLocations)) {
                     return this;
                 }
                 break;