GitHub user maropu opened a pull request:

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

    [SPARK-8930][SQL] Support a star '*' in generator function arguments

    The current implementation throws an exception if generators contain a star 
'*' like codes blow;
    val df = Seq(("1", "1,2"), ("2", "4"), ("3", "7,8,9")).toDF("prefix", "csv")
    checkAnswer(
    df.explode($"*")
    { case Row(prefix: String, csv: String) => csv.split(",").map(v => 
Tuple1(prefix + ":" + v)) }
    ,
    Row("1", "1,2", "1:1") :: Row("1", "1,2", "1:2")
    :: Row("2", "4", "2:4")
    :: Row("3", "7,8,9", "3:7") :: Row("3", "7,8,9", "3:8") :: Row("3", 
"7,8,9", "3:9")
    :: Nil
    )
    [info] - explode takes UnresolvedStar *** FAILED *** (14 milliseconds)
    [info] org.apache.spark.sql.AnalysisException: cannot resolve '_1' given 
input columns prefix, csv;
    [info] at 
org.apache.spark.sql.catalyst.analysis.package$AnalysisErrorAt.failAnalysis(package.scala:42)
    [info] at 
org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1$$anonfun$apply$2.applyOrElse(CheckAnalysis.scala:55)
    [info] at 
org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1$$anonfun$apply$2.applyOrElse(CheckAnalysis.scala:52)
    [info] at 
org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$transformUp$1.apply(TreeNode.scala:291)
    [info] at 
org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$transformUp$1.apply(TreeNode.scala:291)
    [info] at 
org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:51)
    [info] at 
org.apache.spark.sql.catalyst.trees.TreeNode.transformUp(TreeNode.scala:290)
    [info] at 
org.apache.spark.sql.catalyst.plans.QueryPlan.transformExpressionUp$1(QueryPlan.scala:107)
    [info] at 
org.apache.spark.sql.catalyst.plans.QueryPlan.org$apache$spark$sql$catalyst$plans$QueryPlan$$recursiveTransform$2(QueryPlan.scala:117)
    [info] at 
org.apache.spark.sql.catalyst.plans.QueryPlan$$anonfun$org$apache$spark$sql$catalyst$plans$QueryPlan$$recursiveTransform$2$1.apply(QueryPlan.scala:1
    21)
    [info] at 
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    [info] at 
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    [info] at scala.collection.immutable.List.foreach(List.scala:318)
    [info] at 
scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
    [info] at scala.collection.AbstractTraversable.map(Traversable.scala:105)

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

    $ git pull https://github.com/maropu/spark UnresolvedStartIssueInGenerate

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

    https://github.com/apache/spark/pull/7305.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 #7305
    
----
commit 70fdd4139a16fc964de19f54884340089f61d95b
Author: Takeshi YAMAMURO <[email protected]>
Date:   2015-07-09T00:35:54Z

    Fix a bug that throws an exception when Generator contains a UnresolvedStar

----


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