diff --git a/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/operation/SparkArrowbasedOperationSuite.scala b/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/operation/SparkArrowbasedOperationSuite.scala index fcc432c3e4d..2257d6877b1 100644 --- a/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/operation/SparkArrowbasedOperationSuite.scala +++ b/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/operation/SparkArrowbasedOperationSuite.scala @@ -38,6 +38,7 @@ import org.apache.kyuubi.config.KyuubiConf import org.apache.kyuubi.engine.spark.{SparkSQLEngine, WithSparkSQLEngine} import org.apache.kyuubi.engine.spark.session.SparkSessionImpl import org.apache.kyuubi.operation.SparkDataTypeTests +import org.apache.kyuubi.reflection.DynFields class SparkArrowbasedOperationSuite extends WithSparkSQLEngine with SparkDataTypeTests { @@ -406,7 +407,7 @@ class SparkArrowbasedOperationSuite extends WithSparkSQLEngine with SparkDataTyp } } (keys, values).zipped.foreach { (k, v) => - if (SQLConf.isStaticConfigKey(k)) { + if (isStaticConfigKey(k)) { throw new KyuubiException(s"Cannot modify the value of a static config: $k") } conf.setConfString(k, v) @@ -419,6 +420,21 @@ class SparkArrowbasedOperationSuite extends WithSparkSQLEngine with SparkDataTyp } } } + + /** + * This method provides a reflection-based implementation of [[SQLConf.isStaticConfigKey]] to + * adapt Spark-3.1.x + * + * TODO: Once we drop support for Spark 3.1.x, we can directly call + * [[SQLConf.isStaticConfigKey()]]. + */ + private def isStaticConfigKey(key: String): Boolean = { + val staticConfKeys = DynFields.builder() + .hiddenImpl(SQLConf.getClass, "staticConfKeys") + .build[java.util.Set[String]](SQLConf) + .get() + staticConfKeys.contains(key) + } } case class TestData(key: Int, value: String)