coderfender commented on code in PR #3757:
URL: https://github.com/apache/datafusion-comet/pull/3757#discussion_r2970600033


##########
spark/src/main/scala/org/apache/comet/serde/aggregates.scala:
##########
@@ -671,6 +672,62 @@ object CometBloomFilterAggregate extends 
CometAggregateExpressionSerde[BloomFilt
   }
 }
 
+object CometPercentile extends CometAggregateExpressionSerde[Percentile] {
+  override def convert(
+      aggExpr: AggregateExpression,
+      expr: Percentile,
+      inputs: Seq[Attribute],
+      binding: Boolean,
+      conf: SQLConf): Option[ExprOuterClass.AggExpr] = {
+
+    // Only support when frequency is Literal(1L) - i.e., percentile_cont 
behavior
+    expr.frequencyExpression match {
+      case Literal(1L, LongType) =>
+      case _ =>
+        withInfo(aggExpr, "weighted percentile not supported")
+        return None
+    }
+
+    // Only support scalar percentile, not array of percentiles
+    if (expr.percentageExpression.dataType.isInstanceOf[ArrayType]) {
+      withInfo(aggExpr, "array of percentiles not supported")
+      return None
+    }

Review Comment:
    nit : could be a better idea to test scalar and reject all other inputs to 
make the code more defensive ?



-- 
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]

Reply via email to