Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/10260#discussion_r47321487
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/encoders/ExpressionEncoder.scala
---
@@ -251,6 +251,27 @@ case class ExpressionEncoder[T](
val plan = Project(Alias(unbound, "")() :: Nil, LocalRelation(schema))
val analyzedPlan = SimpleAnalyzer.execute(plan)
+ if (!analyzedPlan.resolved) {
+ // We couldn't resolve, this means something is wrong with the
schemas.
+ analyzedPlan match {
+ case p @ Project(projectList, _) => {
+ p.projectList.foreach { e: NamedExpression => e.foreach { _
match {
+ case u @ UpCast(child, dataType, walkedTypePath) => {
+ throw new AnalysisException(s"Cannot resolve
`${child.prettyString}`. " +
+ "The type path of the target object is:\n" +
+ walkedTypePath.mkString("", "\n", "\n") +
+ "Ensure that the input schema contains this field.\n -
Input schema is " +
+ schema.map(_.simpleString).mkString(", "))
--- End diff --
should we also provide the type information of attributes in `schema`?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]