viirya commented on code in PR #774: URL: https://github.com/apache/datafusion-comet/pull/774#discussion_r1702940755
########## spark/src/main/scala/org/apache/spark/sql/comet/CometWindowExec.scala: ########## @@ -65,71 +65,27 @@ case class CometWindowExec( sparkContext, "number of partitions")) ++ readMetrics ++ writeMetrics - override def supportsColumnar: Boolean = true - - protected override def doExecuteColumnar(): RDD[ColumnarBatch] = { - val childRDD = child.executeColumnar() - - childRDD.mapPartitionsInternal { iter => - CometExec.getCometIterator( - Seq(iter), - getNativePlan(output, windowExpression, partitionSpec, orderSpec, child).get) - } - } - override def outputOrdering: Seq[SortOrder] = child.outputOrdering override def outputPartitioning: Partitioning = child.outputPartitioning protected def withNewChildInternal(newChild: SparkPlan): SparkPlan = this.copy(child = newChild) -} - -object CometWindowExec { - def getNativePlan( - outputAttributes: Seq[Attribute], - windowExpression: Seq[NamedExpression], - partitionSpec: Seq[Expression], - orderSpec: Seq[SortOrder], - child: SparkPlan): Option[Operator] = { - - val orderSpecs = orderSpec.map(exprToProto(_, child.output)) - val partitionSpecs = partitionSpec.map(exprToProto(_, child.output)) - val scanBuilder = OperatorOuterClass.Scan.newBuilder() - val scanOpBuilder = OperatorOuterClass.Operator.newBuilder() - - val scanTypes = outputAttributes.flatten { attr => - serializeDataType(attr.dataType) + override def stringArgs: Iterator[Any] = + Iterator(output, windowExpression, partitionSpec, orderSpec, child) + + override def equals(obj: Any): Boolean = { + obj match { + case other: CometWindowExec => + this.windowExpression == other.windowExpression && this.child == other.child && + this.partitionSpec == other.partitionSpec && this.orderSpec == other.orderSpec && + this.serializedPlanOpt == other.serializedPlanOpt + case _ => + false } Review Comment: This native plan is incorrect. This uses the window operator's output as the pseudo scan's output, but it should be the child plan's output. The incorrect output causes errors in DataFusion Window operator. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org