andygrove commented on code in PR #4542:
URL: https://github.com/apache/datafusion-comet/pull/4542#discussion_r3494431607
##########
spark/src/main/scala/org/apache/spark/sql/comet/operators.scala:
##########
@@ -1920,6 +1920,11 @@ object CometObjectHashAggregateExec
val elementType = cs.children.head.dataType
val nativeStateType = ArrayType(elementType, containsNull = true)
output(bufferIdx) = output(bufferIdx).withDataType(nativeStateType)
+ case _: Percentile =>
+ // DataFusion's percentile_cont keeps all values in a List<Float64>
partial state.
+ // Comet casts the child to double, so the native state is
ArrayType(DoubleType).
+ val nativeStateType = ArrayType(DoubleType, containsNull = true)
Review Comment:
The values are null-free (flatten drops them), but DataFusion declares the
state list's element field as nullable: `Field::new_list_field(input_type,
true)` in both `state_fields` and the `ListArray` built in `state().
containsNull = true` matches the schema the native side exports across the
partial/shuffle boundary, so I'd like to keep it to stay consistent with DF's
state field.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]