Skip to content

Commit 9659aa1

Browse files
committed
fix: also output old structures
Signed-off-by: Niels Pardon <par@zurich.ibm.com>
1 parent 5c7c069 commit 9659aa1

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

core/src/main/java/io/substrait/relation/RelProtoConverter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ private AggregateRel.Measure toProto(Aggregate.Measure measure) {
215215
private AggregateRel.Grouping toProto(
216216
Aggregate.Grouping grouping, List<Expression> uniqueGroupingExpressions) {
217217
return AggregateRel.Grouping.newBuilder()
218+
.addAllGroupingExpressions(
219+
grouping.getExpressions().stream().map(this::toProto).collect(Collectors.toList()))
218220
.addAllExpressionReferences(
219221
grouping.getExpressions().stream()
220222
.map(e -> uniqueGroupingExpressions.indexOf(e))

core/src/test/java/io/substrait/relation/AggregateRelTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ void testDeprecatedGroupingExpressionConversion() {
102102
roundtripAgg.getGroupingExpressionsCount(),
103103
"grouping expressions count of aggregate should be 2");
104104
assertEquals(
105-
0,
105+
2,
106106
roundtripAgg.getGroupings(0).getGroupingExpressionsCount(),
107-
"grouping expressions count of grouping should be 0");
107+
"grouping expressions count of grouping should be 2");
108108
assertEquals(
109109
2,
110110
roundtripAgg.getGroupings(0).getExpressionReferencesCount(),
@@ -157,9 +157,9 @@ void testAggregateWithSingleGrouping() {
157157
roundtripAgg.getGroupingExpressionsCount(),
158158
"grouping expressions count of aggregate should be 2");
159159
assertEquals(
160-
0,
160+
2,
161161
roundtripAgg.getGroupings(0).getGroupingExpressionsCount(),
162-
"grouping expressions count of grouping should be 0");
162+
"grouping expressions count of grouping should be 2");
163163
assertEquals(
164164
2,
165165
roundtripAgg.getGroupings(0).getExpressionReferencesCount(),
@@ -217,9 +217,9 @@ void testAggregateWithMultipleGroupings() {
217217
roundtripAgg.getGroupingExpressionsCount(),
218218
"grouping expressions count of aggregate should be 2");
219219
assertEquals(
220-
0,
220+
2,
221221
roundtripAgg.getGroupings(0).getGroupingExpressionsCount(),
222-
"grouping expressions count of grouping should be 0");
222+
"grouping expressions count of grouping should be 2");
223223
assertEquals(
224224
2,
225225
roundtripAgg.getGroupings(0).getExpressionReferencesCount(),

0 commit comments

Comments
 (0)