[ 
https://issues.apache.org/jira/browse/SPARK-26063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16687985#comment-16687985
 ] 

Gengliang Wang commented on SPARK-26063:
----------------------------------------

Hi [~mgaido], thanks for the investigation.  I will create a backport PR.

> CatalystDataToAvro gives "UnresolvedException: Invalid call to dataType on 
> unresolved object" when requested for numberedTreeString
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-26063
>                 URL: https://issues.apache.org/jira/browse/SPARK-26063
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.4.0
>            Reporter: Jacek Laskowski
>            Priority: Major
>
> The following gives 
> {{org.apache.spark.sql.catalyst.analysis.UnresolvedException: Invalid call to 
> dataType on unresolved object, tree: 'id}}:
> {code:java}
> // ./bin/spark-shell --packages org.apache.spark:spark-avro_2.12:2.4.0
> scala> spark.version
> res0: String = 2.4.0
> import org.apache.spark.sql.avro._
> val q = spark.range(1).withColumn("to_avro_id", to_avro('id))
> val logicalPlan = q.queryExecution.logical
> scala> logicalPlan.expressions.drop(1).head.numberedTreeString
> org.apache.spark.sql.catalyst.analysis.UnresolvedException: Invalid call to 
> dataType on unresolved object, tree: 'id
> at 
> org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute.dataType(unresolved.scala:105)
> at 
> org.apache.spark.sql.avro.CatalystDataToAvro.simpleString(CatalystDataToAvro.scala:56)
> at 
> org.apache.spark.sql.catalyst.expressions.Expression.verboseString(Expression.scala:233)
> at 
> org.apache.spark.sql.catalyst.trees.TreeNode.generateTreeString(TreeNode.scala:548)
> at 
> org.apache.spark.sql.catalyst.trees.TreeNode.generateTreeString(TreeNode.scala:569)
> at org.apache.spark.sql.catalyst.trees.TreeNode.treeString(TreeNode.scala:472)
> at org.apache.spark.sql.catalyst.trees.TreeNode.treeString(TreeNode.scala:469)
> at 
> org.apache.spark.sql.catalyst.trees.TreeNode.numberedTreeString(TreeNode.scala:483)
> ... 51 elided{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to