diff --git a/docs/dev/shims.md b/docs/dev/shims.md index 24252df607e..ae7838f902d 100644 --- a/docs/dev/shims.md +++ b/docs/dev/shims.md @@ -40,6 +40,16 @@ for conflicting Shim implementations. ### Compile-time issues +#### Methods added in new versions + +If the base class or trait in the new version just adds new methods on top of previous versions and can be implemented +with default behavior, they can be added directly to the unshimmed class. For methods introduced +in newer versions that do not exist in older versions, removing the override keyword ensures that +these methods are treated as new additions rather than overrides. This allows the same class to work +across different Spark versions. + +#### Different parent class signatures + Upstream base classes we derive from might be incompatible in the sense that one version requires us to implement/override the method `M` whereas the other prohibits it by marking the base implementation `final`, E.g. `org.apache.spark.sql.catalyst.trees.TreeNode` changes diff --git a/tests/src/test/scala/org/apache/spark/sql/rapids/metrics/source/MockTaskContext.scala b/tests/src/test/scala/org/apache/spark/sql/rapids/metrics/source/MockTaskContext.scala index b0aec74feb7..6f535b04357 100644 --- a/tests/src/test/scala/org/apache/spark/sql/rapids/metrics/source/MockTaskContext.scala +++ b/tests/src/test/scala/org/apache/spark/sql/rapids/metrics/source/MockTaskContext.scala @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2023, NVIDIA CORPORATION. + * Copyright (c) 2020-2025, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ package org.apache.spark.sql.rapids.metrics.source +import java.io.Closeable import java.util import java.util.Properties @@ -102,4 +103,16 @@ class MockTaskContext(taskAttemptId: Long, partitionId: Int) extends TaskContext * removing the override keyword. */ def isFailed(): Boolean = false + + /** + * These below methods were introduced in Spark-4. It's not shimmed and added to the common class + * removing the override keyword. + */ + + private[spark] def interruptible(): Boolean = false + + private[spark] def pendingInterrupt(threadToInterrupt: Option[Thread], reason: String): Unit = {} + + private[spark] def createResourceUninterruptibly[T <: Closeable]( + resourceBuilder: => T): T = resourceBuilder }