MaxGekk commented on code in PR #45095:
URL: https://github.com/apache/spark/pull/45095#discussion_r1494449340
##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:
##########
@@ -1151,6 +1153,21 @@ class QueryExecutionErrorsSuite
)
)
}
+
+ test("SPARK-43259: Uses unsupported custom encoder") {
+ class CustomEncoder extends Encoder[Int] {
+ override def schema: StructType = StructType(Array.empty[StructField])
+ override def clsTag: ClassTag[Int] = ClassTag.Int
+ }
+ val e = intercept[SparkRuntimeException] {
+ encoderFor(new CustomEncoder)
Review Comment:
I think this is an user facing error, see how to reproduce it using public
API:
```scala
implicit val kryoEncoder = new Encoder[KryoData] {
override def schema: StructType = StructType(Array.empty[StructField])
override def clsTag: ClassTag[KryoData] = ???
}
val ds = Seq(KryoData(1), KryoData(2)).toDS()
ds.groupByKey(p => p).count().collect()
```
it fails with:
```java
Only expression encoders are supported for now.
org.apache.spark.SparkRuntimeException: Only expression encoders are
supported for now.
at
org.apache.spark.sql.errors.QueryExecutionErrors$.unsupportedEncoderError(QueryExecutionErrors.scala:463)
at
org.apache.spark.sql.catalyst.encoders.package$.encoderFor(package.scala:34)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]