[ 
https://issues.apache.org/jira/browse/SPARK-44702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ben Hemsi updated SPARK-44702:
------------------------------
    Priority: Minor  (was: Major)

> 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.1.3, 3.2.4, 3.3.2
>            Reporter: Ben Hemsi
>            Priority: Minor
>              Labels: spark-sql
>
> 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-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to