From 116f1a71f7ad7e70b6e0cf3b14c9358bf2911fbb Mon Sep 17 00:00:00 2001 From: MBWhite Date: Fri, 29 Nov 2024 16:37:00 +0000 Subject: [PATCH 1/2] fix: update to support the Aggregate Phase Unspecified Signed-off-by: MBWhite --- core/src/main/java/io/substrait/expression/Expression.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main/java/io/substrait/expression/Expression.java b/core/src/main/java/io/substrait/expression/Expression.java index 9fc719f35..aa9e69148 100644 --- a/core/src/main/java/io/substrait/expression/Expression.java +++ b/core/src/main/java/io/substrait/expression/Expression.java @@ -940,6 +940,7 @@ public static AggregationInvocation fromProto(AggregateFunction.AggregationInvoc } enum AggregationPhase { + UNSPECIFIED(io.substrait.proto.AggregationPhase.AGGREGATION_PHASE_UNSPECIFIED), INITIAL_TO_INTERMEDIATE( io.substrait.proto.AggregationPhase.AGGREGATION_PHASE_INITIAL_TO_INTERMEDIATE), INTERMEDIATE_TO_INTERMEDIATE( From bedd309b069ceacd5caf16ee2c6e63981112e328 Mon Sep 17 00:00:00 2001 From: Victor Barua Date: Tue, 24 Dec 2024 13:41:51 -0800 Subject: [PATCH 2/2] fix(spark): handle AggregationPhase UNSPECIFIED --- .../io/substrait/spark/expression/ToAggregateFunction.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spark/src/main/scala/io/substrait/spark/expression/ToAggregateFunction.scala b/spark/src/main/scala/io/substrait/spark/expression/ToAggregateFunction.scala index 9e959e47e..978287d93 100644 --- a/spark/src/main/scala/io/substrait/spark/expression/ToAggregateFunction.scala +++ b/spark/src/main/scala/io/substrait/spark/expression/ToAggregateFunction.scala @@ -74,6 +74,8 @@ object ToAggregateFunction { case other => throw new UnsupportedOperationException(s"not currently supported: $other.") } def toSpark(phase: SExpression.AggregationPhase): AggregateMode = phase match { + case SExpression.AggregationPhase.UNSPECIFIED => + Final // UNSPECIFIED implies INTERMEDIATE_TO_RESULT case SExpression.AggregationPhase.INITIAL_TO_INTERMEDIATE => Partial case SExpression.AggregationPhase.INTERMEDIATE_TO_INTERMEDIATE => PartialMerge case SExpression.AggregationPhase.INTERMEDIATE_TO_RESULT => Final