GitHub user jerryshao opened a pull request:

    https://github.com/apache/spark/pull/13399

    [SPARK-15620][SQL] Fix transformed dataset attributes revolve failure

    ## What changes were proposed in this pull request?
    
    Join on transformed dataset has attributes conflicts, which make query 
execution failure, for example:
    
    ```
    val dataset = Seq(1, 2, 3).toDs
    val mappedDs = dataset.map(_ + 1)
    
    mappedDs.as("t1").joinWith(mappedDs.as("t2"), $"t1.value" === 
$"t2.value").show()
    ```
    
    will throw exception:
    
    ```
    org.apache.spark.sql.AnalysisException: cannot resolve '`t1.value`' given 
input columns: [value];
      at 
org.apache.spark.sql.catalyst.analysis.package$AnalysisErrorAt.failAnalysis(package.scala:42)
      at 
org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1$$anonfun$apply$2.applyOrElse(CheckAnalysis.scala:62)
      at 
org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1$$anonfun$apply$2.applyOrElse(CheckAnalysis.scala:59)
      at 
org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$transformUp$1.apply(TreeNode.scala:287)
      at 
org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$transformUp$1.apply(TreeNode.scala:287)
    ```
    
    ## How was this patch tested?
    
    Unit test.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jerryshao/apache-spark SPARK-15620

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/13399.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #13399
    
----
commit 376c2a94f23bf51066d0590611bd37a3c566b2ff
Author: jerryshao <[email protected]>
Date:   2016-05-30T09:04:45Z

    Fix transformed Dataset attributes resolve failure

commit 00864dbf7824479d79f2c12e361d262eeee44ecb
Author: jerryshao <[email protected]>
Date:   2016-05-30T10:59:53Z

    Style fix

----


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