jinchengchenghh commented on code in PR #7592:
URL: https://github.com/apache/incubator-gluten/pull/7592#discussion_r1816028769
##########
backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:
##########
@@ -214,60 +211,12 @@ case class ColumnarPartialProjectExec(original:
ProjectExec, child: SparkPlan)(
}
}
- // scalastyle:off line.size.limit
- // String type cannot use MutableProjection
- // Otherwise will throw java.lang.UnsupportedOperationException: Datatype
not supported StringType
- // at
org.apache.spark.sql.execution.vectorized.MutableColumnarRow.update(MutableColumnarRow.java:224)
- // at
org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificMutableProjection.apply(Unknown
Source)
- // scalastyle:on line.size.limit
- private def canUseMutableProjection(): Boolean = {
- replacedAliasUdf.forall(
- r =>
- r.dataType match {
- case StringType | BinaryType => false
- case _ => true
- })
- }
-
- /**
- * add c2r and r2c for unsupported expression child data c2r get
Iterator[InternalRow], then call
- * Spark project, then r2c
- */
- private def getProjectedBatch(
- childData: ColumnarBatch,
- c2r: SQLMetric,
- r2c: SQLMetric): Iterator[ColumnarBatch] = {
- // select part of child output and child data
- val proj = UnsafeProjection.create(replacedAliasUdf,
projectAttributes.toSeq)
- val numOutputRows = new SQLMetric("numOutputRows")
- val numInputBatches = new SQLMetric("numInputBatches")
- val rows = VeloxColumnarToRowExec
- .toRowIterator(
- Iterator.single[ColumnarBatch](childData),
- projectAttributes.toSeq,
- numOutputRows,
- numInputBatches,
- c2r)
- .map(proj)
-
- val schema =
-
SparkShimLoader.getSparkShims.structFromAttributes(replacedAliasUdf.map(_.toAttribute))
- RowToVeloxColumnarExec.toColumnarBatchIterator(
- rows,
- schema,
- numOutputRows,
- numInputBatches,
- r2c,
- childData.numRows())
- // TODO: should check the size <= 1, but now it has bug, will change
iterator to empty
- }
-
private def getProjectedBatchArrow(
childData: ColumnarBatch,
c2a: SQLMetric,
a2c: SQLMetric): Iterator[ColumnarBatch] = {
// select part of child output and child data
- val proj = MutableProjection.create(replacedAliasUdf,
projectAttributes.toSeq)
+ val proj = ArrowProjection.create(replacedAliasUdf,
projectAttributes.toSeq)
val numRows = childData.numRows()
val start = System.currentTimeMillis()
val arrowBatch = if (childData.numCols() == 0 ||
ColumnarBatches.isHeavyBatch(childData)) {
Review Comment:
Thanks for catching it.
--
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]