diff --git a/core/trino-main/src/main/java/io/trino/sql/planner/QueryPlanner.java b/core/trino-main/src/main/java/io/trino/sql/planner/QueryPlanner.java index 4bb85fc6b46f4..c2960e5cc6301 100644 --- a/core/trino-main/src/main/java/io/trino/sql/planner/QueryPlanner.java +++ b/core/trino-main/src/main/java/io/trino/sql/planner/QueryPlanner.java @@ -1156,7 +1156,7 @@ private GroupingSetsPlan planGroupingSets(PlanBuilder subPlan, QuerySpecificatio groupingSetMappings.put(output, input); } - Map, Symbol> complexExpressions = new HashMap<>(); + Map, Symbol> complexExpressions = new LinkedHashMap<>(); for (Expression expression : groupingSetAnalysis.getComplexExpressions()) { if (!complexExpressions.containsKey(scopeAwareKey(expression, analysis, subPlan.getScope()))) { Symbol input = subPlan.translate(expression);