[
https://issues.apache.org/jira/browse/SPARK-44702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated SPARK-44702:
-----------------------------------
Labels: pull-request-available spark-sql (was: spark-sql)
> 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: pull-request-available, 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: [email protected]
For additional commands, e-mail: [email protected]