From a79fd68ba755b3a00e5346632714fdd7a9f625eb Mon Sep 17 00:00:00 2001 From: Karol Sobczak Date: Wed, 8 Mar 2023 17:02:13 +0100 Subject: [PATCH] Use deterministic map in equality inference --- .../src/main/java/io/trino/sql/planner/EqualityInference.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/trino-main/src/main/java/io/trino/sql/planner/EqualityInference.java b/core/trino-main/src/main/java/io/trino/sql/planner/EqualityInference.java index b0d43f2536d3..96f83421a619 100644 --- a/core/trino-main/src/main/java/io/trino/sql/planner/EqualityInference.java +++ b/core/trino-main/src/main/java/io/trino/sql/planner/EqualityInference.java @@ -30,6 +30,7 @@ import java.util.Collection; import java.util.Comparator; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; @@ -211,7 +212,7 @@ public static EqualityInference newInstance(Metadata metadata, Collection> equivalentClasses = equalities.getEquivalentClasses(); // Map every expression to the set of equivalent expressions - Map> byExpression = new HashMap<>(); + Map> byExpression = new LinkedHashMap<>(); for (Set equivalence : equivalentClasses) { equivalence.forEach(expression -> byExpression.put(expression, equivalence)); }