Github user kiszk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17302#discussion_r107189848
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/object.scala
 ---
    @@ -41,7 +41,20 @@ object CatalystSerde {
       }
     
       def generateObjAttr[T : Encoder]: Attribute = {
    -    AttributeReference("obj", encoderFor[T].deserializer.dataType, 
nullable = false)()
    +    val deserializer = encoderFor[T].deserializer
    +    val dataType = deserializer.dataType
    +    val nullable = if (deserializer.childrenResolved) {
    --- End diff --
    
    Good point. When this method is executed in other call context, 
`deserializer` has been already resolved. The following is one of examples:
    
    ```java
        at 
org.apache.spark.sql.catalyst.plans.logical.CatalystSerde$.generateObjAttr(object.scala:47)
        at 
org.apache.spark.sql.catalyst.plans.logical.CatalystSerde$.deserialize(object.scala:36)
        at 
org.apache.spark.sql.catalyst.encoders.ExpressionEncoder.resolveAndBind(ExpressionEncoder.scala:254)
        at org.apache.spark.sql.Dataset.<init>(Dataset.scala:207)
        at org.apache.spark.sql.Dataset$.ofRows(Dataset.scala:68)
        at 
org.apache.spark.sql.Dataset.org$apache$spark$sql$Dataset$$withPlan(Dataset.scala:2831)
        at 
org.apache.spark.sql.Dataset.createOrReplaceTempView(Dataset.scala:2612)
        at 
org.apache.spark.sql.test.SQLTestData$class.testData(SQLTestData.scala:54)
        at 
org.apache.spark.sql.DataFrameSuite.testData$lzycompute(DataFrameSuite.scala:43)
        at org.apache.spark.sql.DataFrameSuite.testData(DataFrameSuite.scala:43)
    ...
    ```


---
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]

Reply via email to