Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Reproduce the error with classNotFound with SparkResult
  • Loading branch information
zhenlineo committed Jul 25, 2023
commit 33d896138b87b2069d4452a78305db7289f3a596
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import org.scalatest.concurrent.Eventually._

import org.apache.spark.SparkException
import org.apache.spark.sql.connect.client.util.RemoteSparkSession
import org.apache.spark.sql.types.{StringType, StructField, StructType}
import org.apache.spark.util.ThreadUtils

/**
Expand Down Expand Up @@ -247,4 +248,19 @@ class SparkSessionE2ESuite extends RemoteSparkSession {
}
assert(e.getMessage contains "OPERATION_CANCELED")
}

test("spark result schema") {
val df = spark.sql("select val from (values ('Hello'), ('World')) as t(val)")
// val result = df.collectResult()
// try {
// val schema = result.schema
// assert(schema == StructType(StructField("val", StringType, nullable = false) :: Nil))
// } finally {
// result.close()
// }
df.withResult { result =>
val schema = result.schema
assert(schema == StructType(StructField("val", StringType, nullable = false) :: Nil))
}
}
}