Skip to content

Commit

Permalink
feat(pojo): add UNSPECIFIED value to AggregationPhase enum (#320)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: AggregationPhase enum has a new allowed value
  • Loading branch information
mbwhite authored Jan 8, 2025
1 parent ae59c32 commit a0ef1dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/src/main/java/io/substrait/expression/Expression.java
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a0ef1dd

Please sign in to comment.