You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Wenchen Fan (JIRA)" <ji...@apache.org> on 2016/10/19 01:46:59 UTC

[jira] [Comment Edited] (SPARK-17995) Use new attributes for columns from outer joins

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

Wenchen Fan edited comment on SPARK-17995 at 10/19/16 1:46 AM:
---------------------------------------------------------------

Can we just add a `newOuterJoinAttrs: Seq[Attribute]` parameter in the `Join` class? e.g.
{code}
case class Join(..., newOuterJoinAttrs: Seq[Attribute]) {
  def output = joinType match {
    case LeftOuterJoin => left.output ++ newOuterJoinAttrs
  }
}

object Join {
  def apply(...) = {
    val newOuterJoinAttrs = joinType match {
      case LeftOuterJoin => right.output.map(_.newInstance)
    }
    Join(..., newOuterJoinAttrs)
  }
}
{code}


was (Author: cloud_fan):
Can we just add a `newOuterJoinAttrs: Seq[Attribute]` parameter in the `Join` class? e.g.
{code}
case class Join(..., newOuterJoinAttrs: Seq[Attribute])

object Join {
  def apply(...) = {
    val newOuterJoinAttrs = joinType match {
      case LeftOuterJoin => right.output.map(_.newInstance)
    }
  }
}
{code}

> Use new attributes for columns from outer joins
> -----------------------------------------------
>
>                 Key: SPARK-17995
>                 URL: https://issues.apache.org/jira/browse/SPARK-17995
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 1.6.2, 2.0.0, 2.1.0
>            Reporter: Ryan Blue
>
> Plans involving outer joins use the same attribute reference (by exprId) to reference columns above the join and below the join. This is a false equivalence that leads to bugs like SPARK-16181, in which an attributes were incorrectly replaced by the optimizer. The column has a different schema above the outer join because its values may be null. The fix for that issue, [PR #13884](https://github.com/apache/spark/pull/13884) has a TODO comment from [~cloud_fan] to fix this by using different attributes instead of needing to special-case outer joins in rules and this issue is to track that improvement.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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