[ https://issues.apache.org/jira/browse/SPARK-8930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Takeshi Yamamuro updated SPARK-8930: ------------------------------------ Description: The current implementation throws an exception with meaningless messages if DataFrame#explode contain a star '*' (ISTM that explode cannot take a star in expressions) like codes blow; {code} val df = Seq(("1", "1,2"), ("2", "4"), ("3", "7,8,9")).toDF("prefix", "csv") df.explode($"*") { case Row(prefix: String, csv: String) => csv.split(",").map(v => Tuple1(prefix + ":" + v)) } {code} {code} [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) {code} was: The current implementation throws an exception with meaningless messages if DataFrame#explode contain a star '*' like codes blow; {code} 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 ) {code} {code} [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) {code} > Throw a AnalysisException with meaningful messages if DataFrame#explode takes > a star in expressions > --------------------------------------------------------------------------------------------------- > > Key: SPARK-8930 > URL: https://issues.apache.org/jira/browse/SPARK-8930 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 1.4.0 > Reporter: Takeshi Yamamuro > > The current implementation throws an exception with meaningless messages if > DataFrame#explode contain a star '*' (ISTM that explode cannot take a star in > expressions) like codes blow; > {code} > val df = Seq(("1", "1,2"), ("2", "4"), ("3", "7,8,9")).toDF("prefix", > "csv") > df.explode($"*") { case Row(prefix: String, csv: String) => > csv.split(",").map(v => Tuple1(prefix + ":" + v)) > } > {code} > {code} > [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) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org