From 61a61cae55f0793e3fab98764e460e4ac4ae93a5 Mon Sep 17 00:00:00 2001 From: Gabriel Musat Mestre Date: Thu, 4 Jul 2024 10:04:35 +0200 Subject: [PATCH] test: add test for sorts inside aggregate functions --- .../io/substrait/type/proto/AggregateRoundtripTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/src/test/java/io/substrait/type/proto/AggregateRoundtripTest.java b/core/src/test/java/io/substrait/type/proto/AggregateRoundtripTest.java index b710bdeb9..879b39b8b 100644 --- a/core/src/test/java/io/substrait/type/proto/AggregateRoundtripTest.java +++ b/core/src/test/java/io/substrait/type/proto/AggregateRoundtripTest.java @@ -32,6 +32,11 @@ private void assertAggregateRoundtrip(Expression.AggregationInvocation invocatio .initialSchema(NamedStruct.of(Arrays.asList("decimal"), R.struct(R.decimal(10, 2)))) .addRows(literal) .build(); + var sort = + ImmutableExpression.SortField.builder() + .expr(ExpressionCreator.bool(true, true)) + .direction(Expression.SortDirection.DESC_NULLS_LAST) + .build(); ExtensionCollector functionCollector = new ExtensionCollector(); var to = new RelProtoConverter(functionCollector); var extensions = defaultExtensionCollection; @@ -45,6 +50,7 @@ private void assertAggregateRoundtrip(Expression.AggregationInvocation invocatio .declaration(extensions.aggregateFunctions().get(0)) .outputType(TypeCreator.of(false).I64) .aggregationPhase(Expression.AggregationPhase.INITIAL_TO_RESULT) + .sort(Arrays.asList(sort)) .invocation(invocation) .build()) .build();