akshaytayal commented on code in PR #13126:
URL: https://github.com/apache/gluten/pull/13126#discussion_r4109434842


##########
shims/spark42/src/main/scala/org/apache/spark/sql/execution/python/BasePythonRunnerShim.scala:
##########
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.spark.sql.execution.python
+
+import org.apache.spark.SparkEnv
+import org.apache.spark.TaskContext
+import org.apache.spark.api.python.{BasePythonRunner, ChainedPythonFunctions, 
PythonWorker}
+import org.apache.spark.sql.execution.metric.SQLMetric
+import org.apache.spark.sql.execution.python.EvalPythonExec.ArgumentMetadata
+import org.apache.spark.sql.vectorized.ColumnarBatch
+
+import java.io.DataOutputStream
+
+abstract class BasePythonRunnerShim(
+    funcs: Seq[(ChainedPythonFunctions, Long)],
+    evalType: Int,
+    argMetas: Array[Array[(Int, Option[String])]],
+    pythonMetrics: Map[String, SQLMetric])
+  extends BasePythonRunner[ColumnarBatch, ColumnarBatch](

Review Comment:
   Thanks — implemented the version-specific framing fix (Option A) in  bbe3d9a 
, mirroring Spark's own  ArrowPythonRunner  /  
ArrowPythonWithNamedArgumentRunner :
   
   • Spark 4.2  BasePythonRunnerShim  now overrides  runnerConf  ( 
super.runnerConf ++ pythonRunnerConfMap ) and  evalConf  (adds  input_type -> 
schema.json  for  SQL_ARROW_BATCHED_UDF ).
   •  pythonRunnerConfMap  /  pythonInputSchema  accessors are added to the 
shims (empty defaults) and overridden by  ColumnarArrowPythonRunner  to expose 
its  conf  /  schema .
   •  ColumnarArrowPythonRunner.writeCommand  now emits only the UDF 
definitions on Spark 4.2 (gated via  SparkVersionUtil.gteSpark42 ); the pre-4.2 
config prefix is byte-for-byte unchanged for Spark 3.4/3.5/4.0/4.1.
   
   I verified the target contract directly against Spark 4.2 bytecode — the 
framework writes  evalType → runnerConf → evalConf → writeCommand ,  runnerConf 
= super ++ pythonRunnerConf , and  evalConf  adds  "input_type" -> 
schema.json()  for the Arrow-batched eval type — so the shim reproduces exactly 
what vanilla Spark does. Compiles under  -Pspark-4.2  and  -Pspark-3.5 ; the 
full Velox Backend (x86) suite passed on this commit with all  
spark-test-spark34/35/40/41  lanes green (no regression to the shared writer 
path).
   
   End-to-end Spark 4.2 Pandas/Arrow-101 UDF coverage (executed-plan 
assertions, nondefault timezone, worker reuse) will follow via a Spark 4.2 
test-execution lane — e.g. enabling the existing  ArrowEvalPythonExecSuite  for 
Spark 4.2 — which is where an offloaded 4.2 Python UDF can actually be asserted.



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