[KYUUBI #5180] Replace deprecated classes by equivalent in scala.tools.nsc.interpreter package
### _Why are the changes needed?_ - Replace deprecated class alias `scala.tools.nsc.interpreter.IR` and `scala.tools.nsc.interpreter.JPrintWriter` in Scala 2.13 with equivalent classes `scala.tools.nsc.interpreter.Results` and `java.io.PrintWriter` ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [x] [Run test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests) locally before make a pull request ### _Was this patch authored or co-authored using generative AI tooling?_ Closes #5180 from bowenliang123/interpreter-213. Closes #5180 e76f1f05a [liangbowen] prevent to use deprecated classes in the package scala.tools.nsc.interpreter of Scala 2.13 Authored-by: liangbowen <liangbowen@gf.com.cn> Signed-off-by: liangbowen <liangbowen@gf.com.cn>
This commit is contained in:
parent
4213e20945
commit
b9fc85c859
@ -17,12 +17,11 @@
|
||||
|
||||
package org.apache.kyuubi.engine.spark.repl
|
||||
|
||||
import java.io.{ByteArrayOutputStream, File}
|
||||
import java.io.{ByteArrayOutputStream, File, PrintWriter}
|
||||
import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
import scala.tools.nsc.Settings
|
||||
import scala.tools.nsc.interpreter.IR
|
||||
import scala.tools.nsc.interpreter.JPrintWriter
|
||||
import scala.tools.nsc.interpreter.Results
|
||||
|
||||
import org.apache.spark.SparkContext
|
||||
import org.apache.spark.repl.SparkILoop
|
||||
@ -34,7 +33,7 @@ import org.apache.kyuubi.Utils
|
||||
private[spark] case class KyuubiSparkILoop private (
|
||||
spark: SparkSession,
|
||||
output: ByteArrayOutputStream)
|
||||
extends SparkILoop(None, new JPrintWriter(output)) {
|
||||
extends SparkILoop(None, new PrintWriter(output)) {
|
||||
import KyuubiSparkILoop._
|
||||
|
||||
val result = new DataFrameHolder(spark)
|
||||
@ -102,7 +101,7 @@ private[spark] case class KyuubiSparkILoop private (
|
||||
|
||||
def clearResult(statementId: String): Unit = result.unset(statementId)
|
||||
|
||||
def interpretWithRedirectOutError(statement: String): IR.Result = withLockRequired {
|
||||
def interpretWithRedirectOutError(statement: String): Results.Result = withLockRequired {
|
||||
Console.withOut(output) {
|
||||
Console.withErr(output) {
|
||||
this.interpret(statement)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user