Skip to content

Commit 76a3428

Browse files
committed
fix build with new api
Signed-off-by: Yuan <yuanzhou@apache.org>
1 parent d18062d commit 76a3428

8 files changed

Lines changed: 41 additions & 0 deletions

File tree

shims/common/src/main/scala/org/apache/gluten/sql/shims/SparkShims.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,4 +290,10 @@ trait SparkShims {
290290
* similar to LeftOuter. Default implementation returns false for Spark 3.x compatibility.
291291
*/
292292
def isLeftSingleJoinType(joinType: JoinType): Boolean = false
293+
294+
/**
295+
* Extract seed value from SampleExec. In Spark 4.0+, seed is Option[Long], while in earlier
296+
* versions it's Long. This method provides a unified interface across versions.
297+
*/
298+
def getSampleExecSeed(plan: SampleExec): Long
293299
}

shims/spark33/src/main/scala/org/apache/gluten/sql/shims/spark33/Spark33Shims.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,4 +303,9 @@ class Spark33Shims extends SparkShims {
303303
assert(index >= 0)
304304
args.substring(index + "isFinalPlan=".length).trim.toBoolean
305305
}
306+
307+
override def getSampleExecSeed(plan: SampleExec): Long = {
308+
// In Spark 3.3, seed is Long (not Option[Long])
309+
plan.seed
310+
}
306311
}

shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,4 +544,9 @@ class Spark34Shims extends SparkShims {
544544
override def isFinalAdaptivePlan(p: AdaptiveSparkPlanExec): Boolean = {
545545
p.isFinalPlan
546546
}
547+
548+
override def getSampleExecSeed(plan: SampleExec): Long = {
549+
// In Spark 3.4, seed is Long (not Option[Long])
550+
plan.seed
551+
}
547552
}

shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,4 +595,9 @@ class Spark35Shims extends SparkShims {
595595
override def isFinalAdaptivePlan(p: AdaptiveSparkPlanExec): Boolean = {
596596
p.isFinalPlan
597597
}
598+
599+
override def getSampleExecSeed(plan: SampleExec): Long = {
600+
// In Spark 3.5, seed is Long (not Option[Long])
601+
plan.seed
602+
}
598603
}

shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,4 +657,9 @@ class Spark40Shims extends SparkShims {
657657
override def isLeftSingleJoinType(joinType: JoinType): Boolean = {
658658
joinType == LeftSingle
659659
}
660+
661+
override def getSampleExecSeed(plan: SampleExec): Long = {
662+
// In Spark 4.0, seed is Long (not Option[Long])
663+
plan.seed
664+
}
660665
}

shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,4 +673,9 @@ class Spark41Shims extends SparkShims {
673673
override def isLeftSingleJoinType(joinType: JoinType): Boolean = {
674674
joinType == LeftSingle
675675
}
676+
677+
override def getSampleExecSeed(plan: SampleExec): Long = {
678+
// In Spark 4.1, seed is Long (not Option[Long])
679+
plan.seed
680+
}
676681
}

shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,4 +539,9 @@ class Spark42Shims extends SparkShims {
539539
override def isLeftSingleJoinType(joinType: JoinType): Boolean = {
540540
joinType == LeftSingle
541541
}
542+
543+
override def getSampleExecSeed(plan: SampleExec): Long = {
544+
// In Spark 4.2, seed is Long (not Option[Long])
545+
plan.seed
546+
}
542547
}

shims/sparkmain/src/main/scala/org/apache/gluten/sql/shims/sparkmain/SparkMainShims.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,4 +539,9 @@ class SparkMainShims extends SparkShims {
539539
override def isLeftSingleJoinType(joinType: JoinType): Boolean = {
540540
joinType == LeftSingle
541541
}
542+
543+
override def getSampleExecSeed(plan: SampleExec): Long = {
544+
// In Spark 4.0+, seed is Option[Long]
545+
plan.seed.getOrElse(0L)
546+
}
542547
}

0 commit comments

Comments
 (0)