You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Ben Hemsi (Jira)" <ji...@apache.org> on 2023/08/07 09:19:00 UTC
[jira] [Created] (SPARK-44702) Cannot derive ExpressionEncoder when using types tagged by a trait
Ben Hemsi created SPARK-44702:
---------------------------------
Summary: Cannot derive ExpressionEncoder when using types tagged by a trait
Key: SPARK-44702
URL: https://issues.apache.org/jira/browse/SPARK-44702
Project: Spark
Issue Type: Bug
Components: SQL
Affects Versions: 3.3.2, 3.2.4, 3.1.3
Reporter: Ben Hemsi
Steps to reproduce:
{code:java}
trait Tag
case class Foo(x: Int)
case class Bar(x: Foo with Tag)
ExpressionEncoder.apply[Bar](){code}
the ExpressionEncoder throws the following error (this was for 3.1.2):
{code:java}
scala.MatchError: Foo with Tag (of class scala.reflect.internal.Types$RefinedType0)
at org.apache.spark.sql.catalyst.ScalaReflection.getConstructorParameters(ScalaReflection.scala:931)
at org.apache.spark.sql.catalyst.ScalaReflection.getConstructorParameters$(ScalaReflection.scala:928)
at org.apache.spark.sql.catalyst.ScalaReflection$.getConstructorParameters(ScalaReflection.scala:49) {code}
The bug is [on this line (on master)|https://github.com/apache/spark/blob/master/sql/api/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala#L461].
{code:java}
val TypeRef(_, _, actualTypeArgs) = dealiasedTpe {code}
which is an incomplete pattern match. The pattern match needs be extended to include matching on RefinedType as well.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org