Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9729#discussion_r44898288
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/encoders/ExpressionEncoder.scala
 ---
    @@ -67,47 +67,77 @@ object ExpressionEncoder {
       def tuple(encoders: Seq[ExpressionEncoder[_]]): ExpressionEncoder[_] = {
         encoders.foreach(_.assertUnresolved())
     
    -    val schema =
    -      StructType(
    -        encoders.zipWithIndex.map {
    -          case (e, i) => StructField(s"_${i + 1}", if (e.flat) 
e.schema.head.dataType else e.schema)
    -        })
    +    val schema = StructType(encoders.zipWithIndex.map {
    +      case (e, i) => StructField(s"_${i + 1}", if (e.flat) 
e.schema.head.dataType else e.schema)
    +    })
    +
         val cls = 
Utils.getContextOrSparkClassLoader.loadClass(s"scala.Tuple${encoders.size}")
     
    -    // Rebind the encoders to the nested schema.
    -    val newConstructExpressions = encoders.zipWithIndex.map {
    -      case (e, i) if !e.flat => e.nested(i).fromRowExpression
    -      case (e, i) => e.shift(i).fromRowExpression
    --- End diff --
    
    This is not right. `ExpressionEncoder.shift` update `ordinal` of 
`BoundReference` with a delta, but here the `i` **is** the `ordinal` we wanna 
update, not a delta.


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