This is an automated email from the ASF dual-hosted git repository. taiyang-li pushed a commit to branch fake_add_bolt_backend in repository https://gitbox.apache.org/repos/asf/gluten.git
commit a938159153b63221b91ff8bc19cb571ce7747c10 Author: liyang.127 <[email protected]> AuthorDate: Wed Jul 1 16:15:31 2026 +0800 Share carrier row transitions under backends-core Move the common carrier-row transition glue into backends-core so the velox backend can keep only thin wrappers and future backend alignment can reuse the same shared implementation. --- .../gluten/execution/SharedCarrierRowType.scala | 15 +++++++++----- .../execution/SharedColumnarToCarrierRowExec.scala | 24 ++++++++++++---------- .../backendsapi/velox/VeloxCarrierRowType.scala | 12 +++++------ .../execution/VeloxColumnarToCarrierRowExec.scala | 12 +++++------ 4 files changed, 34 insertions(+), 29 deletions(-) diff --git a/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxCarrierRowType.scala b/backends-core/src/main/scala/org/apache/gluten/execution/SharedCarrierRowType.scala similarity index 67% copy from backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxCarrierRowType.scala copy to backends-core/src/main/scala/org/apache/gluten/execution/SharedCarrierRowType.scala index 79d350e90a..58ce6531bd 100644 --- a/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxCarrierRowType.scala +++ b/backends-core/src/main/scala/org/apache/gluten/execution/SharedCarrierRowType.scala @@ -14,13 +14,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.gluten.backendsapi.velox +package org.apache.gluten.execution -import org.apache.gluten.execution.VeloxColumnarToCarrierRowExec -import org.apache.gluten.extension.columnar.transition.Convention +import org.apache.gluten.extension.columnar.transition.{Convention, Transition} + +/** Shared implementation for backend-specific carrier row types. */ +abstract class SharedCarrierRowType extends Convention.RowType { + + protected def backendBatchType: Convention.BatchType + + protected def toCarrierRowTransition: Transition -object VeloxCarrierRowType extends Convention.RowType { override protected[this] def registerTransitions(): Unit = { - fromBatch(VeloxBatchType, VeloxColumnarToCarrierRowExec.apply) + fromBatch(backendBatchType, toCarrierRowTransition) } } diff --git a/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToCarrierRowExec.scala b/backends-core/src/main/scala/org/apache/gluten/execution/SharedColumnarToCarrierRowExec.scala similarity index 66% copy from backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToCarrierRowExec.scala copy to backends-core/src/main/scala/org/apache/gluten/execution/SharedColumnarToCarrierRowExec.scala index 65ce184861..0ca2a505d2 100644 --- a/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToCarrierRowExec.scala +++ b/backends-core/src/main/scala/org/apache/gluten/execution/SharedColumnarToCarrierRowExec.scala @@ -16,23 +16,25 @@ */ package org.apache.gluten.execution -import org.apache.gluten.backendsapi.velox.{VeloxBatchType, VeloxCarrierRowType} import org.apache.gluten.extension.columnar.transition.{Convention, ConventionReq, Transitions} import org.apache.spark.sql.execution.SparkPlan -case class VeloxColumnarToCarrierRowExec(override val child: SparkPlan) +/** Shared implementation for backend-specific `ColumnarToCarrierRowExec` wrappers. */ +abstract class SharedColumnarToCarrierRowExec(child: SparkPlan) extends ColumnarToCarrierRowExecBase { - override protected def fromBatchType(): Convention.BatchType = VeloxBatchType - override def rowType(): Convention.RowType = VeloxCarrierRowType - override protected def withNewChildInternal(newChild: SparkPlan): SparkPlan = - copy(child = newChild) + + protected def backendBatchType: Convention.BatchType + + protected def backendRowType: Convention.RowType + + override protected def fromBatchType(): Convention.BatchType = backendBatchType + + override def rowType(): Convention.RowType = backendRowType } -object VeloxColumnarToCarrierRowExec { - def enforce(child: SparkPlan): SparkPlan = { - Transitions.enforceReq( - child, - ConventionReq.ofRow(ConventionReq.RowType.Is(VeloxCarrierRowType))) +object SharedColumnarToCarrierRowExec { + def enforce(child: SparkPlan, rowType: Convention.RowType): SparkPlan = { + Transitions.enforceReq(child, ConventionReq.ofRow(ConventionReq.RowType.Is(rowType))) } } diff --git a/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxCarrierRowType.scala b/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxCarrierRowType.scala index 79d350e90a..dc0514a60e 100644 --- a/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxCarrierRowType.scala +++ b/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxCarrierRowType.scala @@ -16,11 +16,11 @@ */ package org.apache.gluten.backendsapi.velox -import org.apache.gluten.execution.VeloxColumnarToCarrierRowExec -import org.apache.gluten.extension.columnar.transition.Convention +import org.apache.gluten.execution.{SharedCarrierRowType, VeloxColumnarToCarrierRowExec} +import org.apache.gluten.extension.columnar.transition.{Convention, Transition} -object VeloxCarrierRowType extends Convention.RowType { - override protected[this] def registerTransitions(): Unit = { - fromBatch(VeloxBatchType, VeloxColumnarToCarrierRowExec.apply) - } +object VeloxCarrierRowType extends SharedCarrierRowType { + override protected def backendBatchType: Convention.BatchType = VeloxBatchType + + override protected def toCarrierRowTransition: Transition = VeloxColumnarToCarrierRowExec.apply } diff --git a/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToCarrierRowExec.scala b/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToCarrierRowExec.scala index 65ce184861..b1038cb5bf 100644 --- a/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToCarrierRowExec.scala +++ b/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxColumnarToCarrierRowExec.scala @@ -17,22 +17,20 @@ package org.apache.gluten.execution import org.apache.gluten.backendsapi.velox.{VeloxBatchType, VeloxCarrierRowType} -import org.apache.gluten.extension.columnar.transition.{Convention, ConventionReq, Transitions} +import org.apache.gluten.extension.columnar.transition.Convention import org.apache.spark.sql.execution.SparkPlan case class VeloxColumnarToCarrierRowExec(override val child: SparkPlan) - extends ColumnarToCarrierRowExecBase { - override protected def fromBatchType(): Convention.BatchType = VeloxBatchType - override def rowType(): Convention.RowType = VeloxCarrierRowType + extends SharedColumnarToCarrierRowExec(child) { + override protected def backendBatchType: Convention.BatchType = VeloxBatchType + override protected def backendRowType: Convention.RowType = VeloxCarrierRowType override protected def withNewChildInternal(newChild: SparkPlan): SparkPlan = copy(child = newChild) } object VeloxColumnarToCarrierRowExec { def enforce(child: SparkPlan): SparkPlan = { - Transitions.enforceReq( - child, - ConventionReq.ofRow(ConventionReq.RowType.Is(VeloxCarrierRowType))) + SharedColumnarToCarrierRowExec.enforce(child, VeloxCarrierRowType) } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
