Copilot commented on code in PR #13519:
URL: https://github.com/apache/gluten/pull/13519#discussion_r4439375076


##########
gluten-substrait/src/main/scala/org/apache/spark/sql/execution/GlutenAutoAdjustStageResourceProfile.scala:
##########
@@ -241,11 +241,18 @@ object GlutenAutoAdjustStageResourceProfile extends 
Logging {
       SparkResourceUtil.getTaskSlots(sparkConf)
     } else {
       val coresPerExecutor = 
rp.getExecutorCores.getOrElse(sparkConf.get(EXECUTOR_CORES))
-      val coresPerTask = rp.getTaskCpus.getOrElse(sparkConf.get(CPUS_PER_TASK))
+      // Spark 4.3 allows fractional task cpus, so the profile and the config 
report them as
+      // BigDecimal there and as Int before. Go through the string form so 
both compile and the
+      // value stays exact.
+      val coresPerTask = BigDecimal(
+        rp.getTaskCpus.getOrElse(sparkConf.get(CPUS_PER_TASK)).toString)

Review Comment:
   With `spark.task.cpus=0.5` on Spark 4.3, driver initialization still fails: 
`GlutenDriverPlugin.setPredefinedConfigs` calls 
`SparkResourceUtil.getTaskSlots`, which parses the setting with `conf.getInt` 
and throws `NumberFormatException`. The local-mode branch above also uses that 
integer-only helper. Update the shared helper to use exact decimal parsing and 
floor division, with regression tests for fractional CPU settings.



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